Normand Briere
2019-06-11 5e6a6f3319f0c4c687fe71952ac9ecc17792b83a
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -98,14 +98,14 @@
9898
9999 void CloneClipboard(boolean supports)
100100 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
101
+ assert(Grafreed.clipboard.parent == null);
102
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
103
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
104
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
105
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106106 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
109109 }
110110
111111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +119,7 @@
119119 // obj.support = null;
120120 if (!supports)
121121 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123123 obj.parent = parent;
124124 // obj.support = support;
125125 // clone.support = support; // aout 2013
....@@ -148,27 +148,17 @@
148148
149149 //JTextField nameField;
150150
151
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
152152 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
168153 Menu menu;
169154 oe.menuBar.add(menu = new Menu("Edit"));
170155 //editItem = menu.add(new MenuItem("Edit"));
171156 //editItem.addActionListener(this);
157
+ undoItem = menu.add(new MenuItem("Undo"));
158
+ undoItem.addActionListener(this);
159
+ redoItem = menu.add(new MenuItem("Redo"));
160
+ redoItem.addActionListener(this);
161
+ menu.add("-");
172162 duplicateItem = menu.add(new MenuItem("Duplicate"));
173163 duplicateItem.addActionListener(this);
174164 cloneItem = menu.add(new MenuItem("Clone"));
....@@ -206,14 +196,97 @@
206196 clearAllItem = menu.add(new MenuItem("Clear All"));
207197 clearAllItem.addActionListener(this);
208198 }
199
+
200
+ menuBar.add(cameraMenu = new Menu("View"));
201
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
202
+ //zBufferItem.addActionListener(this);
203
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204
+ //normalLensItem.addActionListener(this);
205
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
206
+ revertCameraItem.addActionListener(this);
207
+
208
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
+ toggleFullScreenItem.addItemListener(this);
210
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
+ cameraMenu.add("-");
212
+
213
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
+ toggleTextureItem.addItemListener(this);
215
+ toggleTextureItem.setState(CameraPane.textureon);
216
+
217
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
+ toggleSwitchItem.addItemListener(this);
219
+ toggleSwitchItem.setState(CameraPane.SWITCH);
220
+
221
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
222
+ toggleHandleItem.addItemListener(this);
223
+ toggleHandleItem.setState(CameraPane.HANDLES);
224
+
225
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
226
+ togglePaintItem.addItemListener(this);
227
+ togglePaintItem.setState(CameraPane.PAINTMODE);
228
+
229
+ if (Globals.ADVANCED)
230
+ {
231
+ cameraMenu.add("-");
232
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
233
+ toggleLiveItem.addItemListener(this);
234
+ toggleLiveItem.setState(Globals.isLIVE());
209235
236
+ cameraMenu.add(stepItem = new MenuItem("Step"));
237
+ stepItem.addActionListener(this);
238
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
239
+ // toggleDLItem.addItemListener(this);
240
+ // toggleDLItem.setState(false);
241
+
242
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
243
+ toggleRenderItem.addItemListener(this);
244
+ toggleRenderItem.setState(!CameraPane.frozen);
245
+
246
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247
+ toggleDebugItem.addItemListener(this);
248
+ toggleDebugItem.setState(CameraPane.DEBUG);
249
+
250
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251
+ toggleFrustumItem.addItemListener(this);
252
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
253
+
254
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
255
+ toggleFootContactItem.addItemListener(this);
256
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
257
+
258
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
259
+ toggleTimelineItem.addItemListener(this);
260
+ }
261
+
262
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
263
+// toggleRootItem.addItemListener(this);
264
+// toggleRootItem.setState(false);
265
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
266
+// animationItem.addItemListener(this);
267
+// animationItem.setState(CameraPane.ANIMATION);
268
+ cameraMenu.add("-");
269
+ cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
270
+ editCameraItem.addActionListener(this);
271
+
272
+ if (Globals.ADVANCED)
273
+ {
274
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
+ //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
277
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278
+ oe.cameraMenu.add("-");
279
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
280
+ openWindowItem.addActionListener(this);
281
+ editLeafItem.addActionListener(this);
282
+ lookAtItem.addActionListener(this);
283
+ //lookFromItem.addActinoListener(this);
284
+ //switchItem.addActionListener(this);
285
+ }
286
+
210287 oe.menuBar.add(menu = new Menu("Setting"));
211288 if (Globals.ADVANCED)
212289 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217290 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218291 revertMeshItem.addActionListener(this);
219292 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -318,8 +391,12 @@
318391 resetTransformItem.addActionListener(this);
319392 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320393 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
394
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
395
+ resetCentroidXZItem.addActionListener(this);
396
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
397
+ transformGeometryItem.addActionListener(this);
398
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
399
+ transformChildrenItem.addActionListener(this);
323400
324401 oe.menuBar.add(menu = new Menu("Geometry"));
325402 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -368,6 +445,10 @@
368445 oe.menuBar.add(menu = new Menu("Attributes"));
369446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370447 clearMaterialsItem.addActionListener(this);
448
+ resetAllItem = menu.add(new MenuItem("Reset All"));
449
+ resetAllItem.addActionListener(this);
450
+ stepAllItem = menu.add(new MenuItem("Step All"));
451
+ stepAllItem.addActionListener(this);
371452 menu.add("-");
372453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373454 liveleavesItem.addActionListener(this);
....@@ -422,35 +503,23 @@
422503 sortbysizeItem.addActionListener(this);
423504 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424505 sortbynameItem.addActionListener(this);
506
+ menu.add("-");
507
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
508
+ shareGeometriesItem.addActionListener(this);
509
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
510
+ mergeGeometriesItem.addActionListener(this);
425511 if (Globals.ADVANCED)
426512 {
427
- menu.add("-");
513
+ // Pretty much the same as duplicate and clone.
428514 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429515 extractGeometriesItem.addActionListener(this);
430516 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431517 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);
436518 }
437519
438520 oe.menuBar.add(menu = new Menu("Insert"));
439521 buildCreateMenu(menu);
440522
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
-
454523 oe.menuBar.add(menu = new Menu("Tools"));
455524 buildToolsMenu(menu);
456525 }
....@@ -488,10 +557,10 @@
488557 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
489558
490559 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
- liveCB.setToolTipText("Enabled animation");
560
+ liveCB.setToolTipText("Enable animation");
492561 liveCB.addItemListener(this);
493562
494
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
563
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495564 oneStepButton.setToolTipText("Animate one step forward");
496565 oneStepButton.addActionListener(this);
497566
....@@ -503,7 +572,7 @@
503572 trackCB.setToolTipText("Enable tracking");
504573 trackCB.addItemListener(this);
505574
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
575
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
507576 screenfitButton.setToolTipText("Screen fit");
508577 screenfitButton.addActionListener(this);
509578
....@@ -512,39 +581,39 @@
512581
513582 if (Globals.ADVANCED)
514583 {
515
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
584
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516585 snapobjectButton.addActionListener(this);
517586 snapobjectButton.setToolTipText("Snap Object");
518587 }
519588
520
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
589
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521590 flashSelectionButton.setToolTipText("Show selection");
522591 flashSelectionButton.addActionListener(this);
523592
524593 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525594
526
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
595
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527596 twoButton.setToolTipText("Show center view only");
528597 twoButton.addActionListener(this);
529
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
598
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530599 fourButton.addActionListener(this);
531600 fourButton.setToolTipText("Show left panel only");
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
601
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533602 sixButton.setToolTipText("2-column layout left");
534603 sixButton.addActionListener(this);
535
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
604
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536605 threeButton.setToolTipText("2-column layout right");
537606 threeButton.addActionListener(this);
538
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
539608 sevenButton.setToolTipText("3-column layout");
540609 sevenButton.addActionListener(this);
541610 //
542611
543
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
612
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544613 rootButton.setToolTipText("Edit selection in new tab");
545614 rootButton.addActionListener(this);
546615
547
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
616
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
548617 closeButton.setToolTipText("Close tab");
549618 closeButton.addActionListener(this);
550619 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -552,11 +621,11 @@
552621
553622 cGridBag commandsPanel = new cGridBag();
554623
555
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
624
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
556625 editButton.setToolTipText("Edit selection");
557626 editButton.addActionListener(this);
558627
559
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
628
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
560629 uneditButton.setToolTipText("Unedit selection");
561630 uneditButton.addActionListener(this);
562631
....@@ -564,11 +633,11 @@
564633 allParamsButton.setToolTipText("Edit all params");
565634 allParamsButton.addActionListener(this);
566635
567
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
636
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
568637 clearPanelButton.setToolTipText("Clear edit panel");
569638 clearPanelButton.addActionListener(this);
570639
571
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
640
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
572641 unselectButton.setToolTipText("Unselect");
573642 unselectButton.addActionListener(this);
574643
....@@ -651,7 +720,7 @@
651720 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
652721 zoomBoxCB.addItemListener(this);
653722
654
- if (Globals.ADVANCED)
723
+ if (true) // Globals.ADVANCED)
655724 {
656725 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657726 supportCB.setToolTipText("Enable rigging");
....@@ -724,6 +793,7 @@
724793 buttonGroup.add(radioButton);
725794 radioButton.doClick();
726795 }
796
+
727797 void SetupViews(ObjEditor oe)
728798 {
729799 oe.SetupViews();
....@@ -969,7 +1039,7 @@
9691039
9701040 flashIt = false;
9711041 CameraPane pane = (CameraPane) target;
972
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1042
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9731043 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9741044
9751045 if (group.selection.size() == 1)
....@@ -1542,9 +1612,9 @@
15421612
15431613 void Overwrite(int mask)
15441614 {
1545
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1615
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15461616 {
1547
- Object3D content = GrafreeD.clipboard.get(0);
1617
+ Object3D content = Grafreed.clipboard.get(0);
15481618
15491619 if (content instanceof cGroup && ((cGroup)content).transientlink )
15501620 content = ((cGroup)content).get(0);
....@@ -1849,31 +1919,6 @@
18491919 csg.addChild(child);
18501920 child.addChild(csg);
18511921 } 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
18771922 if (source == computeAOItem)
18781923 {
18791924 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1892,7 +1937,7 @@
18921937 if (source == invariantsItem)
18931938 {
18941939 System.out.println("Invariants:");
1895
- GrafreeD.grafreeD.universe.invariants();
1940
+ Grafreed.grafreeD.universe.invariants();
18961941 } else
18971942 if (source == memoryItem)
18981943 {
....@@ -1965,12 +2010,20 @@
19652010 {
19662011 loadClipboard(true);
19672012 } else
2013
+ if (source == undoItem)
2014
+ {
2015
+ Undo();
2016
+ } else
2017
+ if (source == redoItem)
2018
+ {
2019
+ Redo();
2020
+ } else
19682021 if (source == duplicateItem)
19692022 {
1970
- Object3D keep = GrafreeD.clipboard;
2023
+ Object3D keep = Grafreed.clipboard;
19712024 loadClipboard(false);
19722025 paste(false);
1973
- GrafreeD.clipboard = keep;
2026
+ Grafreed.clipboard = keep;
19742027 } else
19752028 if (source == cloneItem)
19762029 {
....@@ -2190,9 +2243,9 @@
21902243 // group.selection.get(0).setMasterThis(content); // should be identity
21912244 // refreshContents();
21922245 // }
2193
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2246
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21942247 {
2195
- Object3D content = GrafreeD.clipboard.get(0);
2248
+ Object3D content = Grafreed.clipboard.get(0);
21962249
21972250 if (content instanceof cGroup && ((cGroup)content).transientlink )
21982251 content = ((cGroup)content).get(0);
....@@ -2242,9 +2295,9 @@
22422295 } else
22432296 if (source == setMasterItem)
22442297 {
2245
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2298
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22462299 {
2247
- Object3D content = GrafreeD.clipboard.get(0);
2300
+ Object3D content = Grafreed.clipboard.get(0);
22482301
22492302 if (content instanceof cGroup && ((cGroup)content).transientlink )
22502303 content = ((cGroup)content).get(0);
....@@ -2257,9 +2310,9 @@
22572310 {
22582311 if (group.selection.size() == 1)
22592312 {
2260
- if (GrafreeD.clipboard.size() == 1)
2313
+ if (Grafreed.clipboard.size() == 1)
22612314 {
2262
- Object3D content = GrafreeD.clipboard.get(0);
2315
+ Object3D content = Grafreed.clipboard.get(0);
22632316
22642317 if (content instanceof cGroup && ((cGroup)content).transientlink )
22652318 content = ((cGroup)content).get(0);
....@@ -2276,7 +2329,7 @@
22762329 {
22772330 RevertMeshes();
22782331 } else
2279
- if (source == resetMeshItem)
2332
+ if (source == resetAllItem)
22802333 {
22812334 ResetAll();
22822335 } else
....@@ -2614,9 +2667,13 @@
26142667 {
26152668 SmoothMesh();
26162669 } else
2617
- if (source == transformgeometryItem)
2670
+ if (source == transformGeometryItem)
26182671 {
26192672 TransformGeometry();
2673
+ } else
2674
+ if (source == transformChildrenItem)
2675
+ {
2676
+ TransformChildren();
26202677 } else
26212678 if (source == resetTransformItem)
26222679 {
....@@ -2624,7 +2681,11 @@
26242681 } else
26252682 if (source == resetCentroidItem)
26262683 {
2627
- ResetCentroid();
2684
+ ResetCentroid(true);
2685
+ } else
2686
+ if (source == resetCentroidXZItem)
2687
+ {
2688
+ ResetCentroid(false);
26282689 } else
26292690 if (source == resetParentItem)
26302691 {
....@@ -2980,7 +3041,7 @@
29803041 child.CloseUI();
29813042 listUI.remove(child);
29823043
2983
- child.editWindow = null; // ???????????
3044
+ //child.editWindow = null; // ???????????
29843045 }
29853046 objEditor.ctrlPanel.FlushUI();
29863047 //objEditor.jTree.clearSelection();
....@@ -3066,7 +3127,9 @@
30663127 frontView.object = group;
30673128 sideView.object = group;
30683129 }
3069
- group.editWindow = this;
3130
+
3131
+// fix "+" issue group.editWindow = this;
3132
+
30703133 /*
30713134 currentLayout = radio.layout;
30723135 if (currentLayout == null)
....@@ -3079,7 +3142,20 @@
30793142 //group.attributes = -1;
30803143 ResetModel();
30813144 refreshContents(true);
3082
- }
3145
+ } else if (event.getSource() == editCameraItem)
3146
+ {
3147
+ cameraView.ProtectCamera();
3148
+ cameraView.repaint();
3149
+ return;
3150
+ } else if (event.getSource() == revertCameraItem)
3151
+ {
3152
+ cameraView.RevertCamera();
3153
+ cameraView.repaint();
3154
+ return;
3155
+ // } else if (event.getSource() == textureButton)
3156
+ // {
3157
+ // return; // true;
3158
+ }
30833159 else
30843160 {
30853161 //return super.action(event, arg);
....@@ -3140,6 +3216,28 @@
31403216 refreshContents();
31413217 }
31423218
3219
+ void TransformChildren()
3220
+ {
3221
+ Object3D obj;
3222
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3223
+ {
3224
+ obj = (Object3D)e.nextElement();
3225
+ obj.KeepTextureMatrices();
3226
+ obj.TransformChildren();
3227
+ obj.RestoreTextureMatrices();
3228
+
3229
+// if (obj.parent == null)
3230
+// {
3231
+// System.out.println("NULL PARENT!");
3232
+// new Exception().printStackTrace();
3233
+// }
3234
+// else
3235
+// TouchTransform(obj);
3236
+// //obj.parent.Touch();
3237
+ }
3238
+
3239
+ refreshContents();
3240
+ }
31433241
31443242 void ResetTransform()
31453243 {
....@@ -3252,7 +3350,7 @@
32523350 refreshContents();
32533351 }
32543352
3255
- void ResetCentroid()
3353
+ void ResetCentroid(boolean full)
32563354 {
32573355 Object3D obj;
32583356 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3267,12 +3365,16 @@
32673365 LA.matIdentity(Object3D.mat);
32683366 obj.getBounds(minima, maxima, false);
32693367 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3270
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3368
+ if (full)
3369
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32713370 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32723371 obj.TransformMesh(Object3D.mat);
3372
+
32733373 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3274
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3374
+ if (full)
3375
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32753376 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3377
+
32763378 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32773379 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32783380 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3338,9 +3440,9 @@
33383440 obj = (Object3D)e.nextElement();
33393441
33403442 System.out.println("Object is: " + obj);
3341
- GrafreeD.AnalyzeObject(obj);
3443
+ Grafreed.AnalyzeObject(obj);
33423444 System.out.println("Boundary rep: " + obj.bRep);
3343
- GrafreeD.AnalyzeObject(obj.bRep);
3445
+ Grafreed.AnalyzeObject(obj.bRep);
33443446
33453447 // System.err.println((size/1024) + " KB is the size of " + obj);
33463448 }
....@@ -3554,8 +3656,8 @@
35543656
35553657 void ParseVertices()
35563658 {
3557
- boolean epsequal = GrafreeD.epsequal;
3558
- GrafreeD.epsequal = true;
3659
+ boolean epsequal = Grafreed.epsequal;
3660
+ Grafreed.epsequal = true;
35593661
35603662 for (int i=0; i<group.selection.size(); i++)
35613663 {
....@@ -3580,7 +3682,7 @@
35803682 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35813683 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35823684
3583
- g.add(GrafreeD.clipboard);
3685
+ g.add(Grafreed.clipboard);
35843686
35853687 buffer.add(g);
35863688 }
....@@ -3595,7 +3697,7 @@
35953697 makeSomething(buffer, i==group.selection.size()-1);
35963698 }
35973699
3598
- GrafreeD.epsequal = epsequal;
3700
+ Grafreed.epsequal = epsequal;
35993701
36003702 refreshContents();
36013703 }
....@@ -3613,7 +3715,16 @@
36133715 String pigment = Object3D.GetPigment(tex);
36143716 //String bump = Object3D.GetBump(tex);
36153717
3616
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3718
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3719
+
3720
+ try
3721
+ {
3722
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3723
+ }
3724
+ catch (Exception e)
3725
+ {
3726
+ System.err.println("FAIL: " + node);
3727
+ }
36173728
36183729 double s = v.s;
36193730
....@@ -3745,7 +3856,7 @@
37453856 return;
37463857
37473858 Object3D poses = group.selection.get(0);
3748
- Object3D ref = GrafreeD.clipboard.get(0);
3859
+ Object3D ref = Grafreed.clipboard.get(0);
37493860
37503861 Object3D newgroup = new Object3D("Po:" + poses.name);
37513862
....@@ -3939,9 +4050,9 @@
39394050
39404051 void ClipMesh()
39414052 {
3942
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4053
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39434054 {
3944
- Object3D content = GrafreeD.clipboard.get(0);
4055
+ Object3D content = Grafreed.clipboard.get(0);
39454056
39464057 if (content instanceof cGroup && ((cGroup)content).transientlink )
39474058 content = ((cGroup)content).get(0);
....@@ -3950,7 +4061,7 @@
39504061 // {
39514062 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39524063 // }
3953
- group.selection.ClipMesh(GrafreeD.clipboard);
4064
+ group.selection.ClipMesh(Grafreed.clipboard);
39544065 }
39554066 // group.selection.ClipMesh(GrafreeD.clipboard);
39564067 System.out.println("DONE.");
....@@ -4085,7 +4196,7 @@
40854196 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40864197
40874198 Object3D elem = (Object3D)group.selection.elementAt(i);
4088
- if(elem != group)
4199
+ if(elem != group || !newWindow)
40894200 {
40904201 // if (!(elem instanceof Composite))
40914202 // newWindow = false;
....@@ -4199,14 +4310,17 @@
41994310
42004311 objEditor.SetText(); // jan 2014
42014312
4202
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4313
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42034314 CameraPane.flash = true;
42044315
4205
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4316
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42064317 // a camera
42074318 {
4208
- CameraPane.camerachangeframe = 0; // don't refuse it
4209
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4319
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4320
+ {
4321
+ CameraPane.camerachangeframe = 0; // don't refuse it
4322
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4323
+ }
42104324 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42114325 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42124326 }
....@@ -4290,12 +4404,12 @@
42904404 {
42914405 if (group.selection.isEmpty())
42924406 return;
4293
- GrafreeD.clipboardIsTempGroup = false;
4407
+ Grafreed.clipboardIsTempGroup = false;
42944408 Composite tGroup = null;
42954409 if (group.selection.size() > 0) // 1)
42964410 {
42974411 tGroup = new cGroup();
4298
- GrafreeD.clipboardIsTempGroup = true;
4412
+ Grafreed.clipboardIsTempGroup = true;
42994413 }
43004414
43014415 if (cut)
....@@ -4335,16 +4449,16 @@
43354449 //System.out.println("cut " + child);
43364450 //System.out.println("parent = " + child.parent);
43374451 // tmp.addChild(child);
4338
- if (GrafreeD.clipboardIsTempGroup)
4452
+ if (Grafreed.clipboardIsTempGroup)
43394453 tGroup.add/*Child*/(tmp);
43404454 else
4341
- GrafreeD.clipboard = tmp;
4455
+ Grafreed.clipboard = tmp;
43424456 }
43434457 else
4344
- if (GrafreeD.clipboardIsTempGroup)
4458
+ if (Grafreed.clipboardIsTempGroup)
43454459 tGroup.add/*Child*/(child);
43464460 else
4347
- GrafreeD.clipboard = child;
4461
+ Grafreed.clipboard = child;
43484462 }
43494463
43504464 //ResetModel();
....@@ -4376,21 +4490,21 @@
43764490 //System.out.println("cut " + elem);
43774491 //System.out.println("parent = " + elem.parent);
43784492 // tmp.addChild(elem);
4379
- if (GrafreeD.clipboardIsTempGroup)
4493
+ if (Grafreed.clipboardIsTempGroup)
43804494 tGroup.add/*Child*/(tmp);
43814495 else
4382
- GrafreeD.clipboard = tmp;
4496
+ Grafreed.clipboard = tmp;
43834497 }
43844498 else
4385
- if (GrafreeD.clipboardIsTempGroup)
4499
+ if (Grafreed.clipboardIsTempGroup)
43864500 tGroup.add/*Child*/(child);
43874501 else
4388
- GrafreeD.clipboard = child;
4502
+ Grafreed.clipboard = child;
43894503 }
43904504
43914505 }
4392
- if (GrafreeD.clipboardIsTempGroup)
4393
- GrafreeD.clipboard = tGroup;
4506
+ if (Grafreed.clipboardIsTempGroup)
4507
+ Grafreed.clipboard = tGroup;
43944508 if (cut)
43954509 {
43964510 ResetModel();
....@@ -4404,7 +4518,7 @@
44044518 // return;
44054519 boolean first = true;
44064520
4407
- if (GrafreeD.clipboardIsTempGroup)
4521
+ if (Grafreed.clipboardIsTempGroup)
44084522 {
44094523 Composite temp;
44104524
....@@ -4415,7 +4529,7 @@
44154529 temp = (Composite)Applet3D.clipboard.deepCopy();
44164530 */
44174531 Object3D elem;
4418
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4532
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44194533 {
44204534 Object3D child = (Object3D)e.nextElement();
44214535
....@@ -4449,14 +4563,14 @@
44494563 //Object3D cb = Applet3D.clipboard;
44504564 //temp.addChild(cb);
44514565 //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());
4566
+ assert(Grafreed.clipboard.parent == null);
4567
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4568
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4569
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4570
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44574571 else
4458
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4459
- GrafreeD.clipboard.get(0).parent = keepparent;
4572
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4573
+ Grafreed.clipboard.get(0).parent = keepparent;
44604574 }
44614575
44624576 ResetModel();
....@@ -4505,9 +4619,9 @@
45054619 {
45064620 boolean first = true;
45074621
4508
- if (GrafreeD.clipboardIsTempGroup)
4622
+ if (Grafreed.clipboardIsTempGroup)
45094623 {
4510
- Composite temp = (Composite)GrafreeD.clipboard;
4624
+ Composite temp = (Composite)Grafreed.clipboard;
45114625 Object3D copy;
45124626 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45134627 {
....@@ -4517,7 +4631,7 @@
45174631 }
45184632 } else
45194633 {
4520
- linkSomething(GrafreeD.clipboard); //.get(0));
4634
+ linkSomething(Grafreed.clipboard); //.get(0));
45214635 }
45224636 }
45234637 }
....@@ -4922,21 +5036,6 @@
49225036 }
49235037 */
49245038
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
-
49405039 /*
49415040 public void Callback(Object obj)
49425041 {
....@@ -4960,26 +5059,9 @@
49605059 }
49615060 */
49625061
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
-
49805062 String GetFile(String dialogName)
49815063 {
4982
- if (GrafreeD.standAlone)
5064
+ if (Grafreed.standAlone)
49835065 {
49845066 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49855067 browser.show();
....@@ -5079,6 +5161,8 @@
50795161 private MenuItem lookFromItem;
50805162 private MenuItem switchItem;
50815163 private MenuItem cutItem;
5164
+ private MenuItem undoItem;
5165
+ private MenuItem redoItem;
50825166 private MenuItem duplicateItem;
50835167 private MenuItem cloneItem;
50845168 private MenuItem cloneSupportItem;
....@@ -5092,7 +5176,7 @@
50925176 private MenuItem linkverticesItem;
50935177 private MenuItem relinkverticesItem;
50945178 private MenuItem setMasterItem;
5095
- private MenuItem resetMeshItem;
5179
+ private MenuItem resetAllItem;
50965180 private MenuItem stepAllItem;
50975181 private MenuItem revertMeshItem;
50985182 private MenuItem poseMeshItem;
....@@ -5153,8 +5237,10 @@
51535237 private MenuItem panoTexturesItem;
51545238
51555239 private MenuItem resetCentroidItem;
5156
- private MenuItem transformgeometryItem;
5240
+ private MenuItem resetCentroidXZItem;
51575241 private MenuItem resetTransformItem;
5242
+ private MenuItem transformGeometryItem;
5243
+ private MenuItem transformChildrenItem;
51585244 private MenuItem hideItem;
51595245 private MenuItem grabItem;
51605246 private MenuItem backItem;
....@@ -5223,11 +5309,6 @@
52235309 private MenuItem doubleItem;
52245310 private MenuItem tripleItem;
52255311
5226
- private MenuItem importGFDItem;
5227
- private MenuItem importVRMLX3DItem;
5228
- private MenuItem import3DSItem;
5229
- private MenuItem importOBJItem;
5230
-
52315312 private MenuItem computeAOItem;
52325313 private MenuItem recompileItem;
52335314 private MenuItem editScriptItem;
....@@ -5237,4 +5318,8 @@
52375318 private MenuItem analyzeItem;
52385319 private MenuItem dumpItem;
52395320 //boolean freezemodel = false;
5321
+
5322
+ Menu cameraMenu;
5323
+ MenuItem editCameraItem;
5324
+ MenuItem revertCameraItem;
52405325 }