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();
....@@ -969,7 +1034,7 @@
9691034
9701035 flashIt = false;
9711036 CameraPane pane = (CameraPane) target;
972
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1037
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9731038 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9741039
9751040 if (group.selection.size() == 1)
....@@ -1542,9 +1607,9 @@
15421607
15431608 void Overwrite(int mask)
15441609 {
1545
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1610
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15461611 {
1547
- Object3D content = GrafreeD.clipboard.get(0);
1612
+ Object3D content = Grafreed.clipboard.get(0);
15481613
15491614 if (content instanceof cGroup && ((cGroup)content).transientlink )
15501615 content = ((cGroup)content).get(0);
....@@ -1849,31 +1914,6 @@
18491914 csg.addChild(child);
18501915 child.addChild(csg);
18511916 } else
1852
-
1853
- if (source == importGFDItem)
1854
- {
1855
- ImportGFD();
1856
- } else
1857
- if (source == importVRMLX3DItem)
1858
- {
1859
- ImportVRMLX3D();
1860
- } else
1861
- if (source == import3DSItem)
1862
- {
1863
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1864
- } else
1865
- if (source == importOBJItem)
1866
- {
1867
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1868
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1869
- browser.setVisible(true);
1870
- String filename = browser.getFile();
1871
- if (filename != null && filename.length() > 0)
1872
- {
1873
- String fullname = browser.getDirectory() + filename;
1874
- makeSomething(ReadOBJ(fullname), true);
1875
- }
1876
- } else
18771917 if (source == computeAOItem)
18781918 {
18791919 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1892,7 +1932,7 @@
18921932 if (source == invariantsItem)
18931933 {
18941934 System.out.println("Invariants:");
1895
- GrafreeD.grafreeD.universe.invariants();
1935
+ Grafreed.grafreeD.universe.invariants();
18961936 } else
18971937 if (source == memoryItem)
18981938 {
....@@ -1967,10 +2007,10 @@
19672007 } else
19682008 if (source == duplicateItem)
19692009 {
1970
- Object3D keep = GrafreeD.clipboard;
2010
+ Object3D keep = Grafreed.clipboard;
19712011 loadClipboard(false);
19722012 paste(false);
1973
- GrafreeD.clipboard = keep;
2013
+ Grafreed.clipboard = keep;
19742014 } else
19752015 if (source == cloneItem)
19762016 {
....@@ -2190,9 +2230,9 @@
21902230 // group.selection.get(0).setMasterThis(content); // should be identity
21912231 // refreshContents();
21922232 // }
2193
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2233
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21942234 {
2195
- Object3D content = GrafreeD.clipboard.get(0);
2235
+ Object3D content = Grafreed.clipboard.get(0);
21962236
21972237 if (content instanceof cGroup && ((cGroup)content).transientlink )
21982238 content = ((cGroup)content).get(0);
....@@ -2242,9 +2282,9 @@
22422282 } else
22432283 if (source == setMasterItem)
22442284 {
2245
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2285
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22462286 {
2247
- Object3D content = GrafreeD.clipboard.get(0);
2287
+ Object3D content = Grafreed.clipboard.get(0);
22482288
22492289 if (content instanceof cGroup && ((cGroup)content).transientlink )
22502290 content = ((cGroup)content).get(0);
....@@ -2257,9 +2297,9 @@
22572297 {
22582298 if (group.selection.size() == 1)
22592299 {
2260
- if (GrafreeD.clipboard.size() == 1)
2300
+ if (Grafreed.clipboard.size() == 1)
22612301 {
2262
- Object3D content = GrafreeD.clipboard.get(0);
2302
+ Object3D content = Grafreed.clipboard.get(0);
22632303
22642304 if (content instanceof cGroup && ((cGroup)content).transientlink )
22652305 content = ((cGroup)content).get(0);
....@@ -2276,7 +2316,7 @@
22762316 {
22772317 RevertMeshes();
22782318 } else
2279
- if (source == resetMeshItem)
2319
+ if (source == resetAllItem)
22802320 {
22812321 ResetAll();
22822322 } else
....@@ -2614,9 +2654,13 @@
26142654 {
26152655 SmoothMesh();
26162656 } else
2617
- if (source == transformgeometryItem)
2657
+ if (source == transformGeometryItem)
26182658 {
26192659 TransformGeometry();
2660
+ } else
2661
+ if (source == transformChildrenItem)
2662
+ {
2663
+ TransformChildren();
26202664 } else
26212665 if (source == resetTransformItem)
26222666 {
....@@ -2624,7 +2668,11 @@
26242668 } else
26252669 if (source == resetCentroidItem)
26262670 {
2627
- ResetCentroid();
2671
+ ResetCentroid(true);
2672
+ } else
2673
+ if (source == resetCentroidXZItem)
2674
+ {
2675
+ ResetCentroid(false);
26282676 } else
26292677 if (source == resetParentItem)
26302678 {
....@@ -3066,7 +3114,9 @@
30663114 frontView.object = group;
30673115 sideView.object = group;
30683116 }
3069
- group.editWindow = this;
3117
+
3118
+// fix "+" issue group.editWindow = this;
3119
+
30703120 /*
30713121 currentLayout = radio.layout;
30723122 if (currentLayout == null)
....@@ -3079,7 +3129,20 @@
30793129 //group.attributes = -1;
30803130 ResetModel();
30813131 refreshContents(true);
3082
- }
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
+ }
30833146 else
30843147 {
30853148 //return super.action(event, arg);
....@@ -3140,6 +3203,28 @@
31403203 refreshContents();
31413204 }
31423205
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
+ }
31433228
31443229 void ResetTransform()
31453230 {
....@@ -3252,7 +3337,7 @@
32523337 refreshContents();
32533338 }
32543339
3255
- void ResetCentroid()
3340
+ void ResetCentroid(boolean full)
32563341 {
32573342 Object3D obj;
32583343 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3267,12 +3352,16 @@
32673352 LA.matIdentity(Object3D.mat);
32683353 obj.getBounds(minima, maxima, false);
32693354 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3270
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3355
+ if (full)
3356
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32713357 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32723358 obj.TransformMesh(Object3D.mat);
3359
+
32733360 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3274
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3361
+ if (full)
3362
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32753363 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3364
+
32763365 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32773366 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32783367 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3338,9 +3427,9 @@
33383427 obj = (Object3D)e.nextElement();
33393428
33403429 System.out.println("Object is: " + obj);
3341
- GrafreeD.AnalyzeObject(obj);
3430
+ Grafreed.AnalyzeObject(obj);
33423431 System.out.println("Boundary rep: " + obj.bRep);
3343
- GrafreeD.AnalyzeObject(obj.bRep);
3432
+ Grafreed.AnalyzeObject(obj.bRep);
33443433
33453434 // System.err.println((size/1024) + " KB is the size of " + obj);
33463435 }
....@@ -3554,8 +3643,8 @@
35543643
35553644 void ParseVertices()
35563645 {
3557
- boolean epsequal = GrafreeD.epsequal;
3558
- GrafreeD.epsequal = true;
3646
+ boolean epsequal = Grafreed.epsequal;
3647
+ Grafreed.epsequal = true;
35593648
35603649 for (int i=0; i<group.selection.size(); i++)
35613650 {
....@@ -3580,7 +3669,7 @@
35803669 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35813670 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35823671
3583
- g.add(GrafreeD.clipboard);
3672
+ g.add(Grafreed.clipboard);
35843673
35853674 buffer.add(g);
35863675 }
....@@ -3595,7 +3684,7 @@
35953684 makeSomething(buffer, i==group.selection.size()-1);
35963685 }
35973686
3598
- GrafreeD.epsequal = epsequal;
3687
+ Grafreed.epsequal = epsequal;
35993688
36003689 refreshContents();
36013690 }
....@@ -3613,7 +3702,16 @@
36133702 String pigment = Object3D.GetPigment(tex);
36143703 //String bump = Object3D.GetBump(tex);
36153704
3616
- 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
+ }
36173715
36183716 double s = v.s;
36193717
....@@ -3745,7 +3843,7 @@
37453843 return;
37463844
37473845 Object3D poses = group.selection.get(0);
3748
- Object3D ref = GrafreeD.clipboard.get(0);
3846
+ Object3D ref = Grafreed.clipboard.get(0);
37493847
37503848 Object3D newgroup = new Object3D("Po:" + poses.name);
37513849
....@@ -3939,9 +4037,9 @@
39394037
39404038 void ClipMesh()
39414039 {
3942
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4040
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39434041 {
3944
- Object3D content = GrafreeD.clipboard.get(0);
4042
+ Object3D content = Grafreed.clipboard.get(0);
39454043
39464044 if (content instanceof cGroup && ((cGroup)content).transientlink )
39474045 content = ((cGroup)content).get(0);
....@@ -3950,7 +4048,7 @@
39504048 // {
39514049 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39524050 // }
3953
- group.selection.ClipMesh(GrafreeD.clipboard);
4051
+ group.selection.ClipMesh(Grafreed.clipboard);
39544052 }
39554053 // group.selection.ClipMesh(GrafreeD.clipboard);
39564054 System.out.println("DONE.");
....@@ -4085,7 +4183,7 @@
40854183 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40864184
40874185 Object3D elem = (Object3D)group.selection.elementAt(i);
4088
- if(elem != group)
4186
+ if(elem != group || !newWindow)
40894187 {
40904188 // if (!(elem instanceof Composite))
40914189 // newWindow = false;
....@@ -4290,12 +4388,12 @@
42904388 {
42914389 if (group.selection.isEmpty())
42924390 return;
4293
- GrafreeD.clipboardIsTempGroup = false;
4391
+ Grafreed.clipboardIsTempGroup = false;
42944392 Composite tGroup = null;
42954393 if (group.selection.size() > 0) // 1)
42964394 {
42974395 tGroup = new cGroup();
4298
- GrafreeD.clipboardIsTempGroup = true;
4396
+ Grafreed.clipboardIsTempGroup = true;
42994397 }
43004398
43014399 if (cut)
....@@ -4335,16 +4433,16 @@
43354433 //System.out.println("cut " + child);
43364434 //System.out.println("parent = " + child.parent);
43374435 // tmp.addChild(child);
4338
- if (GrafreeD.clipboardIsTempGroup)
4436
+ if (Grafreed.clipboardIsTempGroup)
43394437 tGroup.add/*Child*/(tmp);
43404438 else
4341
- GrafreeD.clipboard = tmp;
4439
+ Grafreed.clipboard = tmp;
43424440 }
43434441 else
4344
- if (GrafreeD.clipboardIsTempGroup)
4442
+ if (Grafreed.clipboardIsTempGroup)
43454443 tGroup.add/*Child*/(child);
43464444 else
4347
- GrafreeD.clipboard = child;
4445
+ Grafreed.clipboard = child;
43484446 }
43494447
43504448 //ResetModel();
....@@ -4376,21 +4474,21 @@
43764474 //System.out.println("cut " + elem);
43774475 //System.out.println("parent = " + elem.parent);
43784476 // tmp.addChild(elem);
4379
- if (GrafreeD.clipboardIsTempGroup)
4477
+ if (Grafreed.clipboardIsTempGroup)
43804478 tGroup.add/*Child*/(tmp);
43814479 else
4382
- GrafreeD.clipboard = tmp;
4480
+ Grafreed.clipboard = tmp;
43834481 }
43844482 else
4385
- if (GrafreeD.clipboardIsTempGroup)
4483
+ if (Grafreed.clipboardIsTempGroup)
43864484 tGroup.add/*Child*/(child);
43874485 else
4388
- GrafreeD.clipboard = child;
4486
+ Grafreed.clipboard = child;
43894487 }
43904488
43914489 }
4392
- if (GrafreeD.clipboardIsTempGroup)
4393
- GrafreeD.clipboard = tGroup;
4490
+ if (Grafreed.clipboardIsTempGroup)
4491
+ Grafreed.clipboard = tGroup;
43944492 if (cut)
43954493 {
43964494 ResetModel();
....@@ -4404,7 +4502,7 @@
44044502 // return;
44054503 boolean first = true;
44064504
4407
- if (GrafreeD.clipboardIsTempGroup)
4505
+ if (Grafreed.clipboardIsTempGroup)
44084506 {
44094507 Composite temp;
44104508
....@@ -4415,7 +4513,7 @@
44154513 temp = (Composite)Applet3D.clipboard.deepCopy();
44164514 */
44174515 Object3D elem;
4418
- 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))
44194517 {
44204518 Object3D child = (Object3D)e.nextElement();
44214519
....@@ -4449,14 +4547,14 @@
44494547 //Object3D cb = Applet3D.clipboard;
44504548 //temp.addChild(cb);
44514549 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4452
- assert(GrafreeD.clipboard.parent == null);
4453
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4454
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4455
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4456
- 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());
44574555 else
4458
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4459
- GrafreeD.clipboard.get(0).parent = keepparent;
4556
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4557
+ Grafreed.clipboard.get(0).parent = keepparent;
44604558 }
44614559
44624560 ResetModel();
....@@ -4505,9 +4603,9 @@
45054603 {
45064604 boolean first = true;
45074605
4508
- if (GrafreeD.clipboardIsTempGroup)
4606
+ if (Grafreed.clipboardIsTempGroup)
45094607 {
4510
- Composite temp = (Composite)GrafreeD.clipboard;
4608
+ Composite temp = (Composite)Grafreed.clipboard;
45114609 Object3D copy;
45124610 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45134611 {
....@@ -4517,7 +4615,7 @@
45174615 }
45184616 } else
45194617 {
4520
- linkSomething(GrafreeD.clipboard); //.get(0));
4618
+ linkSomething(Grafreed.clipboard); //.get(0));
45214619 }
45224620 }
45234621 }
....@@ -4922,21 +5020,6 @@
49225020 }
49235021 */
49245022
4925
- void ImportGFD()
4926
- {
4927
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4928
- browser.show();
4929
- String filename = browser.getFile();
4930
- if (filename != null && filename.length() > 0)
4931
- {
4932
- String fullname = browser.getDirectory() + filename;
4933
-
4934
- //Object3D readobj =
4935
- objEditor.ReadGFD(fullname, objEditor);
4936
- //makeSomething(readobj);
4937
- }
4938
- }
4939
-
49405023 /*
49415024 public void Callback(Object obj)
49425025 {
....@@ -4960,26 +5043,9 @@
49605043 }
49615044 */
49625045
4963
- void ImportVRMLX3D()
4964
- {
4965
- if (GrafreeD.standAlone)
4966
- {
4967
- /**/
4968
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4969
- browser.show();
4970
- String filename = browser.getFile();
4971
- if (filename != null && filename.length() > 0)
4972
- {
4973
- String fullname = browser.getDirectory() + filename;
4974
- LoadVRMLX3D(fullname);
4975
- }
4976
- /**/
4977
- }
4978
- }
4979
-
49805046 String GetFile(String dialogName)
49815047 {
4982
- if (GrafreeD.standAlone)
5048
+ if (Grafreed.standAlone)
49835049 {
49845050 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49855051 browser.show();
....@@ -5092,7 +5158,7 @@
50925158 private MenuItem linkverticesItem;
50935159 private MenuItem relinkverticesItem;
50945160 private MenuItem setMasterItem;
5095
- private MenuItem resetMeshItem;
5161
+ private MenuItem resetAllItem;
50965162 private MenuItem stepAllItem;
50975163 private MenuItem revertMeshItem;
50985164 private MenuItem poseMeshItem;
....@@ -5153,8 +5219,10 @@
51535219 private MenuItem panoTexturesItem;
51545220
51555221 private MenuItem resetCentroidItem;
5156
- private MenuItem transformgeometryItem;
5222
+ private MenuItem resetCentroidXZItem;
51575223 private MenuItem resetTransformItem;
5224
+ private MenuItem transformGeometryItem;
5225
+ private MenuItem transformChildrenItem;
51585226 private MenuItem hideItem;
51595227 private MenuItem grabItem;
51605228 private MenuItem backItem;
....@@ -5223,11 +5291,6 @@
52235291 private MenuItem doubleItem;
52245292 private MenuItem tripleItem;
52255293
5226
- private MenuItem importGFDItem;
5227
- private MenuItem importVRMLX3DItem;
5228
- private MenuItem import3DSItem;
5229
- private MenuItem importOBJItem;
5230
-
52315294 private MenuItem computeAOItem;
52325295 private MenuItem recompileItem;
52335296 private MenuItem editScriptItem;
....@@ -5237,4 +5300,8 @@
52375300 private MenuItem analyzeItem;
52385301 private MenuItem dumpItem;
52395302 //boolean freezemodel = false;
5303
+
5304
+ Menu cameraMenu;
5305
+ MenuItem editCameraItem;
5306
+ MenuItem revertCameraItem;
52405307 }