Normand Briere
2019-06-16 b33ef80d78f01a6a61f4248b1bb7deaade42d503
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -98,14 +98,14 @@
9898
9999 void CloneClipboard(boolean supports)
100100 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
101
+ assert(Grafreed.clipboard.parent == null);
102
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
103
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
104
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
105
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106106 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
109109 }
110110
111111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +119,7 @@
119119 // obj.support = null;
120120 if (!supports)
121121 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123123 obj.parent = parent;
124124 // obj.support = support;
125125 // clone.support = support; // aout 2013
....@@ -148,27 +148,18 @@
148148
149149 //JTextField nameField;
150150
151
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
152152 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
168153 Menu menu;
169154 oe.menuBar.add(menu = new Menu("Edit"));
170155 //editItem = menu.add(new MenuItem("Edit"));
171156 //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("-");
172163 duplicateItem = menu.add(new MenuItem("Duplicate"));
173164 duplicateItem.addActionListener(this);
174165 cloneItem = menu.add(new MenuItem("Clone"));
....@@ -206,14 +197,97 @@
206197 clearAllItem = menu.add(new MenuItem("Clear All"));
207198 clearAllItem.addActionListener(this);
208199 }
200
+
201
+ menuBar.add(cameraMenu = new Menu("View"));
202
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
203
+ //zBufferItem.addActionListener(this);
204
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205
+ //normalLensItem.addActionListener(this);
206
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
+ revertCameraItem.addActionListener(this);
208
+
209
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
+ toggleFullScreenItem.addItemListener(this);
211
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
+ cameraMenu.add("-");
213
+
214
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
+ toggleTextureItem.addItemListener(this);
216
+ toggleTextureItem.setState(CameraPane.textureon);
217
+
218
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
+ toggleSwitchItem.addItemListener(this);
220
+ toggleSwitchItem.setState(CameraPane.SWITCH);
221
+
222
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ toggleHandleItem.addItemListener(this);
224
+ toggleHandleItem.setState(CameraPane.HANDLES);
225
+
226
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
227
+ togglePaintItem.addItemListener(this);
228
+ togglePaintItem.setState(CameraPane.PAINTMODE);
229
+
230
+ if (Globals.ADVANCED)
231
+ {
232
+ cameraMenu.add("-");
233
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
234
+ toggleLiveItem.addItemListener(this);
235
+ toggleLiveItem.setState(Globals.isLIVE());
209236
237
+ cameraMenu.add(stepItem = new MenuItem("Step"));
238
+ stepItem.addActionListener(this);
239
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
240
+ // toggleDLItem.addItemListener(this);
241
+ // toggleDLItem.setState(false);
242
+
243
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
244
+ toggleRenderItem.addItemListener(this);
245
+ toggleRenderItem.setState(!CameraPane.frozen);
246
+
247
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248
+ toggleDebugItem.addItemListener(this);
249
+ toggleDebugItem.setState(CameraPane.DEBUG);
250
+
251
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252
+ toggleFrustumItem.addItemListener(this);
253
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
254
+
255
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
256
+ toggleFootContactItem.addItemListener(this);
257
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
258
+
259
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
260
+ toggleTimelineItem.addItemListener(this);
261
+ }
262
+
263
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
264
+// toggleRootItem.addItemListener(this);
265
+// toggleRootItem.setState(false);
266
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
267
+// animationItem.addItemListener(this);
268
+// animationItem.setState(CameraPane.ANIMATION);
269
+ cameraMenu.add("-");
270
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
271
+ editCameraItem.addActionListener(this);
272
+
273
+ if (Globals.ADVANCED)
274
+ {
275
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
+ //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
278
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279
+ oe.cameraMenu.add("-");
280
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
281
+ openWindowItem.addActionListener(this);
282
+ editLeafItem.addActionListener(this);
283
+ lookAtItem.addActionListener(this);
284
+ //lookFromItem.addActinoListener(this);
285
+ //switchItem.addActionListener(this);
286
+ }
287
+
210288 oe.menuBar.add(menu = new Menu("Setting"));
211289 if (Globals.ADVANCED)
212290 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217291 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218292 revertMeshItem.addActionListener(this);
219293 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -318,8 +392,12 @@
318392 resetTransformItem.addActionListener(this);
319393 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320394 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
395
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
396
+ resetCentroidXZItem.addActionListener(this);
397
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
398
+ transformGeometryItem.addActionListener(this);
399
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
400
+ transformChildrenItem.addActionListener(this);
323401
324402 oe.menuBar.add(menu = new Menu("Geometry"));
325403 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -368,6 +446,10 @@
368446 oe.menuBar.add(menu = new Menu("Attributes"));
369447 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370448 clearMaterialsItem.addActionListener(this);
449
+ resetAllItem = menu.add(new MenuItem("Reset All"));
450
+ resetAllItem.addActionListener(this);
451
+ stepAllItem = menu.add(new MenuItem("Step All"));
452
+ stepAllItem.addActionListener(this);
371453 menu.add("-");
372454 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373455 liveleavesItem.addActionListener(this);
....@@ -422,35 +504,23 @@
422504 sortbysizeItem.addActionListener(this);
423505 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424506 sortbynameItem.addActionListener(this);
507
+ menu.add("-");
508
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
509
+ shareGeometriesItem.addActionListener(this);
510
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
511
+ mergeGeometriesItem.addActionListener(this);
425512 if (Globals.ADVANCED)
426513 {
427
- menu.add("-");
514
+ // Pretty much the same as duplicate and clone.
428515 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429516 extractGeometriesItem.addActionListener(this);
430517 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431518 cloneGeometriesItem.addActionListener(this);
432
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
433
- shareGeometriesItem.addActionListener(this);
434
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
435
- mergeGeometriesItem.addActionListener(this);
436519 }
437520
438521 oe.menuBar.add(menu = new Menu("Insert"));
439522 buildCreateMenu(menu);
440523
441
- oe.menuBar.add(menu = new Menu("Include"));
442
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
443
- importOBJItem.addActionListener(this);
444
- menu.add("-");
445
- import3DSItem = menu.add(new MenuItem("3DS file..."));
446
- import3DSItem.addActionListener(this);
447
- menu.add("-");
448
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
449
- importVRMLX3DItem.addActionListener(this);
450
- menu.add("-");
451
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
452
- importGFDItem.addActionListener(this);
453
-
454524 oe.menuBar.add(menu = new Menu("Tools"));
455525 buildToolsMenu(menu);
456526 }
....@@ -487,11 +557,23 @@
487557 */
488558 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
489559
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);
571
+
490572 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
- liveCB.setToolTipText("Enabled animation");
573
+ liveCB.setToolTipText("Enable animation");
492574 liveCB.addItemListener(this);
493575
494
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
576
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495577 oneStepButton.setToolTipText("Animate one step forward");
496578 oneStepButton.addActionListener(this);
497579
....@@ -503,7 +585,7 @@
503585 trackCB.setToolTipText("Enable tracking");
504586 trackCB.addItemListener(this);
505587
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
588
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
507589 screenfitButton.setToolTipText("Screen fit");
508590 screenfitButton.addActionListener(this);
509591
....@@ -512,39 +594,39 @@
512594
513595 if (Globals.ADVANCED)
514596 {
515
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
597
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516598 snapobjectButton.addActionListener(this);
517599 snapobjectButton.setToolTipText("Snap Object");
518600 }
519601
520
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
602
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521603 flashSelectionButton.setToolTipText("Show selection");
522604 flashSelectionButton.addActionListener(this);
523605
524606 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525607
526
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
608
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527609 twoButton.setToolTipText("Show center view only");
528610 twoButton.addActionListener(this);
529
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
611
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530612 fourButton.addActionListener(this);
531613 fourButton.setToolTipText("Show left panel only");
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
614
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533615 sixButton.setToolTipText("2-column layout left");
534616 sixButton.addActionListener(this);
535
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
617
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536618 threeButton.setToolTipText("2-column layout right");
537619 threeButton.addActionListener(this);
538
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
620
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
539621 sevenButton.setToolTipText("3-column layout");
540622 sevenButton.addActionListener(this);
541623 //
542624
543
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
625
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544626 rootButton.setToolTipText("Edit selection in new tab");
545627 rootButton.addActionListener(this);
546628
547
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
629
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
548630 closeButton.setToolTipText("Close tab");
549631 closeButton.addActionListener(this);
550632 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -552,11 +634,11 @@
552634
553635 cGridBag commandsPanel = new cGridBag();
554636
555
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
637
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
556638 editButton.setToolTipText("Edit selection");
557639 editButton.addActionListener(this);
558640
559
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
641
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
560642 uneditButton.setToolTipText("Unedit selection");
561643 uneditButton.addActionListener(this);
562644
....@@ -564,11 +646,11 @@
564646 allParamsButton.setToolTipText("Edit all params");
565647 allParamsButton.addActionListener(this);
566648
567
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
649
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
568650 clearPanelButton.setToolTipText("Clear edit panel");
569651 clearPanelButton.addActionListener(this);
570652
571
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
653
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
572654 unselectButton.setToolTipText("Unselect");
573655 unselectButton.addActionListener(this);
574656
....@@ -651,7 +733,7 @@
651733 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
652734 zoomBoxCB.addItemListener(this);
653735
654
- if (Globals.ADVANCED)
736
+ if (true) // Globals.ADVANCED)
655737 {
656738 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657739 supportCB.setToolTipText("Enable rigging");
....@@ -724,6 +806,7 @@
724806 buttonGroup.add(radioButton);
725807 radioButton.doClick();
726808 }
809
+
727810 void SetupViews(ObjEditor oe)
728811 {
729812 oe.SetupViews();
....@@ -940,7 +1023,9 @@
9401023 // objEditor.DropFile((java.io.File[]) object, true);
9411024 // return;
9421025 // }
943
- if (string.charAt(0) == '/')
1026
+
1027
+ // File path for Mac and Windows
1028
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9441029 {
9451030 // file(s)
9461031 String[] names = string.split("\n");
....@@ -967,7 +1052,7 @@
9671052
9681053 flashIt = false;
9691054 CameraPane pane = (CameraPane) target;
970
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1055
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9711056 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9721057
9731058 if (group.selection.size() == 1)
....@@ -1540,9 +1625,9 @@
15401625
15411626 void Overwrite(int mask)
15421627 {
1543
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1628
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15441629 {
1545
- Object3D content = GrafreeD.clipboard.get(0);
1630
+ Object3D content = Grafreed.clipboard.get(0);
15461631
15471632 if (content instanceof cGroup && ((cGroup)content).transientlink )
15481633 content = ((cGroup)content).get(0);
....@@ -1847,31 +1932,6 @@
18471932 csg.addChild(child);
18481933 child.addChild(csg);
18491934 } else
1850
-
1851
- if (source == importGFDItem)
1852
- {
1853
- ImportGFD();
1854
- } else
1855
- if (source == importVRMLX3DItem)
1856
- {
1857
- ImportVRMLX3D();
1858
- } else
1859
- if (source == import3DSItem)
1860
- {
1861
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1862
- } else
1863
- if (source == importOBJItem)
1864
- {
1865
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1866
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1867
- browser.setVisible(true);
1868
- String filename = browser.getFile();
1869
- if (filename != null && filename.length() > 0)
1870
- {
1871
- String fullname = browser.getDirectory() + filename;
1872
- makeSomething(ReadOBJ(fullname), true);
1873
- }
1874
- } else
18751935 if (source == computeAOItem)
18761936 {
18771937 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1890,7 +1950,7 @@
18901950 if (source == invariantsItem)
18911951 {
18921952 System.out.println("Invariants:");
1893
- GrafreeD.grafreeD.universe.invariants();
1953
+ Grafreed.grafreeD.universe.invariants();
18941954 } else
18951955 if (source == memoryItem)
18961956 {
....@@ -1908,6 +1968,18 @@
19081968 if (source == dumpItem)
19091969 {
19101970 DumpObject();
1971
+ } else
1972
+ if (source == undoButton)
1973
+ {
1974
+ Undo();
1975
+ } else
1976
+ if (source == redoButton)
1977
+ {
1978
+ Redo();
1979
+ } else
1980
+ if (source == saveButton)
1981
+ {
1982
+ Save();
19111983 } else
19121984 if (source == oneStepButton)
19131985 {
....@@ -1963,12 +2035,20 @@
19632035 {
19642036 loadClipboard(true);
19652037 } else
2038
+ if (source == undoItem)
2039
+ {
2040
+ Undo();
2041
+ } else
2042
+ if (source == redoItem)
2043
+ {
2044
+ Redo();
2045
+ } else
19662046 if (source == duplicateItem)
19672047 {
1968
- Object3D keep = GrafreeD.clipboard;
2048
+ Object3D keep = Grafreed.clipboard;
19692049 loadClipboard(false);
19702050 paste(false);
1971
- GrafreeD.clipboard = keep;
2051
+ Grafreed.clipboard = keep;
19722052 } else
19732053 if (source == cloneItem)
19742054 {
....@@ -2188,9 +2268,9 @@
21882268 // group.selection.get(0).setMasterThis(content); // should be identity
21892269 // refreshContents();
21902270 // }
2191
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2271
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21922272 {
2193
- Object3D content = GrafreeD.clipboard.get(0);
2273
+ Object3D content = Grafreed.clipboard.get(0);
21942274
21952275 if (content instanceof cGroup && ((cGroup)content).transientlink )
21962276 content = ((cGroup)content).get(0);
....@@ -2240,9 +2320,9 @@
22402320 } else
22412321 if (source == setMasterItem)
22422322 {
2243
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2323
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22442324 {
2245
- Object3D content = GrafreeD.clipboard.get(0);
2325
+ Object3D content = Grafreed.clipboard.get(0);
22462326
22472327 if (content instanceof cGroup && ((cGroup)content).transientlink )
22482328 content = ((cGroup)content).get(0);
....@@ -2255,9 +2335,9 @@
22552335 {
22562336 if (group.selection.size() == 1)
22572337 {
2258
- if (GrafreeD.clipboard.size() == 1)
2338
+ if (Grafreed.clipboard.size() == 1)
22592339 {
2260
- Object3D content = GrafreeD.clipboard.get(0);
2340
+ Object3D content = Grafreed.clipboard.get(0);
22612341
22622342 if (content instanceof cGroup && ((cGroup)content).transientlink )
22632343 content = ((cGroup)content).get(0);
....@@ -2274,7 +2354,7 @@
22742354 {
22752355 RevertMeshes();
22762356 } else
2277
- if (source == resetMeshItem)
2357
+ if (source == resetAllItem)
22782358 {
22792359 ResetAll();
22802360 } else
....@@ -2462,7 +2542,7 @@
24622542 } else
24632543 if (source == genNormalsMESHItem)
24642544 {
2465
- GenNormals(true); // TODO
2545
+ GenNormalsMESH();
24662546 } else
24672547 if (source == genNormalsORGANItem)
24682548 {
....@@ -2612,9 +2692,13 @@
26122692 {
26132693 SmoothMesh();
26142694 } else
2615
- if (source == transformgeometryItem)
2695
+ if (source == transformGeometryItem)
26162696 {
26172697 TransformGeometry();
2698
+ } else
2699
+ if (source == transformChildrenItem)
2700
+ {
2701
+ TransformChildren();
26182702 } else
26192703 if (source == resetTransformItem)
26202704 {
....@@ -2622,7 +2706,11 @@
26222706 } else
26232707 if (source == resetCentroidItem)
26242708 {
2625
- ResetCentroid();
2709
+ ResetCentroid(true);
2710
+ } else
2711
+ if (source == resetCentroidXZItem)
2712
+ {
2713
+ ResetCentroid(false);
26262714 } else
26272715 if (source == resetParentItem)
26282716 {
....@@ -2978,7 +3066,7 @@
29783066 child.CloseUI();
29793067 listUI.remove(child);
29803068
2981
- child.editWindow = null; // ???????????
3069
+ //child.editWindow = null; // ???????????
29823070 }
29833071 objEditor.ctrlPanel.FlushUI();
29843072 //objEditor.jTree.clearSelection();
....@@ -3064,7 +3152,10 @@
30643152 frontView.object = group;
30653153 sideView.object = group;
30663154 }
3155
+
3156
+// fix "+" issue
30673157 group.editWindow = this;
3158
+
30683159 /*
30693160 currentLayout = radio.layout;
30703161 if (currentLayout == null)
....@@ -3077,7 +3168,20 @@
30773168 //group.attributes = -1;
30783169 ResetModel();
30793170 refreshContents(true);
3080
- }
3171
+ } else if (event.getSource() == editCameraItem)
3172
+ {
3173
+ cameraView.ProtectCamera();
3174
+ cameraView.repaint();
3175
+ return;
3176
+ } else if (event.getSource() == revertCameraItem)
3177
+ {
3178
+ cameraView.RevertCamera();
3179
+ cameraView.repaint();
3180
+ return;
3181
+ // } else if (event.getSource() == textureButton)
3182
+ // {
3183
+ // return; // true;
3184
+ }
30813185 else
30823186 {
30833187 //return super.action(event, arg);
....@@ -3138,6 +3242,28 @@
31383242 refreshContents();
31393243 }
31403244
3245
+ void TransformChildren()
3246
+ {
3247
+ Object3D obj;
3248
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3249
+ {
3250
+ obj = (Object3D)e.nextElement();
3251
+ obj.KeepTextureMatrices();
3252
+ obj.TransformChildren();
3253
+ obj.RestoreTextureMatrices();
3254
+
3255
+// if (obj.parent == null)
3256
+// {
3257
+// System.out.println("NULL PARENT!");
3258
+// new Exception().printStackTrace();
3259
+// }
3260
+// else
3261
+// TouchTransform(obj);
3262
+// //obj.parent.Touch();
3263
+ }
3264
+
3265
+ refreshContents();
3266
+ }
31413267
31423268 void ResetTransform()
31433269 {
....@@ -3250,7 +3376,7 @@
32503376 refreshContents();
32513377 }
32523378
3253
- void ResetCentroid()
3379
+ void ResetCentroid(boolean full)
32543380 {
32553381 Object3D obj;
32563382 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3265,12 +3391,16 @@
32653391 LA.matIdentity(Object3D.mat);
32663392 obj.getBounds(minima, maxima, false);
32673393 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3268
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3394
+ if (full)
3395
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32693396 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32703397 obj.TransformMesh(Object3D.mat);
3398
+
32713399 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3272
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3400
+ if (full)
3401
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32733402 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3403
+
32743404 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32753405 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32763406 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3299,7 +3429,8 @@
32993429
33003430 int size = obj.MemorySize();
33013431
3302
- System.err.println((size/1024) + " KB is the size of " + obj);
3432
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3433
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33033434 }
33043435 }
33053436 catch (Exception e)
....@@ -3336,9 +3467,9 @@
33363467 obj = (Object3D)e.nextElement();
33373468
33383469 System.out.println("Object is: " + obj);
3339
- GrafreeD.AnalyzeObject(obj);
3470
+ Grafreed.AnalyzeObject(obj);
33403471 System.out.println("Boundary rep: " + obj.bRep);
3341
- GrafreeD.AnalyzeObject(obj.bRep);
3472
+ Grafreed.AnalyzeObject(obj.bRep);
33423473
33433474 // System.err.println((size/1024) + " KB is the size of " + obj);
33443475 }
....@@ -3380,6 +3511,13 @@
33803511 void GenNormals(boolean crease)
33813512 {
33823513 group.GenNormalsS(crease);
3514
+
3515
+ refreshContents();
3516
+ }
3517
+
3518
+ void GenNormalsMESH()
3519
+ {
3520
+ group.GenNormalsMeshS();
33833521
33843522 refreshContents();
33853523 }
....@@ -3552,8 +3690,8 @@
35523690
35533691 void ParseVertices()
35543692 {
3555
- boolean epsequal = GrafreeD.epsequal;
3556
- GrafreeD.epsequal = true;
3693
+ boolean epsequal = Grafreed.epsequal;
3694
+ Grafreed.epsequal = true;
35573695
35583696 for (int i=0; i<group.selection.size(); i++)
35593697 {
....@@ -3578,7 +3716,7 @@
35783716 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35793717 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35803718
3581
- g.add(GrafreeD.clipboard);
3719
+ g.add(Grafreed.clipboard);
35823720
35833721 buffer.add(g);
35843722 }
....@@ -3593,7 +3731,7 @@
35933731 makeSomething(buffer, i==group.selection.size()-1);
35943732 }
35953733
3596
- GrafreeD.epsequal = epsequal;
3734
+ Grafreed.epsequal = epsequal;
35973735
35983736 refreshContents();
35993737 }
....@@ -3611,7 +3749,16 @@
36113749 String pigment = Object3D.GetPigment(tex);
36123750 //String bump = Object3D.GetBump(tex);
36133751
3614
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3752
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3753
+
3754
+ try
3755
+ {
3756
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3757
+ }
3758
+ catch (Exception e)
3759
+ {
3760
+ System.err.println("FAIL: " + node);
3761
+ }
36153762
36163763 double s = v.s;
36173764
....@@ -3743,7 +3890,7 @@
37433890 return;
37443891
37453892 Object3D poses = group.selection.get(0);
3746
- Object3D ref = GrafreeD.clipboard.get(0);
3893
+ Object3D ref = Grafreed.clipboard.get(0);
37473894
37483895 Object3D newgroup = new Object3D("Po:" + poses.name);
37493896
....@@ -3937,9 +4084,9 @@
39374084
39384085 void ClipMesh()
39394086 {
3940
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4087
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39414088 {
3942
- Object3D content = GrafreeD.clipboard.get(0);
4089
+ Object3D content = Grafreed.clipboard.get(0);
39434090
39444091 if (content instanceof cGroup && ((cGroup)content).transientlink )
39454092 content = ((cGroup)content).get(0);
....@@ -3948,7 +4095,7 @@
39484095 // {
39494096 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39504097 // }
3951
- group.selection.ClipMesh(GrafreeD.clipboard);
4098
+ group.selection.ClipMesh(Grafreed.clipboard);
39524099 }
39534100 // group.selection.ClipMesh(GrafreeD.clipboard);
39544101 System.out.println("DONE.");
....@@ -4083,7 +4230,7 @@
40834230 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40844231
40854232 Object3D elem = (Object3D)group.selection.elementAt(i);
4086
- if(elem != group)
4233
+ if(elem != group || !newWindow)
40874234 {
40884235 // if (!(elem instanceof Composite))
40894236 // newWindow = false;
....@@ -4197,14 +4344,17 @@
41974344
41984345 objEditor.SetText(); // jan 2014
41994346
4200
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4347
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42014348 CameraPane.flash = true;
42024349
4203
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4350
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42044351 // a camera
42054352 {
4206
- CameraPane.camerachangeframe = 0; // don't refuse it
4207
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4353
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4354
+ {
4355
+ CameraPane.camerachangeframe = 0; // don't refuse it
4356
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4357
+ }
42084358 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42094359 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42104360 }
....@@ -4288,16 +4438,18 @@
42884438 {
42894439 if (group.selection.isEmpty())
42904440 return;
4291
- GrafreeD.clipboardIsTempGroup = false;
4441
+
4442
+ Grafreed.clipboardIsTempGroup = false;
42924443 Composite tGroup = null;
42934444 if (group.selection.size() > 0) // 1)
42944445 {
42954446 tGroup = new cGroup();
4296
- GrafreeD.clipboardIsTempGroup = true;
4447
+ Grafreed.clipboardIsTempGroup = true;
42974448 }
42984449
42994450 if (cut)
43004451 {
4452
+ Save();
43014453 //int indices[] = jList.getSelectedIndices();
43024454 //for (int i = indices.length - 1; i >= 0; i--)
43034455 //jList.remove(indices[i]);
....@@ -4333,16 +4485,16 @@
43334485 //System.out.println("cut " + child);
43344486 //System.out.println("parent = " + child.parent);
43354487 // tmp.addChild(child);
4336
- if (GrafreeD.clipboardIsTempGroup)
4488
+ if (Grafreed.clipboardIsTempGroup)
43374489 tGroup.add/*Child*/(tmp);
43384490 else
4339
- GrafreeD.clipboard = tmp;
4491
+ Grafreed.clipboard = tmp;
43404492 }
43414493 else
4342
- if (GrafreeD.clipboardIsTempGroup)
4494
+ if (Grafreed.clipboardIsTempGroup)
43434495 tGroup.add/*Child*/(child);
43444496 else
4345
- GrafreeD.clipboard = child;
4497
+ Grafreed.clipboard = child;
43464498 }
43474499
43484500 //ResetModel();
....@@ -4374,21 +4526,23 @@
43744526 //System.out.println("cut " + elem);
43754527 //System.out.println("parent = " + elem.parent);
43764528 // tmp.addChild(elem);
4377
- if (GrafreeD.clipboardIsTempGroup)
4529
+ if (Grafreed.clipboardIsTempGroup)
43784530 tGroup.add/*Child*/(tmp);
43794531 else
4380
- GrafreeD.clipboard = tmp;
4532
+ Grafreed.clipboard = tmp;
43814533 }
43824534 else
4383
- if (GrafreeD.clipboardIsTempGroup)
4535
+ if (Grafreed.clipboardIsTempGroup)
43844536 tGroup.add/*Child*/(child);
43854537 else
4386
- GrafreeD.clipboard = child;
4538
+ Grafreed.clipboard = child;
43874539 }
43884540
43894541 }
4390
- if (GrafreeD.clipboardIsTempGroup)
4391
- GrafreeD.clipboard = tGroup;
4542
+
4543
+ if (Grafreed.clipboardIsTempGroup)
4544
+ Grafreed.clipboard = tGroup;
4545
+
43924546 if (cut)
43934547 {
43944548 ResetModel();
....@@ -4402,7 +4556,7 @@
44024556 // return;
44034557 boolean first = true;
44044558
4405
- if (GrafreeD.clipboardIsTempGroup)
4559
+ if (Grafreed.clipboardIsTempGroup)
44064560 {
44074561 Composite temp;
44084562
....@@ -4413,7 +4567,7 @@
44134567 temp = (Composite)Applet3D.clipboard.deepCopy();
44144568 */
44154569 Object3D elem;
4416
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4570
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44174571 {
44184572 Object3D child = (Object3D)e.nextElement();
44194573
....@@ -4447,14 +4601,14 @@
44474601 //Object3D cb = Applet3D.clipboard;
44484602 //temp.addChild(cb);
44494603 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4450
- assert(GrafreeD.clipboard.parent == null);
4451
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4452
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4453
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4454
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4604
+ assert(Grafreed.clipboard.parent == null);
4605
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4606
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4607
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4608
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44554609 else
4456
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4457
- GrafreeD.clipboard.get(0).parent = keepparent;
4610
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4611
+ Grafreed.clipboard.get(0).parent = keepparent;
44584612 }
44594613
44604614 ResetModel();
....@@ -4503,9 +4657,9 @@
45034657 {
45044658 boolean first = true;
45054659
4506
- if (GrafreeD.clipboardIsTempGroup)
4660
+ if (Grafreed.clipboardIsTempGroup)
45074661 {
4508
- Composite temp = (Composite)GrafreeD.clipboard;
4662
+ Composite temp = (Composite)Grafreed.clipboard;
45094663 Object3D copy;
45104664 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45114665 {
....@@ -4515,7 +4669,7 @@
45154669 }
45164670 } else
45174671 {
4518
- linkSomething(GrafreeD.clipboard); //.get(0));
4672
+ linkSomething(Grafreed.clipboard); //.get(0));
45194673 }
45204674 }
45214675 }
....@@ -4920,21 +5074,6 @@
49205074 }
49215075 */
49225076
4923
- void ImportGFD()
4924
- {
4925
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4926
- browser.show();
4927
- String filename = browser.getFile();
4928
- if (filename != null && filename.length() > 0)
4929
- {
4930
- String fullname = browser.getDirectory() + filename;
4931
-
4932
- //Object3D readobj =
4933
- objEditor.ReadGFD(fullname, objEditor);
4934
- //makeSomething(readobj);
4935
- }
4936
- }
4937
-
49385077 /*
49395078 public void Callback(Object obj)
49405079 {
....@@ -4958,26 +5097,9 @@
49585097 }
49595098 */
49605099
4961
- void ImportVRMLX3D()
4962
- {
4963
- if (GrafreeD.standAlone)
4964
- {
4965
- /**/
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
- LoadVRMLX3D(fullname);
4973
- }
4974
- /**/
4975
- }
4976
- }
4977
-
49785100 String GetFile(String dialogName)
49795101 {
4980
- if (GrafreeD.standAlone)
5102
+ if (Grafreed.standAlone)
49815103 {
49825104 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49835105 browser.show();
....@@ -5045,6 +5167,9 @@
50455167 cButton clearpanelButton;
50465168 cButton unselectButton;
50475169
5170
+ cButton saveButton;
5171
+ cButton undoButton;
5172
+ cButton redoButton;
50485173 cButton oneStepButton;
50495174
50505175 cButton screenfitButton;
....@@ -5077,6 +5202,8 @@
50775202 private MenuItem lookFromItem;
50785203 private MenuItem switchItem;
50795204 private MenuItem cutItem;
5205
+ private MenuItem undoItem;
5206
+ private MenuItem redoItem;
50805207 private MenuItem duplicateItem;
50815208 private MenuItem cloneItem;
50825209 private MenuItem cloneSupportItem;
....@@ -5090,7 +5217,7 @@
50905217 private MenuItem linkverticesItem;
50915218 private MenuItem relinkverticesItem;
50925219 private MenuItem setMasterItem;
5093
- private MenuItem resetMeshItem;
5220
+ private MenuItem resetAllItem;
50945221 private MenuItem stepAllItem;
50955222 private MenuItem revertMeshItem;
50965223 private MenuItem poseMeshItem;
....@@ -5151,8 +5278,10 @@
51515278 private MenuItem panoTexturesItem;
51525279
51535280 private MenuItem resetCentroidItem;
5154
- private MenuItem transformgeometryItem;
5281
+ private MenuItem resetCentroidXZItem;
51555282 private MenuItem resetTransformItem;
5283
+ private MenuItem transformGeometryItem;
5284
+ private MenuItem transformChildrenItem;
51565285 private MenuItem hideItem;
51575286 private MenuItem grabItem;
51585287 private MenuItem backItem;
....@@ -5221,11 +5350,6 @@
52215350 private MenuItem doubleItem;
52225351 private MenuItem tripleItem;
52235352
5224
- private MenuItem importGFDItem;
5225
- private MenuItem importVRMLX3DItem;
5226
- private MenuItem import3DSItem;
5227
- private MenuItem importOBJItem;
5228
-
52295353 private MenuItem computeAOItem;
52305354 private MenuItem recompileItem;
52315355 private MenuItem editScriptItem;
....@@ -5235,4 +5359,8 @@
52355359 private MenuItem analyzeItem;
52365360 private MenuItem dumpItem;
52375361 //boolean freezemodel = false;
5362
+
5363
+ Menu cameraMenu;
5364
+ MenuItem editCameraItem;
5365
+ MenuItem revertCameraItem;
52385366 }