Normand Briere
2019-06-09 c5b599b48b333b34e554b464aefbca0b9bc66275
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,23 +148,8 @@
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"));
....@@ -206,14 +191,97 @@
206191 clearAllItem = menu.add(new MenuItem("Clear All"));
207192 clearAllItem.addActionListener(this);
208193 }
194
+
195
+ menuBar.add(cameraMenu = new Menu("View"));
196
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
197
+ //zBufferItem.addActionListener(this);
198
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199
+ //normalLensItem.addActionListener(this);
200
+ cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
201
+ revertCameraItem.addActionListener(this);
202
+
203
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
204
+ toggleFullScreenItem.addItemListener(this);
205
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
206
+ cameraMenu.add("-");
207
+
208
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
209
+ toggleTextureItem.addItemListener(this);
210
+ toggleTextureItem.setState(CameraPane.textureon);
211
+
212
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
213
+ toggleSwitchItem.addItemListener(this);
214
+ toggleSwitchItem.setState(CameraPane.SWITCH);
215
+
216
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
217
+ toggleHandleItem.addItemListener(this);
218
+ toggleHandleItem.setState(CameraPane.HANDLES);
219
+
220
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
221
+ togglePaintItem.addItemListener(this);
222
+ togglePaintItem.setState(CameraPane.PAINTMODE);
223
+
224
+ if (Globals.ADVANCED)
225
+ {
226
+ cameraMenu.add("-");
227
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
228
+ toggleLiveItem.addItemListener(this);
229
+ toggleLiveItem.setState(Globals.isLIVE());
209230
231
+ cameraMenu.add(stepItem = new MenuItem("Step"));
232
+ stepItem.addActionListener(this);
233
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
234
+ // toggleDLItem.addItemListener(this);
235
+ // toggleDLItem.setState(false);
236
+
237
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
238
+ toggleRenderItem.addItemListener(this);
239
+ toggleRenderItem.setState(!CameraPane.frozen);
240
+
241
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242
+ toggleDebugItem.addItemListener(this);
243
+ toggleDebugItem.setState(CameraPane.DEBUG);
244
+
245
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246
+ toggleFrustumItem.addItemListener(this);
247
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
248
+
249
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
250
+ toggleFootContactItem.addItemListener(this);
251
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
252
+
253
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
254
+ toggleTimelineItem.addItemListener(this);
255
+ }
256
+
257
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
258
+// toggleRootItem.addItemListener(this);
259
+// toggleRootItem.setState(false);
260
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
261
+// animationItem.addItemListener(this);
262
+// animationItem.setState(CameraPane.ANIMATION);
263
+ cameraMenu.add("-");
264
+ cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
265
+ editCameraItem.addActionListener(this);
266
+
267
+ if (Globals.ADVANCED)
268
+ {
269
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
270
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
271
+ //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
272
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
273
+ oe.cameraMenu.add("-");
274
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
275
+ openWindowItem.addActionListener(this);
276
+ editLeafItem.addActionListener(this);
277
+ lookAtItem.addActionListener(this);
278
+ //lookFromItem.addActinoListener(this);
279
+ //switchItem.addActionListener(this);
280
+ }
281
+
210282 oe.menuBar.add(menu = new Menu("Setting"));
211283 if (Globals.ADVANCED)
212284 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217285 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218286 revertMeshItem.addActionListener(this);
219287 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -318,8 +386,12 @@
318386 resetTransformItem.addActionListener(this);
319387 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320388 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
389
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
390
+ resetCentroidXZItem.addActionListener(this);
391
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
392
+ transformGeometryItem.addActionListener(this);
393
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
394
+ transformChildrenItem.addActionListener(this);
323395
324396 oe.menuBar.add(menu = new Menu("Geometry"));
325397 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -368,6 +440,10 @@
368440 oe.menuBar.add(menu = new Menu("Attributes"));
369441 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370442 clearMaterialsItem.addActionListener(this);
443
+ resetAllItem = menu.add(new MenuItem("Reset All"));
444
+ resetAllItem.addActionListener(this);
445
+ stepAllItem = menu.add(new MenuItem("Step All"));
446
+ stepAllItem.addActionListener(this);
371447 menu.add("-");
372448 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373449 liveleavesItem.addActionListener(this);
....@@ -422,32 +498,23 @@
422498 sortbysizeItem.addActionListener(this);
423499 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424500 sortbynameItem.addActionListener(this);
501
+ menu.add("-");
502
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
503
+ shareGeometriesItem.addActionListener(this);
504
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
505
+ mergeGeometriesItem.addActionListener(this);
425506 if (Globals.ADVANCED)
426507 {
427
- menu.add("-");
508
+ // Pretty much the same as duplicate and clone.
428509 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429510 extractGeometriesItem.addActionListener(this);
430511 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431512 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);
436513 }
437514
438515 oe.menuBar.add(menu = new Menu("Insert"));
439516 buildCreateMenu(menu);
440517
441
- oe.menuBar.add(menu = new Menu("Include"));
442
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
443
- importGFDItem.addActionListener(this);
444
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
445
- importVRMLX3DItem.addActionListener(this);
446
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
447
- importOBJItem.addActionListener(this);
448
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
449
- import3DSItem.addActionListener(this);
450
-
451518 oe.menuBar.add(menu = new Menu("Tools"));
452519 buildToolsMenu(menu);
453520 }
....@@ -485,10 +552,10 @@
485552 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
486553
487554 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
488
- liveCB.setToolTipText("Enabled animation");
555
+ liveCB.setToolTipText("Enable animation");
489556 liveCB.addItemListener(this);
490557
491
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
558
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492559 oneStepButton.setToolTipText("Animate one step forward");
493560 oneStepButton.addActionListener(this);
494561
....@@ -500,7 +567,7 @@
500567 trackCB.setToolTipText("Enable tracking");
501568 trackCB.addItemListener(this);
502569
503
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
570
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504571 screenfitButton.setToolTipText("Screen fit");
505572 screenfitButton.addActionListener(this);
506573
....@@ -509,39 +576,39 @@
509576
510577 if (Globals.ADVANCED)
511578 {
512
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
579
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
513580 snapobjectButton.addActionListener(this);
514581 snapobjectButton.setToolTipText("Snap Object");
515582 }
516583
517
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
584
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
518585 flashSelectionButton.setToolTipText("Show selection");
519586 flashSelectionButton.addActionListener(this);
520587
521588 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
522589
523
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
590
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
524591 twoButton.setToolTipText("Show center view only");
525592 twoButton.addActionListener(this);
526
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
593
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527594 fourButton.addActionListener(this);
528595 fourButton.setToolTipText("Show left panel only");
529
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
596
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530597 sixButton.setToolTipText("2-column layout left");
531598 sixButton.addActionListener(this);
532
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
599
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533600 threeButton.setToolTipText("2-column layout right");
534601 threeButton.addActionListener(this);
535
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
602
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536603 sevenButton.setToolTipText("3-column layout");
537604 sevenButton.addActionListener(this);
538605 //
539606
540
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541608 rootButton.setToolTipText("Edit selection in new tab");
542609 rootButton.addActionListener(this);
543610
544
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
611
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
545612 closeButton.setToolTipText("Close tab");
546613 closeButton.addActionListener(this);
547614 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -549,11 +616,11 @@
549616
550617 cGridBag commandsPanel = new cGridBag();
551618
552
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
619
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553620 editButton.setToolTipText("Edit selection");
554621 editButton.addActionListener(this);
555622
556
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
623
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
557624 uneditButton.setToolTipText("Unedit selection");
558625 uneditButton.addActionListener(this);
559626
....@@ -561,11 +628,11 @@
561628 allParamsButton.setToolTipText("Edit all params");
562629 allParamsButton.addActionListener(this);
563630
564
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
631
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565632 clearPanelButton.setToolTipText("Clear edit panel");
566633 clearPanelButton.addActionListener(this);
567634
568
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
635
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569636 unselectButton.setToolTipText("Unselect");
570637 unselectButton.addActionListener(this);
571638
....@@ -648,7 +715,7 @@
648715 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
649716 zoomBoxCB.addItemListener(this);
650717
651
- if (Globals.ADVANCED)
718
+ if (true) // Globals.ADVANCED)
652719 {
653720 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
654721 supportCB.setToolTipText("Enable rigging");
....@@ -721,6 +788,7 @@
721788 buttonGroup.add(radioButton);
722789 radioButton.doClick();
723790 }
791
+
724792 void SetupViews(ObjEditor oe)
725793 {
726794 oe.SetupViews();
....@@ -937,7 +1005,9 @@
9371005 // objEditor.DropFile((java.io.File[]) object, true);
9381006 // return;
9391007 // }
940
- if (string.charAt(0) == '/')
1008
+
1009
+ // File path for Mac and Windows
1010
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9411011 {
9421012 // file(s)
9431013 String[] names = string.split("\n");
....@@ -964,7 +1034,7 @@
9641034
9651035 flashIt = false;
9661036 CameraPane pane = (CameraPane) target;
967
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1037
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9681038 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9691039
9701040 if (group.selection.size() == 1)
....@@ -1537,9 +1607,9 @@
15371607
15381608 void Overwrite(int mask)
15391609 {
1540
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1610
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15411611 {
1542
- Object3D content = GrafreeD.clipboard.get(0);
1612
+ Object3D content = Grafreed.clipboard.get(0);
15431613
15441614 if (content instanceof cGroup && ((cGroup)content).transientlink )
15451615 content = ((cGroup)content).get(0);
....@@ -1844,23 +1914,6 @@
18441914 csg.addChild(child);
18451915 child.addChild(csg);
18461916 } else
1847
-
1848
- if (source == importGFDItem)
1849
- {
1850
- ImportGFD();
1851
- } else
1852
- if (source == importVRMLX3DItem)
1853
- {
1854
- ImportVRMLX3D();
1855
- } else
1856
- if (source == import3DSItem)
1857
- {
1858
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1859
- } else
1860
- if (source == importOBJItem)
1861
- {
1862
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1863
- } else
18641917 if (source == computeAOItem)
18651918 {
18661919 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1879,7 +1932,7 @@
18791932 if (source == invariantsItem)
18801933 {
18811934 System.out.println("Invariants:");
1882
- GrafreeD.grafreeD.universe.invariants();
1935
+ Grafreed.grafreeD.universe.invariants();
18831936 } else
18841937 if (source == memoryItem)
18851938 {
....@@ -1954,10 +2007,10 @@
19542007 } else
19552008 if (source == duplicateItem)
19562009 {
1957
- Object3D keep = GrafreeD.clipboard;
2010
+ Object3D keep = Grafreed.clipboard;
19582011 loadClipboard(false);
19592012 paste(false);
1960
- GrafreeD.clipboard = keep;
2013
+ Grafreed.clipboard = keep;
19612014 } else
19622015 if (source == cloneItem)
19632016 {
....@@ -2177,9 +2230,9 @@
21772230 // group.selection.get(0).setMasterThis(content); // should be identity
21782231 // refreshContents();
21792232 // }
2180
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2233
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21812234 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2235
+ Object3D content = Grafreed.clipboard.get(0);
21832236
21842237 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852238 content = ((cGroup)content).get(0);
....@@ -2229,9 +2282,9 @@
22292282 } else
22302283 if (source == setMasterItem)
22312284 {
2232
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2285
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22332286 {
2234
- Object3D content = GrafreeD.clipboard.get(0);
2287
+ Object3D content = Grafreed.clipboard.get(0);
22352288
22362289 if (content instanceof cGroup && ((cGroup)content).transientlink )
22372290 content = ((cGroup)content).get(0);
....@@ -2244,9 +2297,9 @@
22442297 {
22452298 if (group.selection.size() == 1)
22462299 {
2247
- if (GrafreeD.clipboard.size() == 1)
2300
+ if (Grafreed.clipboard.size() == 1)
22482301 {
2249
- Object3D content = GrafreeD.clipboard.get(0);
2302
+ Object3D content = Grafreed.clipboard.get(0);
22502303
22512304 if (content instanceof cGroup && ((cGroup)content).transientlink )
22522305 content = ((cGroup)content).get(0);
....@@ -2263,7 +2316,7 @@
22632316 {
22642317 RevertMeshes();
22652318 } else
2266
- if (source == resetMeshItem)
2319
+ if (source == resetAllItem)
22672320 {
22682321 ResetAll();
22692322 } else
....@@ -2601,9 +2654,13 @@
26012654 {
26022655 SmoothMesh();
26032656 } else
2604
- if (source == transformgeometryItem)
2657
+ if (source == transformGeometryItem)
26052658 {
26062659 TransformGeometry();
2660
+ } else
2661
+ if (source == transformChildrenItem)
2662
+ {
2663
+ TransformChildren();
26072664 } else
26082665 if (source == resetTransformItem)
26092666 {
....@@ -2611,7 +2668,11 @@
26112668 } else
26122669 if (source == resetCentroidItem)
26132670 {
2614
- ResetCentroid();
2671
+ ResetCentroid(true);
2672
+ } else
2673
+ if (source == resetCentroidXZItem)
2674
+ {
2675
+ ResetCentroid(false);
26152676 } else
26162677 if (source == resetParentItem)
26172678 {
....@@ -3053,7 +3114,9 @@
30533114 frontView.object = group;
30543115 sideView.object = group;
30553116 }
3056
- group.editWindow = this;
3117
+
3118
+// fix "+" issue group.editWindow = this;
3119
+
30573120 /*
30583121 currentLayout = radio.layout;
30593122 if (currentLayout == null)
....@@ -3066,7 +3129,20 @@
30663129 //group.attributes = -1;
30673130 ResetModel();
30683131 refreshContents(true);
3069
- }
3132
+ } else if (event.getSource() == editCameraItem)
3133
+ {
3134
+ cameraView.ProtectCamera();
3135
+ cameraView.repaint();
3136
+ return;
3137
+ } else if (event.getSource() == revertCameraItem)
3138
+ {
3139
+ cameraView.RevertCamera();
3140
+ cameraView.repaint();
3141
+ return;
3142
+ // } else if (event.getSource() == textureButton)
3143
+ // {
3144
+ // return; // true;
3145
+ }
30703146 else
30713147 {
30723148 //return super.action(event, arg);
....@@ -3127,6 +3203,28 @@
31273203 refreshContents();
31283204 }
31293205
3206
+ void TransformChildren()
3207
+ {
3208
+ Object3D obj;
3209
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3210
+ {
3211
+ obj = (Object3D)e.nextElement();
3212
+ obj.KeepTextureMatrices();
3213
+ obj.TransformChildren();
3214
+ obj.RestoreTextureMatrices();
3215
+
3216
+// if (obj.parent == null)
3217
+// {
3218
+// System.out.println("NULL PARENT!");
3219
+// new Exception().printStackTrace();
3220
+// }
3221
+// else
3222
+// TouchTransform(obj);
3223
+// //obj.parent.Touch();
3224
+ }
3225
+
3226
+ refreshContents();
3227
+ }
31303228
31313229 void ResetTransform()
31323230 {
....@@ -3239,7 +3337,7 @@
32393337 refreshContents();
32403338 }
32413339
3242
- void ResetCentroid()
3340
+ void ResetCentroid(boolean full)
32433341 {
32443342 Object3D obj;
32453343 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3254,12 +3352,16 @@
32543352 LA.matIdentity(Object3D.mat);
32553353 obj.getBounds(minima, maxima, false);
32563354 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3257
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3355
+ if (full)
3356
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32583357 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32593358 obj.TransformMesh(Object3D.mat);
3359
+
32603360 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3261
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3361
+ if (full)
3362
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32623363 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3364
+
32633365 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32643366 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32653367 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3325,9 +3427,9 @@
33253427 obj = (Object3D)e.nextElement();
33263428
33273429 System.out.println("Object is: " + obj);
3328
- GrafreeD.AnalyzeObject(obj);
3430
+ Grafreed.AnalyzeObject(obj);
33293431 System.out.println("Boundary rep: " + obj.bRep);
3330
- GrafreeD.AnalyzeObject(obj.bRep);
3432
+ Grafreed.AnalyzeObject(obj.bRep);
33313433
33323434 // System.err.println((size/1024) + " KB is the size of " + obj);
33333435 }
....@@ -3541,8 +3643,8 @@
35413643
35423644 void ParseVertices()
35433645 {
3544
- boolean epsequal = GrafreeD.epsequal;
3545
- GrafreeD.epsequal = true;
3646
+ boolean epsequal = Grafreed.epsequal;
3647
+ Grafreed.epsequal = true;
35463648
35473649 for (int i=0; i<group.selection.size(); i++)
35483650 {
....@@ -3567,7 +3669,7 @@
35673669 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35683670 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35693671
3570
- g.add(GrafreeD.clipboard);
3672
+ g.add(Grafreed.clipboard);
35713673
35723674 buffer.add(g);
35733675 }
....@@ -3582,7 +3684,7 @@
35823684 makeSomething(buffer, i==group.selection.size()-1);
35833685 }
35843686
3585
- GrafreeD.epsequal = epsequal;
3687
+ Grafreed.epsequal = epsequal;
35863688
35873689 refreshContents();
35883690 }
....@@ -3600,7 +3702,16 @@
36003702 String pigment = Object3D.GetPigment(tex);
36013703 //String bump = Object3D.GetBump(tex);
36023704
3603
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3705
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3706
+
3707
+ try
3708
+ {
3709
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3710
+ }
3711
+ catch (Exception e)
3712
+ {
3713
+ System.err.println("FAIL: " + node);
3714
+ }
36043715
36053716 double s = v.s;
36063717
....@@ -3732,7 +3843,7 @@
37323843 return;
37333844
37343845 Object3D poses = group.selection.get(0);
3735
- Object3D ref = GrafreeD.clipboard.get(0);
3846
+ Object3D ref = Grafreed.clipboard.get(0);
37363847
37373848 Object3D newgroup = new Object3D("Po:" + poses.name);
37383849
....@@ -3926,9 +4037,9 @@
39264037
39274038 void ClipMesh()
39284039 {
3929
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4040
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39304041 {
3931
- Object3D content = GrafreeD.clipboard.get(0);
4042
+ Object3D content = Grafreed.clipboard.get(0);
39324043
39334044 if (content instanceof cGroup && ((cGroup)content).transientlink )
39344045 content = ((cGroup)content).get(0);
....@@ -3937,7 +4048,7 @@
39374048 // {
39384049 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39394050 // }
3940
- group.selection.ClipMesh(GrafreeD.clipboard);
4051
+ group.selection.ClipMesh(Grafreed.clipboard);
39414052 }
39424053 // group.selection.ClipMesh(GrafreeD.clipboard);
39434054 System.out.println("DONE.");
....@@ -4072,7 +4183,7 @@
40724183 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40734184
40744185 Object3D elem = (Object3D)group.selection.elementAt(i);
4075
- if(elem != group)
4186
+ if(elem != group || !newWindow)
40764187 {
40774188 // if (!(elem instanceof Composite))
40784189 // newWindow = false;
....@@ -4277,12 +4388,12 @@
42774388 {
42784389 if (group.selection.isEmpty())
42794390 return;
4280
- GrafreeD.clipboardIsTempGroup = false;
4391
+ Grafreed.clipboardIsTempGroup = false;
42814392 Composite tGroup = null;
42824393 if (group.selection.size() > 0) // 1)
42834394 {
42844395 tGroup = new cGroup();
4285
- GrafreeD.clipboardIsTempGroup = true;
4396
+ Grafreed.clipboardIsTempGroup = true;
42864397 }
42874398
42884399 if (cut)
....@@ -4322,16 +4433,16 @@
43224433 //System.out.println("cut " + child);
43234434 //System.out.println("parent = " + child.parent);
43244435 // tmp.addChild(child);
4325
- if (GrafreeD.clipboardIsTempGroup)
4436
+ if (Grafreed.clipboardIsTempGroup)
43264437 tGroup.add/*Child*/(tmp);
43274438 else
4328
- GrafreeD.clipboard = tmp;
4439
+ Grafreed.clipboard = tmp;
43294440 }
43304441 else
4331
- if (GrafreeD.clipboardIsTempGroup)
4442
+ if (Grafreed.clipboardIsTempGroup)
43324443 tGroup.add/*Child*/(child);
43334444 else
4334
- GrafreeD.clipboard = child;
4445
+ Grafreed.clipboard = child;
43354446 }
43364447
43374448 //ResetModel();
....@@ -4363,21 +4474,21 @@
43634474 //System.out.println("cut " + elem);
43644475 //System.out.println("parent = " + elem.parent);
43654476 // tmp.addChild(elem);
4366
- if (GrafreeD.clipboardIsTempGroup)
4477
+ if (Grafreed.clipboardIsTempGroup)
43674478 tGroup.add/*Child*/(tmp);
43684479 else
4369
- GrafreeD.clipboard = tmp;
4480
+ Grafreed.clipboard = tmp;
43704481 }
43714482 else
4372
- if (GrafreeD.clipboardIsTempGroup)
4483
+ if (Grafreed.clipboardIsTempGroup)
43734484 tGroup.add/*Child*/(child);
43744485 else
4375
- GrafreeD.clipboard = child;
4486
+ Grafreed.clipboard = child;
43764487 }
43774488
43784489 }
4379
- if (GrafreeD.clipboardIsTempGroup)
4380
- GrafreeD.clipboard = tGroup;
4490
+ if (Grafreed.clipboardIsTempGroup)
4491
+ Grafreed.clipboard = tGroup;
43814492 if (cut)
43824493 {
43834494 ResetModel();
....@@ -4391,7 +4502,7 @@
43914502 // return;
43924503 boolean first = true;
43934504
4394
- if (GrafreeD.clipboardIsTempGroup)
4505
+ if (Grafreed.clipboardIsTempGroup)
43954506 {
43964507 Composite temp;
43974508
....@@ -4402,7 +4513,7 @@
44024513 temp = (Composite)Applet3D.clipboard.deepCopy();
44034514 */
44044515 Object3D elem;
4405
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4516
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44064517 {
44074518 Object3D child = (Object3D)e.nextElement();
44084519
....@@ -4436,14 +4547,14 @@
44364547 //Object3D cb = Applet3D.clipboard;
44374548 //temp.addChild(cb);
44384549 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4439
- assert(GrafreeD.clipboard.parent == null);
4440
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4441
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4442
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4443
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4550
+ assert(Grafreed.clipboard.parent == null);
4551
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4552
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4553
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4554
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44444555 else
4445
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4446
- GrafreeD.clipboard.get(0).parent = keepparent;
4556
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4557
+ Grafreed.clipboard.get(0).parent = keepparent;
44474558 }
44484559
44494560 ResetModel();
....@@ -4492,9 +4603,9 @@
44924603 {
44934604 boolean first = true;
44944605
4495
- if (GrafreeD.clipboardIsTempGroup)
4606
+ if (Grafreed.clipboardIsTempGroup)
44964607 {
4497
- Composite temp = (Composite)GrafreeD.clipboard;
4608
+ Composite temp = (Composite)Grafreed.clipboard;
44984609 Object3D copy;
44994610 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45004611 {
....@@ -4504,7 +4615,7 @@
45044615 }
45054616 } else
45064617 {
4507
- linkSomething(GrafreeD.clipboard); //.get(0));
4618
+ linkSomething(Grafreed.clipboard); //.get(0));
45084619 }
45094620 }
45104621 }
....@@ -4909,21 +5020,6 @@
49095020 }
49105021 */
49115022
4912
- void ImportGFD()
4913
- {
4914
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4915
- browser.show();
4916
- String filename = browser.getFile();
4917
- if (filename != null && filename.length() > 0)
4918
- {
4919
- String fullname = browser.getDirectory() + filename;
4920
-
4921
- //Object3D readobj =
4922
- objEditor.ReadGFD(fullname, objEditor);
4923
- //makeSomething(readobj);
4924
- }
4925
- }
4926
-
49275023 /*
49285024 public void Callback(Object obj)
49295025 {
....@@ -4947,26 +5043,9 @@
49475043 }
49485044 */
49495045
4950
- void ImportVRMLX3D()
4951
- {
4952
- if (GrafreeD.standAlone)
4953
- {
4954
- /**/
4955
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4956
- browser.show();
4957
- String filename = browser.getFile();
4958
- if (filename != null && filename.length() > 0)
4959
- {
4960
- String fullname = browser.getDirectory() + filename;
4961
- LoadVRMLX3D(fullname);
4962
- }
4963
- /**/
4964
- }
4965
- }
4966
-
49675046 String GetFile(String dialogName)
49685047 {
4969
- if (GrafreeD.standAlone)
5048
+ if (Grafreed.standAlone)
49705049 {
49715050 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49725051 browser.show();
....@@ -5079,7 +5158,7 @@
50795158 private MenuItem linkverticesItem;
50805159 private MenuItem relinkverticesItem;
50815160 private MenuItem setMasterItem;
5082
- private MenuItem resetMeshItem;
5161
+ private MenuItem resetAllItem;
50835162 private MenuItem stepAllItem;
50845163 private MenuItem revertMeshItem;
50855164 private MenuItem poseMeshItem;
....@@ -5140,8 +5219,10 @@
51405219 private MenuItem panoTexturesItem;
51415220
51425221 private MenuItem resetCentroidItem;
5143
- private MenuItem transformgeometryItem;
5222
+ private MenuItem resetCentroidXZItem;
51445223 private MenuItem resetTransformItem;
5224
+ private MenuItem transformGeometryItem;
5225
+ private MenuItem transformChildrenItem;
51455226 private MenuItem hideItem;
51465227 private MenuItem grabItem;
51475228 private MenuItem backItem;
....@@ -5210,11 +5291,6 @@
52105291 private MenuItem doubleItem;
52115292 private MenuItem tripleItem;
52125293
5213
- private MenuItem importGFDItem;
5214
- private MenuItem importVRMLX3DItem;
5215
- private MenuItem import3DSItem;
5216
- private MenuItem importOBJItem;
5217
-
52185294 private MenuItem computeAOItem;
52195295 private MenuItem recompileItem;
52205296 private MenuItem editScriptItem;
....@@ -5224,4 +5300,8 @@
52245300 private MenuItem analyzeItem;
52255301 private MenuItem dumpItem;
52265302 //boolean freezemodel = false;
5303
+
5304
+ Menu cameraMenu;
5305
+ MenuItem editCameraItem;
5306
+ MenuItem revertCameraItem;
52275307 }