Normand Briere
2019-06-17 e36047725ce3217618d4e5807ac7c8769b9e3598
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)
....@@ -550,6 +556,18 @@
550556 oe.buttonGroup.add(dummyButton);
551557 */
552558 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559
+
560
+ oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
+ undoButton.setToolTipText("Undo changes");
562
+ undoButton.addActionListener(this);
563
+
564
+ oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
+ redoButton.setToolTipText("Redo changes");
566
+ redoButton.addActionListener(this);
567
+
568
+ oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
+ saveButton.setToolTipText("Save changes");
570
+ saveButton.addActionListener(this);
553571
554572 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
555573 liveCB.setToolTipText("Enable animation");
....@@ -853,6 +871,7 @@
853871 } else if(e.getSource() == liveCB)
854872 {
855873 cameraView.ToggleLive();
874
+ refreshContents(false);
856875 }
857876 else if(e.getSource() == supportCB)
858877 {
....@@ -1260,7 +1279,7 @@
12601279 memoryItem.addActionListener(this);
12611280 menu.add(analyzeItem = new MenuItem("Analyze"));
12621281 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1282
+ menu.add(dumpItem = new MenuItem("Print"));
12641283 dumpItem.addActionListener(this);
12651284 // menu.add(pathItem = new MenuItem("From-to path"));
12661285 // pathItem.addActionListener(this);
....@@ -1951,6 +1970,18 @@
19511970 {
19521971 DumpObject();
19531972 } else
1973
+ if (source == undoButton)
1974
+ {
1975
+ Undo();
1976
+ } else
1977
+ if (source == redoButton)
1978
+ {
1979
+ Redo();
1980
+ } else
1981
+ if (source == saveButton)
1982
+ {
1983
+ Save();
1984
+ } else
19541985 if (source == oneStepButton)
19551986 {
19561987 Globals.ONESTEP = true;
....@@ -2004,6 +2035,14 @@
20042035 if (source == cutItem || source == clearButton)
20052036 {
20062037 loadClipboard(true);
2038
+ } else
2039
+ if (source == undoItem)
2040
+ {
2041
+ Undo();
2042
+ } else
2043
+ if (source == redoItem)
2044
+ {
2045
+ Redo();
20072046 } else
20082047 if (source == duplicateItem)
20092048 {
....@@ -2504,7 +2543,7 @@
25042543 } else
25052544 if (source == genNormalsMESHItem)
25062545 {
2507
- GenNormals(true); // TODO
2546
+ GenNormalsMESH();
25082547 } else
25092548 if (source == genNormalsORGANItem)
25102549 {
....@@ -3028,7 +3067,7 @@
30283067 child.CloseUI();
30293068 listUI.remove(child);
30303069
3031
- child.editWindow = null; // ???????????
3070
+ //child.editWindow = null; // ???????????
30323071 }
30333072 objEditor.ctrlPanel.FlushUI();
30343073 //objEditor.jTree.clearSelection();
....@@ -3115,7 +3154,8 @@
31153154 sideView.object = group;
31163155 }
31173156
3118
-// fix "+" issue group.editWindow = this;
3157
+// fix "+" issue
3158
+ group.editWindow = this;
31193159
31203160 /*
31213161 currentLayout = radio.layout;
....@@ -3390,7 +3430,8 @@
33903430
33913431 int size = obj.MemorySize();
33923432
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3433
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3434
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943435 }
33953436 }
33963437 catch (Exception e)
....@@ -3471,6 +3512,13 @@
34713512 void GenNormals(boolean crease)
34723513 {
34733514 group.GenNormalsS(crease);
3515
+
3516
+ refreshContents();
3517
+ }
3518
+
3519
+ void GenNormalsMESH()
3520
+ {
3521
+ group.GenNormalsMeshS();
34743522
34753523 refreshContents();
34763524 }
....@@ -4273,7 +4321,6 @@
42734321 //case 702: // Event.LIST_DESELECT
42744322 group.deselectAll();
42754323 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774324 if (tps != null)
42784325 {
42794326 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4329,8 @@
42824329
42834330 //if (child.parent != null)
42844331 //child.parent.addSelectee(child);
4332
+ objEditor.SetMaterial(child);
42854333 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894334 }
42904335 }
42914336 // else
....@@ -4295,16 +4340,17 @@
42954340 // System.err.println("info : " + group.GetPath());
42964341 // }
42974342
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4343
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014344 CameraPane.flash = true;
43024345
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4346
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044347 // a camera
43054348 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4349
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4350
+ {
4351
+ CameraPane.camerachangeframe = 0; // don't refuse it
4352
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4353
+ }
43084354 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094355 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104356 }
....@@ -4317,6 +4363,26 @@
43174363
43184364 freezemodel = false;
43194365 }
4366
+
4367
+ void refreshContents(boolean cp)
4368
+ {
4369
+ if (!Globals.MOUSEDRAGGED)
4370
+ {
4371
+ objEditor.ClearInfo(); // .GetMaterial());
4372
+
4373
+ for (int i=0; i < group.selection.Size(); i++)
4374
+ {
4375
+ Object3D child = (Object3D) group.selection.get(i);
4376
+
4377
+ objEditor.AddInfo(child, this, true);
4378
+ System.err.println("info : " + child.GetPath());
4379
+ }
4380
+
4381
+ objEditor.SetText(); // jan 2014
4382
+ }
4383
+
4384
+ super.refreshContents(cp);
4385
+ }
43204386
43214387 void linkSomething(Object3D thing)
43224388 {
....@@ -4388,6 +4454,7 @@
43884454 {
43894455 if (group.selection.isEmpty())
43904456 return;
4457
+
43914458 Grafreed.clipboardIsTempGroup = false;
43924459 Composite tGroup = null;
43934460 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4465,7 @@
43984465
43994466 if (cut)
44004467 {
4468
+ Save();
44014469 //int indices[] = jList.getSelectedIndices();
44024470 //for (int i = indices.length - 1; i >= 0; i--)
44034471 //jList.remove(indices[i]);
....@@ -4487,8 +4555,10 @@
44874555 }
44884556
44894557 }
4558
+
44904559 if (Grafreed.clipboardIsTempGroup)
44914560 Grafreed.clipboard = tGroup;
4561
+
44924562 if (cut)
44934563 {
44944564 ResetModel();
....@@ -5113,6 +5183,9 @@
51135183 cButton clearpanelButton;
51145184 cButton unselectButton;
51155185
5186
+ cButton saveButton;
5187
+ cButton undoButton;
5188
+ cButton redoButton;
51165189 cButton oneStepButton;
51175190
51185191 cButton screenfitButton;
....@@ -5145,6 +5218,8 @@
51455218 private MenuItem lookFromItem;
51465219 private MenuItem switchItem;
51475220 private MenuItem cutItem;
5221
+ private MenuItem undoItem;
5222
+ private MenuItem redoItem;
51485223 private MenuItem duplicateItem;
51495224 private MenuItem cloneItem;
51505225 private MenuItem cloneSupportItem;