Normand Briere
2019-06-16 7b6b5ba546450e71ecc812356952b594acc5add5
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 {
....@@ -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++)
....@@ -4296,9 +4330,6 @@
42964330 //if (child.parent != null)
42974331 //child.parent.addSelectee(child);
42984332 group.addSelectee(child);
4299
- objEditor.SetMaterial(child); // .GetMaterial());
4300
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4301
- System.err.println("info : " + child.GetPath());
43024333 }
43034334 }
43044335 // else
....@@ -4308,8 +4339,6 @@
43084339 // System.err.println("info : " + group.GetPath());
43094340 // }
43104341
4311
- objEditor.SetText(); // jan 2014
4312
-
43134342 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43144343 CameraPane.flash = true;
43154344
....@@ -4333,6 +4362,29 @@
43334362
43344363 freezemodel = false;
43354364 }
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
+ }
43364388
43374389 void linkSomething(Object3D thing)
43384390 {
....@@ -4404,6 +4456,7 @@
44044456 {
44054457 if (group.selection.isEmpty())
44064458 return;
4459
+
44074460 Grafreed.clipboardIsTempGroup = false;
44084461 Composite tGroup = null;
44094462 if (group.selection.size() > 0) // 1)
....@@ -4414,6 +4467,7 @@
44144467
44154468 if (cut)
44164469 {
4470
+ Save();
44174471 //int indices[] = jList.getSelectedIndices();
44184472 //for (int i = indices.length - 1; i >= 0; i--)
44194473 //jList.remove(indices[i]);
....@@ -4503,8 +4557,10 @@
45034557 }
45044558
45054559 }
4560
+
45064561 if (Grafreed.clipboardIsTempGroup)
45074562 Grafreed.clipboard = tGroup;
4563
+
45084564 if (cut)
45094565 {
45104566 ResetModel();
....@@ -5129,6 +5185,9 @@
51295185 cButton clearpanelButton;
51305186 cButton unselectButton;
51315187
5188
+ cButton saveButton;
5189
+ cButton undoButton;
5190
+ cButton redoButton;
51325191 cButton oneStepButton;
51335192
51345193 cButton screenfitButton;