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,35 +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
- 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
-
454518 oe.menuBar.add(menu = new Menu("Tools"));
455519 buildToolsMenu(menu);
456520 }
....@@ -488,10 +552,10 @@
488552 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
489553
490554 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
- liveCB.setToolTipText("Enabled animation");
555
+ liveCB.setToolTipText("Enable animation");
492556 liveCB.addItemListener(this);
493557
494
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
558
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495559 oneStepButton.setToolTipText("Animate one step forward");
496560 oneStepButton.addActionListener(this);
497561
....@@ -503,7 +567,7 @@
503567 trackCB.setToolTipText("Enable tracking");
504568 trackCB.addItemListener(this);
505569
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
570
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
507571 screenfitButton.setToolTipText("Screen fit");
508572 screenfitButton.addActionListener(this);
509573
....@@ -512,39 +576,39 @@
512576
513577 if (Globals.ADVANCED)
514578 {
515
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
579
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516580 snapobjectButton.addActionListener(this);
517581 snapobjectButton.setToolTipText("Snap Object");
518582 }
519583
520
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
584
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521585 flashSelectionButton.setToolTipText("Show selection");
522586 flashSelectionButton.addActionListener(this);
523587
524588 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525589
526
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
590
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527591 twoButton.setToolTipText("Show center view only");
528592 twoButton.addActionListener(this);
529
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
593
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530594 fourButton.addActionListener(this);
531595 fourButton.setToolTipText("Show left panel only");
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
596
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533597 sixButton.setToolTipText("2-column layout left");
534598 sixButton.addActionListener(this);
535
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
599
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536600 threeButton.setToolTipText("2-column layout right");
537601 threeButton.addActionListener(this);
538
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
602
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
539603 sevenButton.setToolTipText("3-column layout");
540604 sevenButton.addActionListener(this);
541605 //
542606
543
- 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);
544608 rootButton.setToolTipText("Edit selection in new tab");
545609 rootButton.addActionListener(this);
546610
547
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
611
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
548612 closeButton.setToolTipText("Close tab");
549613 closeButton.addActionListener(this);
550614 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -552,11 +616,11 @@
552616
553617 cGridBag commandsPanel = new cGridBag();
554618
555
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
619
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
556620 editButton.setToolTipText("Edit selection");
557621 editButton.addActionListener(this);
558622
559
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
623
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
560624 uneditButton.setToolTipText("Unedit selection");
561625 uneditButton.addActionListener(this);
562626
....@@ -564,11 +628,11 @@
564628 allParamsButton.setToolTipText("Edit all params");
565629 allParamsButton.addActionListener(this);
566630
567
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
631
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
568632 clearPanelButton.setToolTipText("Clear edit panel");
569633 clearPanelButton.addActionListener(this);
570634
571
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
635
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
572636 unselectButton.setToolTipText("Unselect");
573637 unselectButton.addActionListener(this);
574638
....@@ -651,7 +715,7 @@
651715 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
652716 zoomBoxCB.addItemListener(this);
653717
654
- if (Globals.ADVANCED)
718
+ if (true) // Globals.ADVANCED)
655719 {
656720 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657721 supportCB.setToolTipText("Enable rigging");
....@@ -724,6 +788,7 @@
724788 buttonGroup.add(radioButton);
725789 radioButton.doClick();
726790 }
791
+
727792 void SetupViews(ObjEditor oe)
728793 {
729794 oe.SetupViews();
....@@ -940,7 +1005,9 @@
9401005 // objEditor.DropFile((java.io.File[]) object, true);
9411006 // return;
9421007 // }
943
- if (string.charAt(0) == '/')
1008
+
1009
+ // File path for Mac and Windows
1010
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9441011 {
9451012 // file(s)
9461013 String[] names = string.split("\n");
....@@ -967,7 +1034,7 @@
9671034
9681035 flashIt = false;
9691036 CameraPane pane = (CameraPane) target;
970
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1037
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9711038 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9721039
9731040 if (group.selection.size() == 1)
....@@ -1540,9 +1607,9 @@
15401607
15411608 void Overwrite(int mask)
15421609 {
1543
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1610
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15441611 {
1545
- Object3D content = GrafreeD.clipboard.get(0);
1612
+ Object3D content = Grafreed.clipboard.get(0);
15461613
15471614 if (content instanceof cGroup && ((cGroup)content).transientlink )
15481615 content = ((cGroup)content).get(0);
....@@ -1847,31 +1914,6 @@
18471914 csg.addChild(child);
18481915 child.addChild(csg);
18491916 } 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
18751917 if (source == computeAOItem)
18761918 {
18771919 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1890,7 +1932,7 @@
18901932 if (source == invariantsItem)
18911933 {
18921934 System.out.println("Invariants:");
1893
- GrafreeD.grafreeD.universe.invariants();
1935
+ Grafreed.grafreeD.universe.invariants();
18941936 } else
18951937 if (source == memoryItem)
18961938 {
....@@ -1965,10 +2007,10 @@
19652007 } else
19662008 if (source == duplicateItem)
19672009 {
1968
- Object3D keep = GrafreeD.clipboard;
2010
+ Object3D keep = Grafreed.clipboard;
19692011 loadClipboard(false);
19702012 paste(false);
1971
- GrafreeD.clipboard = keep;
2013
+ Grafreed.clipboard = keep;
19722014 } else
19732015 if (source == cloneItem)
19742016 {
....@@ -2188,9 +2230,9 @@
21882230 // group.selection.get(0).setMasterThis(content); // should be identity
21892231 // refreshContents();
21902232 // }
2191
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2233
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21922234 {
2193
- Object3D content = GrafreeD.clipboard.get(0);
2235
+ Object3D content = Grafreed.clipboard.get(0);
21942236
21952237 if (content instanceof cGroup && ((cGroup)content).transientlink )
21962238 content = ((cGroup)content).get(0);
....@@ -2240,9 +2282,9 @@
22402282 } else
22412283 if (source == setMasterItem)
22422284 {
2243
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2285
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22442286 {
2245
- Object3D content = GrafreeD.clipboard.get(0);
2287
+ Object3D content = Grafreed.clipboard.get(0);
22462288
22472289 if (content instanceof cGroup && ((cGroup)content).transientlink )
22482290 content = ((cGroup)content).get(0);
....@@ -2255,9 +2297,9 @@
22552297 {
22562298 if (group.selection.size() == 1)
22572299 {
2258
- if (GrafreeD.clipboard.size() == 1)
2300
+ if (Grafreed.clipboard.size() == 1)
22592301 {
2260
- Object3D content = GrafreeD.clipboard.get(0);
2302
+ Object3D content = Grafreed.clipboard.get(0);
22612303
22622304 if (content instanceof cGroup && ((cGroup)content).transientlink )
22632305 content = ((cGroup)content).get(0);
....@@ -2274,7 +2316,7 @@
22742316 {
22752317 RevertMeshes();
22762318 } else
2277
- if (source == resetMeshItem)
2319
+ if (source == resetAllItem)
22782320 {
22792321 ResetAll();
22802322 } else
....@@ -2612,9 +2654,13 @@
26122654 {
26132655 SmoothMesh();
26142656 } else
2615
- if (source == transformgeometryItem)
2657
+ if (source == transformGeometryItem)
26162658 {
26172659 TransformGeometry();
2660
+ } else
2661
+ if (source == transformChildrenItem)
2662
+ {
2663
+ TransformChildren();
26182664 } else
26192665 if (source == resetTransformItem)
26202666 {
....@@ -2622,7 +2668,11 @@
26222668 } else
26232669 if (source == resetCentroidItem)
26242670 {
2625
- ResetCentroid();
2671
+ ResetCentroid(true);
2672
+ } else
2673
+ if (source == resetCentroidXZItem)
2674
+ {
2675
+ ResetCentroid(false);
26262676 } else
26272677 if (source == resetParentItem)
26282678 {
....@@ -3064,7 +3114,9 @@
30643114 frontView.object = group;
30653115 sideView.object = group;
30663116 }
3067
- group.editWindow = this;
3117
+
3118
+// fix "+" issue group.editWindow = this;
3119
+
30683120 /*
30693121 currentLayout = radio.layout;
30703122 if (currentLayout == null)
....@@ -3077,7 +3129,20 @@
30773129 //group.attributes = -1;
30783130 ResetModel();
30793131 refreshContents(true);
3080
- }
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
+ }
30813146 else
30823147 {
30833148 //return super.action(event, arg);
....@@ -3138,6 +3203,28 @@
31383203 refreshContents();
31393204 }
31403205
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
+ }
31413228
31423229 void ResetTransform()
31433230 {
....@@ -3250,7 +3337,7 @@
32503337 refreshContents();
32513338 }
32523339
3253
- void ResetCentroid()
3340
+ void ResetCentroid(boolean full)
32543341 {
32553342 Object3D obj;
32563343 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3265,12 +3352,16 @@
32653352 LA.matIdentity(Object3D.mat);
32663353 obj.getBounds(minima, maxima, false);
32673354 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3268
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3355
+ if (full)
3356
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32693357 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32703358 obj.TransformMesh(Object3D.mat);
3359
+
32713360 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3272
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3361
+ if (full)
3362
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32733363 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3364
+
32743365 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32753366 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32763367 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3336,9 +3427,9 @@
33363427 obj = (Object3D)e.nextElement();
33373428
33383429 System.out.println("Object is: " + obj);
3339
- GrafreeD.AnalyzeObject(obj);
3430
+ Grafreed.AnalyzeObject(obj);
33403431 System.out.println("Boundary rep: " + obj.bRep);
3341
- GrafreeD.AnalyzeObject(obj.bRep);
3432
+ Grafreed.AnalyzeObject(obj.bRep);
33423433
33433434 // System.err.println((size/1024) + " KB is the size of " + obj);
33443435 }
....@@ -3552,8 +3643,8 @@
35523643
35533644 void ParseVertices()
35543645 {
3555
- boolean epsequal = GrafreeD.epsequal;
3556
- GrafreeD.epsequal = true;
3646
+ boolean epsequal = Grafreed.epsequal;
3647
+ Grafreed.epsequal = true;
35573648
35583649 for (int i=0; i<group.selection.size(); i++)
35593650 {
....@@ -3578,7 +3669,7 @@
35783669 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35793670 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35803671
3581
- g.add(GrafreeD.clipboard);
3672
+ g.add(Grafreed.clipboard);
35823673
35833674 buffer.add(g);
35843675 }
....@@ -3593,7 +3684,7 @@
35933684 makeSomething(buffer, i==group.selection.size()-1);
35943685 }
35953686
3596
- GrafreeD.epsequal = epsequal;
3687
+ Grafreed.epsequal = epsequal;
35973688
35983689 refreshContents();
35993690 }
....@@ -3611,7 +3702,16 @@
36113702 String pigment = Object3D.GetPigment(tex);
36123703 //String bump = Object3D.GetBump(tex);
36133704
3614
- 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
+ }
36153715
36163716 double s = v.s;
36173717
....@@ -3743,7 +3843,7 @@
37433843 return;
37443844
37453845 Object3D poses = group.selection.get(0);
3746
- Object3D ref = GrafreeD.clipboard.get(0);
3846
+ Object3D ref = Grafreed.clipboard.get(0);
37473847
37483848 Object3D newgroup = new Object3D("Po:" + poses.name);
37493849
....@@ -3937,9 +4037,9 @@
39374037
39384038 void ClipMesh()
39394039 {
3940
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4040
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39414041 {
3942
- Object3D content = GrafreeD.clipboard.get(0);
4042
+ Object3D content = Grafreed.clipboard.get(0);
39434043
39444044 if (content instanceof cGroup && ((cGroup)content).transientlink )
39454045 content = ((cGroup)content).get(0);
....@@ -3948,7 +4048,7 @@
39484048 // {
39494049 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39504050 // }
3951
- group.selection.ClipMesh(GrafreeD.clipboard);
4051
+ group.selection.ClipMesh(Grafreed.clipboard);
39524052 }
39534053 // group.selection.ClipMesh(GrafreeD.clipboard);
39544054 System.out.println("DONE.");
....@@ -4083,7 +4183,7 @@
40834183 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40844184
40854185 Object3D elem = (Object3D)group.selection.elementAt(i);
4086
- if(elem != group)
4186
+ if(elem != group || !newWindow)
40874187 {
40884188 // if (!(elem instanceof Composite))
40894189 // newWindow = false;
....@@ -4288,12 +4388,12 @@
42884388 {
42894389 if (group.selection.isEmpty())
42904390 return;
4291
- GrafreeD.clipboardIsTempGroup = false;
4391
+ Grafreed.clipboardIsTempGroup = false;
42924392 Composite tGroup = null;
42934393 if (group.selection.size() > 0) // 1)
42944394 {
42954395 tGroup = new cGroup();
4296
- GrafreeD.clipboardIsTempGroup = true;
4396
+ Grafreed.clipboardIsTempGroup = true;
42974397 }
42984398
42994399 if (cut)
....@@ -4333,16 +4433,16 @@
43334433 //System.out.println("cut " + child);
43344434 //System.out.println("parent = " + child.parent);
43354435 // tmp.addChild(child);
4336
- if (GrafreeD.clipboardIsTempGroup)
4436
+ if (Grafreed.clipboardIsTempGroup)
43374437 tGroup.add/*Child*/(tmp);
43384438 else
4339
- GrafreeD.clipboard = tmp;
4439
+ Grafreed.clipboard = tmp;
43404440 }
43414441 else
4342
- if (GrafreeD.clipboardIsTempGroup)
4442
+ if (Grafreed.clipboardIsTempGroup)
43434443 tGroup.add/*Child*/(child);
43444444 else
4345
- GrafreeD.clipboard = child;
4445
+ Grafreed.clipboard = child;
43464446 }
43474447
43484448 //ResetModel();
....@@ -4374,21 +4474,21 @@
43744474 //System.out.println("cut " + elem);
43754475 //System.out.println("parent = " + elem.parent);
43764476 // tmp.addChild(elem);
4377
- if (GrafreeD.clipboardIsTempGroup)
4477
+ if (Grafreed.clipboardIsTempGroup)
43784478 tGroup.add/*Child*/(tmp);
43794479 else
4380
- GrafreeD.clipboard = tmp;
4480
+ Grafreed.clipboard = tmp;
43814481 }
43824482 else
4383
- if (GrafreeD.clipboardIsTempGroup)
4483
+ if (Grafreed.clipboardIsTempGroup)
43844484 tGroup.add/*Child*/(child);
43854485 else
4386
- GrafreeD.clipboard = child;
4486
+ Grafreed.clipboard = child;
43874487 }
43884488
43894489 }
4390
- if (GrafreeD.clipboardIsTempGroup)
4391
- GrafreeD.clipboard = tGroup;
4490
+ if (Grafreed.clipboardIsTempGroup)
4491
+ Grafreed.clipboard = tGroup;
43924492 if (cut)
43934493 {
43944494 ResetModel();
....@@ -4402,7 +4502,7 @@
44024502 // return;
44034503 boolean first = true;
44044504
4405
- if (GrafreeD.clipboardIsTempGroup)
4505
+ if (Grafreed.clipboardIsTempGroup)
44064506 {
44074507 Composite temp;
44084508
....@@ -4413,7 +4513,7 @@
44134513 temp = (Composite)Applet3D.clipboard.deepCopy();
44144514 */
44154515 Object3D elem;
4416
- 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))
44174517 {
44184518 Object3D child = (Object3D)e.nextElement();
44194519
....@@ -4447,14 +4547,14 @@
44474547 //Object3D cb = Applet3D.clipboard;
44484548 //temp.addChild(cb);
44494549 //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());
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());
44554555 else
4456
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4457
- GrafreeD.clipboard.get(0).parent = keepparent;
4556
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4557
+ Grafreed.clipboard.get(0).parent = keepparent;
44584558 }
44594559
44604560 ResetModel();
....@@ -4503,9 +4603,9 @@
45034603 {
45044604 boolean first = true;
45054605
4506
- if (GrafreeD.clipboardIsTempGroup)
4606
+ if (Grafreed.clipboardIsTempGroup)
45074607 {
4508
- Composite temp = (Composite)GrafreeD.clipboard;
4608
+ Composite temp = (Composite)Grafreed.clipboard;
45094609 Object3D copy;
45104610 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45114611 {
....@@ -4515,7 +4615,7 @@
45154615 }
45164616 } else
45174617 {
4518
- linkSomething(GrafreeD.clipboard); //.get(0));
4618
+ linkSomething(Grafreed.clipboard); //.get(0));
45194619 }
45204620 }
45214621 }
....@@ -4920,21 +5020,6 @@
49205020 }
49215021 */
49225022
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
-
49385023 /*
49395024 public void Callback(Object obj)
49405025 {
....@@ -4958,26 +5043,9 @@
49585043 }
49595044 */
49605045
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
-
49785046 String GetFile(String dialogName)
49795047 {
4980
- if (GrafreeD.standAlone)
5048
+ if (Grafreed.standAlone)
49815049 {
49825050 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49835051 browser.show();
....@@ -5090,7 +5158,7 @@
50905158 private MenuItem linkverticesItem;
50915159 private MenuItem relinkverticesItem;
50925160 private MenuItem setMasterItem;
5093
- private MenuItem resetMeshItem;
5161
+ private MenuItem resetAllItem;
50945162 private MenuItem stepAllItem;
50955163 private MenuItem revertMeshItem;
50965164 private MenuItem poseMeshItem;
....@@ -5151,8 +5219,10 @@
51515219 private MenuItem panoTexturesItem;
51525220
51535221 private MenuItem resetCentroidItem;
5154
- private MenuItem transformgeometryItem;
5222
+ private MenuItem resetCentroidXZItem;
51555223 private MenuItem resetTransformItem;
5224
+ private MenuItem transformGeometryItem;
5225
+ private MenuItem transformChildrenItem;
51565226 private MenuItem hideItem;
51575227 private MenuItem grabItem;
51585228 private MenuItem backItem;
....@@ -5221,11 +5291,6 @@
52215291 private MenuItem doubleItem;
52225292 private MenuItem tripleItem;
52235293
5224
- private MenuItem importGFDItem;
5225
- private MenuItem importVRMLX3DItem;
5226
- private MenuItem import3DSItem;
5227
- private MenuItem importOBJItem;
5228
-
52295294 private MenuItem computeAOItem;
52305295 private MenuItem recompileItem;
52315296 private MenuItem editScriptItem;
....@@ -5235,4 +5300,8 @@
52355300 private MenuItem analyzeItem;
52365301 private MenuItem dumpItem;
52375302 //boolean freezemodel = false;
5303
+
5304
+ Menu cameraMenu;
5305
+ MenuItem editCameraItem;
5306
+ MenuItem revertCameraItem;
52385307 }