Normand Briere
2019-06-23 f1382bc839a74ef1d1534c61ea94e53cf54716df
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"));
....@@ -175,7 +176,6 @@
175176 copyItem.addActionListener(this);
176177 pasteItem = menu.add(new MenuItem("Paste"));
177178 pasteItem.addActionListener(this);
178
- menu.add("-");
179179
180180 menu.add("-");
181181 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -202,7 +202,7 @@
202202 //zBufferItem.addActionListener(this);
203203 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204204 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
205
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206206 revertCameraItem.addActionListener(this);
207207
208208 cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
....@@ -245,7 +245,7 @@
245245
246246 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247247 toggleDebugItem.addItemListener(this);
248
- toggleDebugItem.setState(CameraPane.DEBUG);
248
+ toggleDebugItem.setState(Globals.DEBUG);
249249
250250 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251251 toggleFrustumItem.addItemListener(this);
....@@ -266,7 +266,7 @@
266266 // animationItem.addItemListener(this);
267267 // animationItem.setState(CameraPane.ANIMATION);
268268 cameraMenu.add("-");
269
- cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
269
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270270 editCameraItem.addActionListener(this);
271271
272272 if (Globals.ADVANCED)
....@@ -368,11 +368,11 @@
368368 billboardItem.addActionListener(this);
369369 csgItem = menu.add(new MenuItem("CSG"));
370370 csgItem.addActionListener(this);
371
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
372372 shadowXItem.addActionListener(this);
373
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
374374 shadowYItem.addActionListener(this);
375
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376376 shadowZItem.addActionListener(this);
377377 if (Globals.ADVANCED)
378378 {
....@@ -469,6 +469,14 @@
469469 markleavesItem.addActionListener(this);
470470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
471471 unmarkleavesItem.addActionListener(this);
472
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
473
+ rewindleavesItem.addActionListener(this);
474
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
475
+ unrewindleavesItem.addActionListener(this);
476
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
477
+ randomleavesItem.addActionListener(this);
478
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
479
+ unrandomleavesItem.addActionListener(this);
472480 menu.add("-");
473481 flipVItem = menu.add(new MenuItem("Flip V"));
474482 flipVItem.addActionListener(this);
....@@ -526,6 +534,18 @@
526534
527535 void SetupUI2(ObjEditor oe)
528536 {
537
+ // June 2019
538
+ if (oe == null)
539
+ {
540
+ //super.SetupUI2(this);
541
+ //return;
542
+ }
543
+
544
+ if (copy != group)
545
+ {
546
+ //super.SetupUI2(this);
547
+ }
548
+
529549 //new Exception().printStackTrace();
530550
531551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -556,11 +576,35 @@
556576 */
557577 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
558578
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
582
+
583
+ oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
559603 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
560604 liveCB.setToolTipText("Enable animation");
561605 liveCB.addItemListener(this);
562606
563
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
564608 oneStepButton.setToolTipText("Animate one step forward");
565609 oneStepButton.addActionListener(this);
566610
....@@ -568,7 +612,7 @@
568612 fastCB.setToolTipText("Fast mode");
569613 fastCB.addItemListener(this);
570614
571
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
615
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
572616 trackCB.setToolTipText("Enable tracking");
573617 trackCB.addItemListener(this);
574618
....@@ -592,19 +636,19 @@
592636
593637 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
594638
595
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596640 twoButton.setToolTipText("Show center view only");
597641 twoButton.addActionListener(this);
598
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
599643 fourButton.addActionListener(this);
600644 fourButton.setToolTipText("Show left panel only");
601
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602646 sixButton.setToolTipText("2-column layout left");
603647 sixButton.addActionListener(this);
604
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605649 threeButton.setToolTipText("2-column layout right");
606650 threeButton.addActionListener(this);
607
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608652 sevenButton.setToolTipText("3-column layout");
609653 sevenButton.addActionListener(this);
610654 //
....@@ -619,32 +663,30 @@
619663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
620664 //clearButton.addActionListener(this);
621665
622
- cGridBag commandsPanel = new cGridBag();
623
-
624
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
625667 editButton.setToolTipText("Edit selection");
626668 editButton.addActionListener(this);
627669
628
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629671 uneditButton.setToolTipText("Unedit selection");
630672 uneditButton.addActionListener(this);
631673
632
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
633675 allParamsButton.setToolTipText("Edit all params");
634676 allParamsButton.addActionListener(this);
635677
636
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637679 clearPanelButton.setToolTipText("Clear edit panel");
638680 clearPanelButton.addActionListener(this);
639681
640
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641683 unselectButton.setToolTipText("Unselect");
642684 unselectButton.addActionListener(this);
643685
644
- commandsPanel.preferredHeight = 1;
686
+ editCommandsPanel.preferredHeight = 1;
645687
646
- oe.treePanel.add(commandsPanel);
647
- oe.treePanel.Return();
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
648690
649691 // oe.aConstraints.gridx += 1;
650692 // oe.aConstraints.weighty = 0;
....@@ -796,6 +838,8 @@
796838
797839 void SetupViews(ObjEditor oe)
798840 {
841
+ theFrame = this;
842
+
799843 oe.SetupViews();
800844
801845 System.out.println("SetupViews");
....@@ -858,6 +902,7 @@
858902 } else if(e.getSource() == liveCB)
859903 {
860904 cameraView.ToggleLive();
905
+ refreshContents(false);
861906 }
862907 else if(e.getSource() == supportCB)
863908 {
....@@ -1265,7 +1310,7 @@
12651310 memoryItem.addActionListener(this);
12661311 menu.add(analyzeItem = new MenuItem("Analyze"));
12671312 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1313
+ menu.add(dumpItem = new MenuItem("Print"));
12691314 dumpItem.addActionListener(this);
12701315 // menu.add(pathItem = new MenuItem("From-to path"));
12711316 // pathItem.addActionListener(this);
....@@ -1406,6 +1451,7 @@
14061451 shadow.material = new cMaterial(obj.material);
14071452 shadow.material.diffuse = 0.0001f;
14081453 shadow.material.specular = 0.0001f;
1454
+ //shadow.projectedVertices[1].x = 300;
14091455
14101456 makeSomething(shadow);
14111457 }
....@@ -1955,6 +2001,30 @@
19552001 if (source == dumpItem)
19562002 {
19572003 DumpObject();
2004
+ } else
2005
+ if (source == minButton)
2006
+ {
2007
+ Minimize();
2008
+ } else
2009
+ if (source == maxButton)
2010
+ {
2011
+ Maximize();
2012
+ } else
2013
+ if (source == fullButton)
2014
+ {
2015
+ ToggleFullScreen();
2016
+ } else
2017
+ if (source == undoButton)
2018
+ {
2019
+ Undo();
2020
+ } else
2021
+ if (source == redoButton)
2022
+ {
2023
+ Redo();
2024
+ } else
2025
+ if (source == saveButton)
2026
+ {
2027
+ Save();
19582028 } else
19592029 if (source == oneStepButton)
19602030 {
....@@ -2517,7 +2587,7 @@
25172587 } else
25182588 if (source == genNormalsMESHItem)
25192589 {
2520
- GenNormals(true); // TODO
2590
+ GenNormalsMESH();
25212591 } else
25222592 if (source == genNormalsORGANItem)
25232593 {
....@@ -2582,6 +2652,22 @@
25822652 if (source == unmarkleavesItem)
25832653 {
25842654 MarkLeaves(false);
2655
+ } else
2656
+ if (source == rewindleavesItem)
2657
+ {
2658
+ RewindLeaves(true);
2659
+ } else
2660
+ if (source == unrewindleavesItem)
2661
+ {
2662
+ RewindLeaves(false);
2663
+ } else
2664
+ if (source == randomleavesItem)
2665
+ {
2666
+ RandomLeaves(true);
2667
+ } else
2668
+ if (source == unrandomleavesItem)
2669
+ {
2670
+ RandomLeaves(false);
25852671 } else
25862672 if (source == flipVItem)
25872673 {
....@@ -2849,6 +2935,24 @@
28492935 bigThree.ClearUI();
28502936 bigThree.add(centralPanel);
28512937 bigThree.FlushUI();
2938
+
2939
+ cameraView.requestFocusInWindow();
2940
+
2941
+// refreshContents(true);
2942
+//
2943
+// try
2944
+// {
2945
+// java.awt.Robot bot = new java.awt.Robot();
2946
+// int mask = InputEvent.BUTTON1_MASK;
2947
+// bot.mouseMove(100, 100);
2948
+// bot.mousePress(mask);
2949
+// bot.mouseRelease(mask);
2950
+// }
2951
+// catch (Exception e)
2952
+// {
2953
+//
2954
+// }
2955
+
28522956 } else
28532957 if (source == threeButton)
28542958 {
....@@ -2885,6 +2989,8 @@
28852989 bigThree.add(centralPanel);
28862990 bigThree.add(XYZPanel);
28872991 bigThree.FlushUI();
2992
+
2993
+ cameraView.requestFocusInWindow();
28882994 } else
28892995 if (source == fourButton)
28902996 {
....@@ -2920,6 +3026,8 @@
29203026 bigThree.ClearUI();
29213027 bigThree.add(scenePanel);
29223028 bigThree.FlushUI();
3029
+
3030
+ cameraView.requestFocusInWindow();
29233031 } else
29243032 if (source == sixButton)
29253033 {
....@@ -2956,6 +3064,8 @@
29563064 bigThree.add(scenePanel);
29573065 bigThree.add(centralPanel);
29583066 bigThree.FlushUI();
3067
+
3068
+ cameraView.requestFocusInWindow();
29593069 } else
29603070 if (source == sevenButton)
29613071 {
....@@ -2993,6 +3103,8 @@
29933103 bigThree.add(centralPanel);
29943104 bigThree.add(XYZPanel);
29953105 bigThree.FlushUI();
3106
+
3107
+ cameraView.requestFocusInWindow();
29963108 } else
29973109 if (source == rootButton)
29983110 {
....@@ -3004,6 +3116,7 @@
30043116 EditObject(obj);
30053117 }
30063118
3119
+ cameraView.requestFocusInWindow();
30073120 refreshContents(true);
30083121 } else
30093122 if (source == closeButton)
....@@ -3025,6 +3138,8 @@
30253138 break;
30263139 }
30273140 }
3141
+
3142
+ cameraView.requestFocusInWindow();
30283143 refreshContents(true);
30293144 } else
30303145 if (source == editItem || source == editButton)
....@@ -3128,7 +3243,8 @@
31283243 sideView.object = group;
31293244 }
31303245
3131
-// fix "+" issue group.editWindow = this;
3246
+// fix "+" issue
3247
+ //group.editWindow = this;
31323248
31333249 /*
31343250 currentLayout = radio.layout;
....@@ -3141,6 +3257,8 @@
31413257 //group.parent = null; // ROOT
31423258 //group.attributes = -1;
31433259 ResetModel();
3260
+
3261
+ cameraView.requestFocusInWindow();
31443262 refreshContents(true);
31453263 } else if (event.getSource() == editCameraItem)
31463264 {
....@@ -3164,7 +3282,6 @@
31643282 }
31653283
31663284 boolean useclient = false;
3167
- cRadio radio;
31683285
31693286 void ToggleRoot()
31703287 {
....@@ -3403,7 +3520,8 @@
34033520
34043521 int size = obj.MemorySize();
34053522
3406
- System.err.println((size/1024) + " KB is the size of " + obj);
3523
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3524
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
34073525 }
34083526 }
34093527 catch (Exception e)
....@@ -3484,6 +3602,13 @@
34843602 void GenNormals(boolean crease)
34853603 {
34863604 group.GenNormalsS(crease);
3605
+
3606
+ refreshContents();
3607
+ }
3608
+
3609
+ void GenNormalsMESH()
3610
+ {
3611
+ group.GenNormalsMeshS();
34873612
34883613 refreshContents();
34893614 }
....@@ -4111,6 +4236,18 @@
41114236 refreshContents();
41124237 }
41134238
4239
+ void RewindLeaves(boolean hide)
4240
+ {
4241
+ group.selection.RewindLeaves(hide);
4242
+ refreshContents();
4243
+ }
4244
+
4245
+ void RandomLeaves(boolean hide)
4246
+ {
4247
+ group.selection.RandomLeaves(hide);
4248
+ refreshContents();
4249
+ }
4250
+
41144251 void SetTexRes(int tr)
41154252 {
41164253 group.selection.SetTexRes(tr);
....@@ -4286,7 +4423,6 @@
42864423 //case 702: // Event.LIST_DESELECT
42874424 group.deselectAll();
42884425 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904426 if (tps != null)
42914427 {
42924428 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4431,8 @@
42954431
42964432 //if (child.parent != null)
42974433 //child.parent.addSelectee(child);
4434
+ objEditor.SetMaterial(child);
42984435 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024436 }
43034437 }
43044438 // else
....@@ -4308,8 +4442,6 @@
43084442 // System.err.println("info : " + group.GetPath());
43094443 // }
43104444
4311
- objEditor.SetText(); // jan 2014
4312
-
43134445 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43144446 CameraPane.flash = true;
43154447
....@@ -4333,6 +4465,26 @@
43334465
43344466 freezemodel = false;
43354467 }
4468
+
4469
+ void refreshContents(boolean cp)
4470
+ {
4471
+ if (!Globals.MOUSEDRAGGED)
4472
+ {
4473
+ objEditor.ClearInfo(); // .GetMaterial());
4474
+
4475
+ for (int i=0; i < group.selection.Size(); i++)
4476
+ {
4477
+ Object3D child = (Object3D) group.selection.get(i);
4478
+
4479
+ objEditor.AddInfo(child, this, true);
4480
+ System.err.println("info : " + child.GetPath());
4481
+ }
4482
+
4483
+ objEditor.SetText(); // jan 2014
4484
+ }
4485
+
4486
+ super.refreshContents(cp);
4487
+ }
43364488
43374489 void linkSomething(Object3D thing)
43384490 {
....@@ -4404,6 +4556,7 @@
44044556 {
44054557 if (group.selection.isEmpty())
44064558 return;
4559
+
44074560 Grafreed.clipboardIsTempGroup = false;
44084561 Composite tGroup = null;
44094562 if (group.selection.size() > 0) // 1)
....@@ -4414,6 +4567,7 @@
44144567
44154568 if (cut)
44164569 {
4570
+ Save();
44174571 //int indices[] = jList.getSelectedIndices();
44184572 //for (int i = indices.length - 1; i >= 0; i--)
44194573 //jList.remove(indices[i]);
....@@ -4503,8 +4657,10 @@
45034657 }
45044658
45054659 }
4660
+
45064661 if (Grafreed.clipboardIsTempGroup)
45074662 Grafreed.clipboard = tGroup;
4663
+
45084664 if (cut)
45094665 {
45104666 ResetModel();
....@@ -5129,6 +5285,12 @@
51295285 cButton clearpanelButton;
51305286 cButton unselectButton;
51315287
5288
+ cButton minButton;
5289
+ cButton maxButton;
5290
+ cButton fullButton;
5291
+ cButton undoButton;
5292
+ cButton redoButton;
5293
+ cButton saveButton;
51325294 cButton oneStepButton;
51335295
51345296 cButton screenfitButton;
....@@ -5141,14 +5303,6 @@
51415303 cButton closeButton;
51425304
51435305 cButton setsupportButton;
5144
-
5145
- cButton twoButton;
5146
- cButton sixButton;
5147
- cButton threeButton;
5148
- cButton sevenButton;
5149
- cButton fourButton; // full panel
5150
- cButton oneButton; // full XYZ
5151
- //cButton currentLayout;
51525306
51535307 //
51545308 //Composite
....@@ -5226,6 +5380,10 @@
52265380 private MenuItem showleavesItem;
52275381 private MenuItem markleavesItem;
52285382 private MenuItem unmarkleavesItem;
5383
+ private MenuItem rewindleavesItem;
5384
+ private MenuItem unrewindleavesItem;
5385
+ private MenuItem randomleavesItem;
5386
+ private MenuItem unrandomleavesItem;
52295387
52305388 private MenuItem flipVItem;
52315389 private MenuItem unflipVItem;