Normand Briere
2019-06-17 26b49d8e26625491f4a407a05e9bc9d72037f938
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)
....@@ -555,6 +556,18 @@
555556 oe.buttonGroup.add(dummyButton);
556557 */
557558 //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);
558571
559572 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
560573 liveCB.setToolTipText("Enable animation");
....@@ -858,6 +871,7 @@
858871 } else if(e.getSource() == liveCB)
859872 {
860873 cameraView.ToggleLive();
874
+ refreshContents(false);
861875 }
862876 else if(e.getSource() == supportCB)
863877 {
....@@ -1265,7 +1279,7 @@
12651279 memoryItem.addActionListener(this);
12661280 menu.add(analyzeItem = new MenuItem("Analyze"));
12671281 analyzeItem.addActionListener(this);
1268
- menu.add(dumpItem = new MenuItem("Dump"));
1282
+ menu.add(dumpItem = new MenuItem("Print"));
12691283 dumpItem.addActionListener(this);
12701284 // menu.add(pathItem = new MenuItem("From-to path"));
12711285 // pathItem.addActionListener(this);
....@@ -1956,6 +1970,18 @@
19561970 {
19571971 DumpObject();
19581972 } 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
19591985 if (source == oneStepButton)
19601986 {
19611987 Globals.ONESTEP = true;
....@@ -2517,7 +2543,7 @@
25172543 } else
25182544 if (source == genNormalsMESHItem)
25192545 {
2520
- GenNormals(true); // TODO
2546
+ GenNormalsMESH();
25212547 } else
25222548 if (source == genNormalsORGANItem)
25232549 {
....@@ -3041,7 +3067,7 @@
30413067 child.CloseUI();
30423068 listUI.remove(child);
30433069
3044
- child.editWindow = null; // ???????????
3070
+ //child.editWindow = null; // ???????????
30453071 }
30463072 objEditor.ctrlPanel.FlushUI();
30473073 //objEditor.jTree.clearSelection();
....@@ -3128,7 +3154,8 @@
31283154 sideView.object = group;
31293155 }
31303156
3131
-// fix "+" issue group.editWindow = this;
3157
+// fix "+" issue
3158
+ group.editWindow = this;
31323159
31333160 /*
31343161 currentLayout = radio.layout;
....@@ -3403,7 +3430,8 @@
34033430
34043431 int size = obj.MemorySize();
34053432
3406
- 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)");
34073435 }
34083436 }
34093437 catch (Exception e)
....@@ -3484,6 +3512,13 @@
34843512 void GenNormals(boolean crease)
34853513 {
34863514 group.GenNormalsS(crease);
3515
+
3516
+ refreshContents();
3517
+ }
3518
+
3519
+ void GenNormalsMESH()
3520
+ {
3521
+ group.GenNormalsMeshS();
34873522
34883523 refreshContents();
34893524 }
....@@ -4286,7 +4321,6 @@
42864321 //case 702: // Event.LIST_DESELECT
42874322 group.deselectAll();
42884323 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4289
- objEditor.ClearInfo(); // .GetMaterial());
42904324 if (tps != null)
42914325 {
42924326 for (int i=0; i < tps.length; i++)
....@@ -4295,10 +4329,8 @@
42954329
42964330 //if (child.parent != null)
42974331 //child.parent.addSelectee(child);
4332
+ objEditor.SetMaterial(child);
42984333 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024334 }
43034335 }
43044336 // else
....@@ -4308,17 +4340,13 @@
43084340 // System.err.println("info : " + group.GetPath());
43094341 // }
43104342
4311
- objEditor.SetText(); // jan 2014
4312
-
4313
- Object3D object = (Object3D) tps[0].getLastPathComponent();
4314
-
4315
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(object instanceof Camera))
4343
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43164344 CameraPane.flash = true;
43174345
4318
- if (tps != null && tps.length > 0 && object instanceof Camera)
4346
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43194347 // a camera
43204348 {
4321
- if (object != Globals.theRenderer.LightCamera())
4349
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
43224350 {
43234351 CameraPane.camerachangeframe = 0; // don't refuse it
43244352 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4335,6 +4363,26 @@
43354363
43364364 freezemodel = false;
43374365 }
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
+ }
43384386
43394387 void linkSomething(Object3D thing)
43404388 {
....@@ -4406,6 +4454,7 @@
44064454 {
44074455 if (group.selection.isEmpty())
44084456 return;
4457
+
44094458 Grafreed.clipboardIsTempGroup = false;
44104459 Composite tGroup = null;
44114460 if (group.selection.size() > 0) // 1)
....@@ -4416,6 +4465,7 @@
44164465
44174466 if (cut)
44184467 {
4468
+ Save();
44194469 //int indices[] = jList.getSelectedIndices();
44204470 //for (int i = indices.length - 1; i >= 0; i--)
44214471 //jList.remove(indices[i]);
....@@ -4505,8 +4555,10 @@
45054555 }
45064556
45074557 }
4558
+
45084559 if (Grafreed.clipboardIsTempGroup)
45094560 Grafreed.clipboard = tGroup;
4561
+
45104562 if (cut)
45114563 {
45124564 ResetModel();
....@@ -5131,6 +5183,9 @@
51315183 cButton clearpanelButton;
51325184 cButton unselectButton;
51335185
5186
+ cButton saveButton;
5187
+ cButton undoButton;
5188
+ cButton redoButton;
51345189 cButton oneStepButton;
51355190
51365191 cButton screenfitButton;