Normand Briere
2019-06-09 8558ae86e65457c512a26339d3660d79eee16ae6
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,32 +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
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
443
- importGFDItem.addActionListener(this);
444
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
445
- importVRMLX3DItem.addActionListener(this);
446
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
447
- importOBJItem.addActionListener(this);
448
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
449
- import3DSItem.addActionListener(this);
450
-
451523 oe.menuBar.add(menu = new Menu("Tools"));
452524 buildToolsMenu(menu);
453525 }
....@@ -485,10 +557,10 @@
485557 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
486558
487559 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
488
- liveCB.setToolTipText("Enabled animation");
560
+ liveCB.setToolTipText("Enable animation");
489561 liveCB.addItemListener(this);
490562
491
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
563
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
492564 oneStepButton.setToolTipText("Animate one step forward");
493565 oneStepButton.addActionListener(this);
494566
....@@ -500,7 +572,7 @@
500572 trackCB.setToolTipText("Enable tracking");
501573 trackCB.addItemListener(this);
502574
503
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
575
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504576 screenfitButton.setToolTipText("Screen fit");
505577 screenfitButton.addActionListener(this);
506578
....@@ -509,39 +581,39 @@
509581
510582 if (Globals.ADVANCED)
511583 {
512
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
584
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
513585 snapobjectButton.addActionListener(this);
514586 snapobjectButton.setToolTipText("Snap Object");
515587 }
516588
517
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
589
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
518590 flashSelectionButton.setToolTipText("Show selection");
519591 flashSelectionButton.addActionListener(this);
520592
521593 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
522594
523
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
595
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
524596 twoButton.setToolTipText("Show center view only");
525597 twoButton.addActionListener(this);
526
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
598
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527599 fourButton.addActionListener(this);
528600 fourButton.setToolTipText("Show left panel only");
529
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
601
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530602 sixButton.setToolTipText("2-column layout left");
531603 sixButton.addActionListener(this);
532
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
604
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533605 threeButton.setToolTipText("2-column layout right");
534606 threeButton.addActionListener(this);
535
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536608 sevenButton.setToolTipText("3-column layout");
537609 sevenButton.addActionListener(this);
538610 //
539611
540
- 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);
541613 rootButton.setToolTipText("Edit selection in new tab");
542614 rootButton.addActionListener(this);
543615
544
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
616
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
545617 closeButton.setToolTipText("Close tab");
546618 closeButton.addActionListener(this);
547619 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -549,11 +621,11 @@
549621
550622 cGridBag commandsPanel = new cGridBag();
551623
552
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
624
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553625 editButton.setToolTipText("Edit selection");
554626 editButton.addActionListener(this);
555627
556
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
628
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
557629 uneditButton.setToolTipText("Unedit selection");
558630 uneditButton.addActionListener(this);
559631
....@@ -561,11 +633,11 @@
561633 allParamsButton.setToolTipText("Edit all params");
562634 allParamsButton.addActionListener(this);
563635
564
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
636
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565637 clearPanelButton.setToolTipText("Clear edit panel");
566638 clearPanelButton.addActionListener(this);
567639
568
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
640
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569641 unselectButton.setToolTipText("Unselect");
570642 unselectButton.addActionListener(this);
571643
....@@ -648,7 +720,7 @@
648720 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
649721 zoomBoxCB.addItemListener(this);
650722
651
- if (Globals.ADVANCED)
723
+ if (true) // Globals.ADVANCED)
652724 {
653725 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
654726 supportCB.setToolTipText("Enable rigging");
....@@ -721,6 +793,7 @@
721793 buttonGroup.add(radioButton);
722794 radioButton.doClick();
723795 }
796
+
724797 void SetupViews(ObjEditor oe)
725798 {
726799 oe.SetupViews();
....@@ -937,7 +1010,9 @@
9371010 // objEditor.DropFile((java.io.File[]) object, true);
9381011 // return;
9391012 // }
940
- if (string.charAt(0) == '/')
1013
+
1014
+ // File path for Mac and Windows
1015
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9411016 {
9421017 // file(s)
9431018 String[] names = string.split("\n");
....@@ -964,7 +1039,7 @@
9641039
9651040 flashIt = false;
9661041 CameraPane pane = (CameraPane) target;
967
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1042
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9681043 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9691044
9701045 if (group.selection.size() == 1)
....@@ -1537,9 +1612,9 @@
15371612
15381613 void Overwrite(int mask)
15391614 {
1540
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1615
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15411616 {
1542
- Object3D content = GrafreeD.clipboard.get(0);
1617
+ Object3D content = Grafreed.clipboard.get(0);
15431618
15441619 if (content instanceof cGroup && ((cGroup)content).transientlink )
15451620 content = ((cGroup)content).get(0);
....@@ -1844,23 +1919,6 @@
18441919 csg.addChild(child);
18451920 child.addChild(csg);
18461921 } else
1847
-
1848
- if (source == importGFDItem)
1849
- {
1850
- ImportGFD();
1851
- } else
1852
- if (source == importVRMLX3DItem)
1853
- {
1854
- ImportVRMLX3D();
1855
- } else
1856
- if (source == import3DSItem)
1857
- {
1858
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1859
- } else
1860
- if (source == importOBJItem)
1861
- {
1862
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1863
- } else
18641922 if (source == computeAOItem)
18651923 {
18661924 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1879,7 +1937,7 @@
18791937 if (source == invariantsItem)
18801938 {
18811939 System.out.println("Invariants:");
1882
- GrafreeD.grafreeD.universe.invariants();
1940
+ Grafreed.grafreeD.universe.invariants();
18831941 } else
18841942 if (source == memoryItem)
18851943 {
....@@ -1952,12 +2010,20 @@
19522010 {
19532011 loadClipboard(true);
19542012 } else
2013
+ if (source == undoItem)
2014
+ {
2015
+ Undo();
2016
+ } else
2017
+ if (source == redoItem)
2018
+ {
2019
+ Redo();
2020
+ } else
19552021 if (source == duplicateItem)
19562022 {
1957
- Object3D keep = GrafreeD.clipboard;
2023
+ Object3D keep = Grafreed.clipboard;
19582024 loadClipboard(false);
19592025 paste(false);
1960
- GrafreeD.clipboard = keep;
2026
+ Grafreed.clipboard = keep;
19612027 } else
19622028 if (source == cloneItem)
19632029 {
....@@ -2177,9 +2243,9 @@
21772243 // group.selection.get(0).setMasterThis(content); // should be identity
21782244 // refreshContents();
21792245 // }
2180
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2246
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21812247 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2248
+ Object3D content = Grafreed.clipboard.get(0);
21832249
21842250 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852251 content = ((cGroup)content).get(0);
....@@ -2229,9 +2295,9 @@
22292295 } else
22302296 if (source == setMasterItem)
22312297 {
2232
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2298
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22332299 {
2234
- Object3D content = GrafreeD.clipboard.get(0);
2300
+ Object3D content = Grafreed.clipboard.get(0);
22352301
22362302 if (content instanceof cGroup && ((cGroup)content).transientlink )
22372303 content = ((cGroup)content).get(0);
....@@ -2244,9 +2310,9 @@
22442310 {
22452311 if (group.selection.size() == 1)
22462312 {
2247
- if (GrafreeD.clipboard.size() == 1)
2313
+ if (Grafreed.clipboard.size() == 1)
22482314 {
2249
- Object3D content = GrafreeD.clipboard.get(0);
2315
+ Object3D content = Grafreed.clipboard.get(0);
22502316
22512317 if (content instanceof cGroup && ((cGroup)content).transientlink )
22522318 content = ((cGroup)content).get(0);
....@@ -2263,7 +2329,7 @@
22632329 {
22642330 RevertMeshes();
22652331 } else
2266
- if (source == resetMeshItem)
2332
+ if (source == resetAllItem)
22672333 {
22682334 ResetAll();
22692335 } else
....@@ -2601,9 +2667,13 @@
26012667 {
26022668 SmoothMesh();
26032669 } else
2604
- if (source == transformgeometryItem)
2670
+ if (source == transformGeometryItem)
26052671 {
26062672 TransformGeometry();
2673
+ } else
2674
+ if (source == transformChildrenItem)
2675
+ {
2676
+ TransformChildren();
26072677 } else
26082678 if (source == resetTransformItem)
26092679 {
....@@ -2611,7 +2681,11 @@
26112681 } else
26122682 if (source == resetCentroidItem)
26132683 {
2614
- ResetCentroid();
2684
+ ResetCentroid(true);
2685
+ } else
2686
+ if (source == resetCentroidXZItem)
2687
+ {
2688
+ ResetCentroid(false);
26152689 } else
26162690 if (source == resetParentItem)
26172691 {
....@@ -2967,7 +3041,7 @@
29673041 child.CloseUI();
29683042 listUI.remove(child);
29693043
2970
- child.editWindow = null; // ???????????
3044
+ //child.editWindow = null; // ???????????
29713045 }
29723046 objEditor.ctrlPanel.FlushUI();
29733047 //objEditor.jTree.clearSelection();
....@@ -3053,7 +3127,9 @@
30533127 frontView.object = group;
30543128 sideView.object = group;
30553129 }
3056
- group.editWindow = this;
3130
+
3131
+// fix "+" issue group.editWindow = this;
3132
+
30573133 /*
30583134 currentLayout = radio.layout;
30593135 if (currentLayout == null)
....@@ -3066,7 +3142,20 @@
30663142 //group.attributes = -1;
30673143 ResetModel();
30683144 refreshContents(true);
3069
- }
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
+ }
30703159 else
30713160 {
30723161 //return super.action(event, arg);
....@@ -3127,6 +3216,28 @@
31273216 refreshContents();
31283217 }
31293218
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
+ }
31303241
31313242 void ResetTransform()
31323243 {
....@@ -3239,7 +3350,7 @@
32393350 refreshContents();
32403351 }
32413352
3242
- void ResetCentroid()
3353
+ void ResetCentroid(boolean full)
32433354 {
32443355 Object3D obj;
32453356 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3254,12 +3365,16 @@
32543365 LA.matIdentity(Object3D.mat);
32553366 obj.getBounds(minima, maxima, false);
32563367 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3257
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3368
+ if (full)
3369
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32583370 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32593371 obj.TransformMesh(Object3D.mat);
3372
+
32603373 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3261
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3374
+ if (full)
3375
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32623376 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3377
+
32633378 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32643379 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32653380 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3325,9 +3440,9 @@
33253440 obj = (Object3D)e.nextElement();
33263441
33273442 System.out.println("Object is: " + obj);
3328
- GrafreeD.AnalyzeObject(obj);
3443
+ Grafreed.AnalyzeObject(obj);
33293444 System.out.println("Boundary rep: " + obj.bRep);
3330
- GrafreeD.AnalyzeObject(obj.bRep);
3445
+ Grafreed.AnalyzeObject(obj.bRep);
33313446
33323447 // System.err.println((size/1024) + " KB is the size of " + obj);
33333448 }
....@@ -3541,8 +3656,8 @@
35413656
35423657 void ParseVertices()
35433658 {
3544
- boolean epsequal = GrafreeD.epsequal;
3545
- GrafreeD.epsequal = true;
3659
+ boolean epsequal = Grafreed.epsequal;
3660
+ Grafreed.epsequal = true;
35463661
35473662 for (int i=0; i<group.selection.size(); i++)
35483663 {
....@@ -3567,7 +3682,7 @@
35673682 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35683683 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35693684
3570
- g.add(GrafreeD.clipboard);
3685
+ g.add(Grafreed.clipboard);
35713686
35723687 buffer.add(g);
35733688 }
....@@ -3582,7 +3697,7 @@
35823697 makeSomething(buffer, i==group.selection.size()-1);
35833698 }
35843699
3585
- GrafreeD.epsequal = epsequal;
3700
+ Grafreed.epsequal = epsequal;
35863701
35873702 refreshContents();
35883703 }
....@@ -3600,7 +3715,16 @@
36003715 String pigment = Object3D.GetPigment(tex);
36013716 //String bump = Object3D.GetBump(tex);
36023717
3603
- 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
+ }
36043728
36053729 double s = v.s;
36063730
....@@ -3732,7 +3856,7 @@
37323856 return;
37333857
37343858 Object3D poses = group.selection.get(0);
3735
- Object3D ref = GrafreeD.clipboard.get(0);
3859
+ Object3D ref = Grafreed.clipboard.get(0);
37363860
37373861 Object3D newgroup = new Object3D("Po:" + poses.name);
37383862
....@@ -3926,9 +4050,9 @@
39264050
39274051 void ClipMesh()
39284052 {
3929
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4053
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39304054 {
3931
- Object3D content = GrafreeD.clipboard.get(0);
4055
+ Object3D content = Grafreed.clipboard.get(0);
39324056
39334057 if (content instanceof cGroup && ((cGroup)content).transientlink )
39344058 content = ((cGroup)content).get(0);
....@@ -3937,7 +4061,7 @@
39374061 // {
39384062 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39394063 // }
3940
- group.selection.ClipMesh(GrafreeD.clipboard);
4064
+ group.selection.ClipMesh(Grafreed.clipboard);
39414065 }
39424066 // group.selection.ClipMesh(GrafreeD.clipboard);
39434067 System.out.println("DONE.");
....@@ -4072,7 +4196,7 @@
40724196 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40734197
40744198 Object3D elem = (Object3D)group.selection.elementAt(i);
4075
- if(elem != group)
4199
+ if(elem != group || !newWindow)
40764200 {
40774201 // if (!(elem instanceof Composite))
40784202 // newWindow = false;
....@@ -4186,14 +4310,17 @@
41864310
41874311 objEditor.SetText(); // jan 2014
41884312
4189
- 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))
41904314 CameraPane.flash = true;
41914315
4192
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4316
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41934317 // a camera
41944318 {
4195
- CameraPane.camerachangeframe = 0; // don't refuse it
4196
- 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
+ }
41974324 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41984325 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41994326 }
....@@ -4277,12 +4404,12 @@
42774404 {
42784405 if (group.selection.isEmpty())
42794406 return;
4280
- GrafreeD.clipboardIsTempGroup = false;
4407
+ Grafreed.clipboardIsTempGroup = false;
42814408 Composite tGroup = null;
42824409 if (group.selection.size() > 0) // 1)
42834410 {
42844411 tGroup = new cGroup();
4285
- GrafreeD.clipboardIsTempGroup = true;
4412
+ Grafreed.clipboardIsTempGroup = true;
42864413 }
42874414
42884415 if (cut)
....@@ -4322,16 +4449,16 @@
43224449 //System.out.println("cut " + child);
43234450 //System.out.println("parent = " + child.parent);
43244451 // tmp.addChild(child);
4325
- if (GrafreeD.clipboardIsTempGroup)
4452
+ if (Grafreed.clipboardIsTempGroup)
43264453 tGroup.add/*Child*/(tmp);
43274454 else
4328
- GrafreeD.clipboard = tmp;
4455
+ Grafreed.clipboard = tmp;
43294456 }
43304457 else
4331
- if (GrafreeD.clipboardIsTempGroup)
4458
+ if (Grafreed.clipboardIsTempGroup)
43324459 tGroup.add/*Child*/(child);
43334460 else
4334
- GrafreeD.clipboard = child;
4461
+ Grafreed.clipboard = child;
43354462 }
43364463
43374464 //ResetModel();
....@@ -4363,21 +4490,21 @@
43634490 //System.out.println("cut " + elem);
43644491 //System.out.println("parent = " + elem.parent);
43654492 // tmp.addChild(elem);
4366
- if (GrafreeD.clipboardIsTempGroup)
4493
+ if (Grafreed.clipboardIsTempGroup)
43674494 tGroup.add/*Child*/(tmp);
43684495 else
4369
- GrafreeD.clipboard = tmp;
4496
+ Grafreed.clipboard = tmp;
43704497 }
43714498 else
4372
- if (GrafreeD.clipboardIsTempGroup)
4499
+ if (Grafreed.clipboardIsTempGroup)
43734500 tGroup.add/*Child*/(child);
43744501 else
4375
- GrafreeD.clipboard = child;
4502
+ Grafreed.clipboard = child;
43764503 }
43774504
43784505 }
4379
- if (GrafreeD.clipboardIsTempGroup)
4380
- GrafreeD.clipboard = tGroup;
4506
+ if (Grafreed.clipboardIsTempGroup)
4507
+ Grafreed.clipboard = tGroup;
43814508 if (cut)
43824509 {
43834510 ResetModel();
....@@ -4391,7 +4518,7 @@
43914518 // return;
43924519 boolean first = true;
43934520
4394
- if (GrafreeD.clipboardIsTempGroup)
4521
+ if (Grafreed.clipboardIsTempGroup)
43954522 {
43964523 Composite temp;
43974524
....@@ -4402,7 +4529,7 @@
44024529 temp = (Composite)Applet3D.clipboard.deepCopy();
44034530 */
44044531 Object3D elem;
4405
- 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))
44064533 {
44074534 Object3D child = (Object3D)e.nextElement();
44084535
....@@ -4436,14 +4563,14 @@
44364563 //Object3D cb = Applet3D.clipboard;
44374564 //temp.addChild(cb);
44384565 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4439
- assert(GrafreeD.clipboard.parent == null);
4440
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4441
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4442
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4443
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
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());
44444571 else
4445
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4446
- GrafreeD.clipboard.get(0).parent = keepparent;
4572
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4573
+ Grafreed.clipboard.get(0).parent = keepparent;
44474574 }
44484575
44494576 ResetModel();
....@@ -4492,9 +4619,9 @@
44924619 {
44934620 boolean first = true;
44944621
4495
- if (GrafreeD.clipboardIsTempGroup)
4622
+ if (Grafreed.clipboardIsTempGroup)
44964623 {
4497
- Composite temp = (Composite)GrafreeD.clipboard;
4624
+ Composite temp = (Composite)Grafreed.clipboard;
44984625 Object3D copy;
44994626 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45004627 {
....@@ -4504,7 +4631,7 @@
45044631 }
45054632 } else
45064633 {
4507
- linkSomething(GrafreeD.clipboard); //.get(0));
4634
+ linkSomething(Grafreed.clipboard); //.get(0));
45084635 }
45094636 }
45104637 }
....@@ -4909,21 +5036,6 @@
49095036 }
49105037 */
49115038
4912
- void ImportGFD()
4913
- {
4914
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4915
- browser.show();
4916
- String filename = browser.getFile();
4917
- if (filename != null && filename.length() > 0)
4918
- {
4919
- String fullname = browser.getDirectory() + filename;
4920
-
4921
- //Object3D readobj =
4922
- objEditor.ReadGFD(fullname, objEditor);
4923
- //makeSomething(readobj);
4924
- }
4925
- }
4926
-
49275039 /*
49285040 public void Callback(Object obj)
49295041 {
....@@ -4947,26 +5059,9 @@
49475059 }
49485060 */
49495061
4950
- void ImportVRMLX3D()
4951
- {
4952
- if (GrafreeD.standAlone)
4953
- {
4954
- /**/
4955
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4956
- browser.show();
4957
- String filename = browser.getFile();
4958
- if (filename != null && filename.length() > 0)
4959
- {
4960
- String fullname = browser.getDirectory() + filename;
4961
- LoadVRMLX3D(fullname);
4962
- }
4963
- /**/
4964
- }
4965
- }
4966
-
49675062 String GetFile(String dialogName)
49685063 {
4969
- if (GrafreeD.standAlone)
5064
+ if (Grafreed.standAlone)
49705065 {
49715066 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49725067 browser.show();
....@@ -5066,6 +5161,8 @@
50665161 private MenuItem lookFromItem;
50675162 private MenuItem switchItem;
50685163 private MenuItem cutItem;
5164
+ private MenuItem undoItem;
5165
+ private MenuItem redoItem;
50695166 private MenuItem duplicateItem;
50705167 private MenuItem cloneItem;
50715168 private MenuItem cloneSupportItem;
....@@ -5079,7 +5176,7 @@
50795176 private MenuItem linkverticesItem;
50805177 private MenuItem relinkverticesItem;
50815178 private MenuItem setMasterItem;
5082
- private MenuItem resetMeshItem;
5179
+ private MenuItem resetAllItem;
50835180 private MenuItem stepAllItem;
50845181 private MenuItem revertMeshItem;
50855182 private MenuItem poseMeshItem;
....@@ -5140,8 +5237,10 @@
51405237 private MenuItem panoTexturesItem;
51415238
51425239 private MenuItem resetCentroidItem;
5143
- private MenuItem transformgeometryItem;
5240
+ private MenuItem resetCentroidXZItem;
51445241 private MenuItem resetTransformItem;
5242
+ private MenuItem transformGeometryItem;
5243
+ private MenuItem transformChildrenItem;
51455244 private MenuItem hideItem;
51465245 private MenuItem grabItem;
51475246 private MenuItem backItem;
....@@ -5210,11 +5309,6 @@
52105309 private MenuItem doubleItem;
52115310 private MenuItem tripleItem;
52125311
5213
- private MenuItem importGFDItem;
5214
- private MenuItem importVRMLX3DItem;
5215
- private MenuItem import3DSItem;
5216
- private MenuItem importOBJItem;
5217
-
52185312 private MenuItem computeAOItem;
52195313 private MenuItem recompileItem;
52205314 private MenuItem editScriptItem;
....@@ -5224,4 +5318,8 @@
52245318 private MenuItem analyzeItem;
52255319 private MenuItem dumpItem;
52265320 //boolean freezemodel = false;
5321
+
5322
+ Menu cameraMenu;
5323
+ MenuItem editCameraItem;
5324
+ MenuItem revertCameraItem;
52275325 }