Normand Briere
2019-06-16 7b6b5ba546450e71ecc812356952b594acc5add5
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++)
....@@ -4283,9 +4330,6 @@
42834330 //if (child.parent != null)
42844331 //child.parent.addSelectee(child);
42854332 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894333 }
42904334 }
42914335 // else
....@@ -4295,16 +4339,17 @@
42954339 // System.err.println("info : " + group.GetPath());
42964340 // }
42974341
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4342
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014343 CameraPane.flash = true;
43024344
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4345
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044346 // a camera
43054347 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4348
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4349
+ {
4350
+ CameraPane.camerachangeframe = 0; // don't refuse it
4351
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4352
+ }
43084353 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094354 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104355 }
....@@ -4317,6 +4362,29 @@
43174362
43184363 freezemodel = false;
43194364 }
4365
+
4366
+ void refreshContents(boolean cp)
4367
+ {
4368
+ if (!Globals.MOUSEDRAGGED)
4369
+ {
4370
+ objEditor.ClearInfo(); // .GetMaterial());
4371
+
4372
+ for (int i=0; i < group.selection.size(); i++)
4373
+ {
4374
+ Object3D child = (Object3D) group.selection.reserve(i);
4375
+
4376
+ objEditor.SetMaterial(child);
4377
+ objEditor.AddInfo(child, this, true);
4378
+ System.err.println("info : " + child.GetPath());
4379
+
4380
+ group.selection.release(i);
4381
+ }
4382
+
4383
+ objEditor.SetText(); // jan 2014
4384
+ }
4385
+
4386
+ super.refreshContents(cp);
4387
+ }
43204388
43214389 void linkSomething(Object3D thing)
43224390 {
....@@ -4388,6 +4456,7 @@
43884456 {
43894457 if (group.selection.isEmpty())
43904458 return;
4459
+
43914460 Grafreed.clipboardIsTempGroup = false;
43924461 Composite tGroup = null;
43934462 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4467,7 @@
43984467
43994468 if (cut)
44004469 {
4470
+ Save();
44014471 //int indices[] = jList.getSelectedIndices();
44024472 //for (int i = indices.length - 1; i >= 0; i--)
44034473 //jList.remove(indices[i]);
....@@ -4487,8 +4557,10 @@
44874557 }
44884558
44894559 }
4560
+
44904561 if (Grafreed.clipboardIsTempGroup)
44914562 Grafreed.clipboard = tGroup;
4563
+
44924564 if (cut)
44934565 {
44944566 ResetModel();
....@@ -5113,6 +5185,9 @@
51135185 cButton clearpanelButton;
51145186 cButton unselectButton;
51155187
5188
+ cButton saveButton;
5189
+ cButton undoButton;
5190
+ cButton redoButton;
51165191 cButton oneStepButton;
51175192
51185193 cButton screenfitButton;
....@@ -5145,6 +5220,8 @@
51455220 private MenuItem lookFromItem;
51465221 private MenuItem switchItem;
51475222 private MenuItem cutItem;
5223
+ private MenuItem undoItem;
5224
+ private MenuItem redoItem;
51485225 private MenuItem duplicateItem;
51495226 private MenuItem cloneItem;
51505227 private MenuItem cloneSupportItem;