Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
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"));
....@@ -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);
....@@ -555,6 +564,18 @@
555564 oe.buttonGroup.add(dummyButton);
556565 */
557566 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
567
+
568
+ oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
+ undoButton.setToolTipText("Undo changes");
570
+ undoButton.addActionListener(this);
571
+
572
+ oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
+ redoButton.setToolTipText("Redo changes");
574
+ redoButton.addActionListener(this);
575
+
576
+ oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
+ saveButton.setToolTipText("Save changes");
578
+ saveButton.addActionListener(this);
558579
559580 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
560581 liveCB.setToolTipText("Enable animation");
....@@ -858,6 +879,7 @@
858879 } else if(e.getSource() == liveCB)
859880 {
860881 cameraView.ToggleLive();
882
+ refreshContents(false);
861883 }
862884 else if(e.getSource() == supportCB)
863885 {
....@@ -1265,7 +1287,7 @@
12651287 memoryItem.addActionListener(this);
12661288 menu.add(analyzeItem = new MenuItem("Analyze"));
12671289 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1290
+ menu.add(dumpItem = new MenuItem("Print"));
12691291 dumpItem.addActionListener(this);
12701292 // menu.add(pathItem = new MenuItem("From-to path"));
12711293 // pathItem.addActionListener(this);
....@@ -1956,6 +1978,18 @@
19561978 {
19571979 DumpObject();
19581980 } else
1981
+ if (source == undoButton)
1982
+ {
1983
+ Undo();
1984
+ } else
1985
+ if (source == redoButton)
1986
+ {
1987
+ Redo();
1988
+ } else
1989
+ if (source == saveButton)
1990
+ {
1991
+ Save();
1992
+ } else
19591993 if (source == oneStepButton)
19601994 {
19611995 Globals.ONESTEP = true;
....@@ -2517,7 +2551,7 @@
25172551 } else
25182552 if (source == genNormalsMESHItem)
25192553 {
2520
- GenNormals(true); // TODO
2554
+ GenNormalsMESH();
25212555 } else
25222556 if (source == genNormalsORGANItem)
25232557 {
....@@ -2582,6 +2616,22 @@
25822616 if (source == unmarkleavesItem)
25832617 {
25842618 MarkLeaves(false);
2619
+ } else
2620
+ if (source == rewindleavesItem)
2621
+ {
2622
+ RewindLeaves(true);
2623
+ } else
2624
+ if (source == unrewindleavesItem)
2625
+ {
2626
+ RewindLeaves(false);
2627
+ } else
2628
+ if (source == randomleavesItem)
2629
+ {
2630
+ RandomLeaves(true);
2631
+ } else
2632
+ if (source == unrandomleavesItem)
2633
+ {
2634
+ RandomLeaves(false);
25852635 } else
25862636 if (source == flipVItem)
25872637 {
....@@ -3128,7 +3178,8 @@
31283178 sideView.object = group;
31293179 }
31303180
3131
-// fix "+" issue group.editWindow = this;
3181
+// fix "+" issue
3182
+ group.editWindow = this;
31323183
31333184 /*
31343185 currentLayout = radio.layout;
....@@ -3403,7 +3454,8 @@
34033454
34043455 int size = obj.MemorySize();
34053456
3406
- System.err.println((size/1024) + " KB is the size of " + obj);
3457
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3458
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
34073459 }
34083460 }
34093461 catch (Exception e)
....@@ -3484,6 +3536,13 @@
34843536 void GenNormals(boolean crease)
34853537 {
34863538 group.GenNormalsS(crease);
3539
+
3540
+ refreshContents();
3541
+ }
3542
+
3543
+ void GenNormalsMESH()
3544
+ {
3545
+ group.GenNormalsMeshS();
34873546
34883547 refreshContents();
34893548 }
....@@ -4111,6 +4170,18 @@
41114170 refreshContents();
41124171 }
41134172
4173
+ void RewindLeaves(boolean hide)
4174
+ {
4175
+ group.selection.RewindLeaves(hide);
4176
+ refreshContents();
4177
+ }
4178
+
4179
+ void RandomLeaves(boolean hide)
4180
+ {
4181
+ group.selection.RandomLeaves(hide);
4182
+ refreshContents();
4183
+ }
4184
+
41144185 void SetTexRes(int tr)
41154186 {
41164187 group.selection.SetTexRes(tr);
....@@ -4286,7 +4357,6 @@
42864357 //case 702: // Event.LIST_DESELECT
42874358 group.deselectAll();
42884359 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904360 if (tps != null)
42914361 {
42924362 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4365,8 @@
42954365
42964366 //if (child.parent != null)
42974367 //child.parent.addSelectee(child);
4368
+ objEditor.SetMaterial(child);
42984369 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024370 }
43034371 }
43044372 // else
....@@ -4308,8 +4376,6 @@
43084376 // System.err.println("info : " + group.GetPath());
43094377 // }
43104378
4311
- objEditor.SetText(); // jan 2014
4312
-
43134379 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43144380 CameraPane.flash = true;
43154381
....@@ -4333,6 +4399,26 @@
43334399
43344400 freezemodel = false;
43354401 }
4402
+
4403
+ void refreshContents(boolean cp)
4404
+ {
4405
+ if (!Globals.MOUSEDRAGGED)
4406
+ {
4407
+ objEditor.ClearInfo(); // .GetMaterial());
4408
+
4409
+ for (int i=0; i < group.selection.Size(); i++)
4410
+ {
4411
+ Object3D child = (Object3D) group.selection.get(i);
4412
+
4413
+ objEditor.AddInfo(child, this, true);
4414
+ System.err.println("info : " + child.GetPath());
4415
+ }
4416
+
4417
+ objEditor.SetText(); // jan 2014
4418
+ }
4419
+
4420
+ super.refreshContents(cp);
4421
+ }
43364422
43374423 void linkSomething(Object3D thing)
43384424 {
....@@ -4404,6 +4490,7 @@
44044490 {
44054491 if (group.selection.isEmpty())
44064492 return;
4493
+
44074494 Grafreed.clipboardIsTempGroup = false;
44084495 Composite tGroup = null;
44094496 if (group.selection.size() > 0) // 1)
....@@ -4414,6 +4501,7 @@
44144501
44154502 if (cut)
44164503 {
4504
+ Save();
44174505 //int indices[] = jList.getSelectedIndices();
44184506 //for (int i = indices.length - 1; i >= 0; i--)
44194507 //jList.remove(indices[i]);
....@@ -4503,8 +4591,10 @@
45034591 }
45044592
45054593 }
4594
+
45064595 if (Grafreed.clipboardIsTempGroup)
45074596 Grafreed.clipboard = tGroup;
4597
+
45084598 if (cut)
45094599 {
45104600 ResetModel();
....@@ -5129,6 +5219,9 @@
51295219 cButton clearpanelButton;
51305220 cButton unselectButton;
51315221
5222
+ cButton saveButton;
5223
+ cButton undoButton;
5224
+ cButton redoButton;
51325225 cButton oneStepButton;
51335226
51345227 cButton screenfitButton;
....@@ -5226,6 +5319,10 @@
52265319 private MenuItem showleavesItem;
52275320 private MenuItem markleavesItem;
52285321 private MenuItem unmarkleavesItem;
5322
+ private MenuItem rewindleavesItem;
5323
+ private MenuItem unrewindleavesItem;
5324
+ private MenuItem randomleavesItem;
5325
+ private MenuItem unrandomleavesItem;
52295326
52305327 private MenuItem flipVItem;
52315328 private MenuItem unflipVItem;