Normand Briere
2019-06-21 15123b19e7bc8da2869429b07f0fbaa0598e945e
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"));
....@@ -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);
....@@ -550,6 +564,18 @@
550564 oe.buttonGroup.add(dummyButton);
551565 */
552566 //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);
553579
554580 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
555581 liveCB.setToolTipText("Enable animation");
....@@ -853,6 +879,7 @@
853879 } else if(e.getSource() == liveCB)
854880 {
855881 cameraView.ToggleLive();
882
+ refreshContents(false);
856883 }
857884 else if(e.getSource() == supportCB)
858885 {
....@@ -1260,7 +1287,7 @@
12601287 memoryItem.addActionListener(this);
12611288 menu.add(analyzeItem = new MenuItem("Analyze"));
12621289 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1290
+ menu.add(dumpItem = new MenuItem("Print"));
12641291 dumpItem.addActionListener(this);
12651292 // menu.add(pathItem = new MenuItem("From-to path"));
12661293 // pathItem.addActionListener(this);
....@@ -1951,6 +1978,18 @@
19511978 {
19521979 DumpObject();
19531980 } 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
19541993 if (source == oneStepButton)
19551994 {
19561995 Globals.ONESTEP = true;
....@@ -2004,6 +2043,14 @@
20042043 if (source == cutItem || source == clearButton)
20052044 {
20062045 loadClipboard(true);
2046
+ } else
2047
+ if (source == undoItem)
2048
+ {
2049
+ Undo();
2050
+ } else
2051
+ if (source == redoItem)
2052
+ {
2053
+ Redo();
20072054 } else
20082055 if (source == duplicateItem)
20092056 {
....@@ -2504,7 +2551,7 @@
25042551 } else
25052552 if (source == genNormalsMESHItem)
25062553 {
2507
- GenNormals(true); // TODO
2554
+ GenNormalsMESH();
25082555 } else
25092556 if (source == genNormalsORGANItem)
25102557 {
....@@ -2569,6 +2616,22 @@
25692616 if (source == unmarkleavesItem)
25702617 {
25712618 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);
25722635 } else
25732636 if (source == flipVItem)
25742637 {
....@@ -3028,7 +3091,7 @@
30283091 child.CloseUI();
30293092 listUI.remove(child);
30303093
3031
- child.editWindow = null; // ???????????
3094
+ //child.editWindow = null; // ???????????
30323095 }
30333096 objEditor.ctrlPanel.FlushUI();
30343097 //objEditor.jTree.clearSelection();
....@@ -3115,7 +3178,8 @@
31153178 sideView.object = group;
31163179 }
31173180
3118
-// fix "+" issue group.editWindow = this;
3181
+// fix "+" issue
3182
+ group.editWindow = this;
31193183
31203184 /*
31213185 currentLayout = radio.layout;
....@@ -3390,7 +3454,8 @@
33903454
33913455 int size = obj.MemorySize();
33923456
3393
- 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)");
33943459 }
33953460 }
33963461 catch (Exception e)
....@@ -3471,6 +3536,13 @@
34713536 void GenNormals(boolean crease)
34723537 {
34733538 group.GenNormalsS(crease);
3539
+
3540
+ refreshContents();
3541
+ }
3542
+
3543
+ void GenNormalsMESH()
3544
+ {
3545
+ group.GenNormalsMeshS();
34743546
34753547 refreshContents();
34763548 }
....@@ -4098,6 +4170,18 @@
40984170 refreshContents();
40994171 }
41004172
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
+
41014185 void SetTexRes(int tr)
41024186 {
41034187 group.selection.SetTexRes(tr);
....@@ -4273,7 +4357,6 @@
42734357 //case 702: // Event.LIST_DESELECT
42744358 group.deselectAll();
42754359 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774360 if (tps != null)
42784361 {
42794362 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4365,8 @@
42824365
42834366 //if (child.parent != null)
42844367 //child.parent.addSelectee(child);
4368
+ objEditor.SetMaterial(child);
42854369 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894370 }
42904371 }
42914372 // else
....@@ -4295,16 +4376,17 @@
42954376 // System.err.println("info : " + group.GetPath());
42964377 // }
42974378
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4379
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014380 CameraPane.flash = true;
43024381
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4382
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044383 // a camera
43054384 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4385
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4386
+ {
4387
+ CameraPane.camerachangeframe = 0; // don't refuse it
4388
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4389
+ }
43084390 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094391 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104392 }
....@@ -4317,6 +4399,26 @@
43174399
43184400 freezemodel = false;
43194401 }
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
+ }
43204422
43214423 void linkSomething(Object3D thing)
43224424 {
....@@ -4388,6 +4490,7 @@
43884490 {
43894491 if (group.selection.isEmpty())
43904492 return;
4493
+
43914494 Grafreed.clipboardIsTempGroup = false;
43924495 Composite tGroup = null;
43934496 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4501,7 @@
43984501
43994502 if (cut)
44004503 {
4504
+ Save();
44014505 //int indices[] = jList.getSelectedIndices();
44024506 //for (int i = indices.length - 1; i >= 0; i--)
44034507 //jList.remove(indices[i]);
....@@ -4487,8 +4591,10 @@
44874591 }
44884592
44894593 }
4594
+
44904595 if (Grafreed.clipboardIsTempGroup)
44914596 Grafreed.clipboard = tGroup;
4597
+
44924598 if (cut)
44934599 {
44944600 ResetModel();
....@@ -5113,6 +5219,9 @@
51135219 cButton clearpanelButton;
51145220 cButton unselectButton;
51155221
5222
+ cButton saveButton;
5223
+ cButton undoButton;
5224
+ cButton redoButton;
51165225 cButton oneStepButton;
51175226
51185227 cButton screenfitButton;
....@@ -5145,6 +5254,8 @@
51455254 private MenuItem lookFromItem;
51465255 private MenuItem switchItem;
51475256 private MenuItem cutItem;
5257
+ private MenuItem undoItem;
5258
+ private MenuItem redoItem;
51485259 private MenuItem duplicateItem;
51495260 private MenuItem cloneItem;
51505261 private MenuItem cloneSupportItem;
....@@ -5208,6 +5319,10 @@
52085319 private MenuItem showleavesItem;
52095320 private MenuItem markleavesItem;
52105321 private MenuItem unmarkleavesItem;
5322
+ private MenuItem rewindleavesItem;
5323
+ private MenuItem unrewindleavesItem;
5324
+ private MenuItem randomleavesItem;
5325
+ private MenuItem unrandomleavesItem;
52115326
52125327 private MenuItem flipVItem;
52135328 private MenuItem unflipVItem;