Normand Briere
2019-06-03 e24558ddeacfc945b9e9ba0a32b552d04e2ed4dd
GroupEditor.java
....@@ -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
....@@ -171,6 +171,14 @@
171171 //editItem.addActionListener(this);
172172 duplicateItem = menu.add(new MenuItem("Duplicate"));
173173 duplicateItem.addActionListener(this);
174
+ cloneItem = menu.add(new MenuItem("Clone"));
175
+ cloneItem.addActionListener(this);
176
+ if (Globals.ADVANCED)
177
+ {
178
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
179
+ cloneSupportItem.addActionListener(this);
180
+ }
181
+ menu.add("-");
174182 cutItem = menu.add(new MenuItem("Cut"));
175183 cutItem.addActionListener(this);
176184 copyItem = menu.add(new MenuItem("Copy"));
....@@ -178,10 +186,7 @@
178186 pasteItem = menu.add(new MenuItem("Paste"));
179187 pasteItem.addActionListener(this);
180188 menu.add("-");
181
- cloneItem = menu.add(new MenuItem("Clone"));
182
- cloneItem.addActionListener(this);
183
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
184
- cloneSupportItem.addActionListener(this);
189
+
185190 menu.add("-");
186191 pasteIntoItem = menu.add(new MenuItem("Paste into"));
187192 pasteIntoItem.addActionListener(this);
....@@ -205,10 +210,6 @@
205210 oe.menuBar.add(menu = new Menu("Setting"));
206211 if (Globals.ADVANCED)
207212 {
208
- resetMeshItem = menu.add(new MenuItem("Reset All"));
209
- resetMeshItem.addActionListener(this);
210
- stepAllItem = menu.add(new MenuItem("Step All"));
211
- stepAllItem.addActionListener(this);
212213 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
213214 revertMeshItem.addActionListener(this);
214215 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -272,6 +273,7 @@
272273
273274 if (Globals.ADVANCED)
274275 {
276
+ menu.add("-");
275277 physicsItem = menu.add(new MenuItem("Physics"));
276278 physicsItem.addActionListener(this);
277279 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
....@@ -297,6 +299,7 @@
297299 shadowZItem.addActionListener(this);
298300 if (Globals.ADVANCED)
299301 {
302
+ menu.add("-");
300303 linkerItem = menu.add(new MenuItem("Linker"));
301304 linkerItem.addActionListener(this);
302305 attributeItem = menu.add(new MenuItem("Attribute"));
....@@ -305,14 +308,18 @@
305308 templateItem.addActionListener(this);
306309 pointflowItem = menu.add(new MenuItem("Point Flow"));
307310 pointflowItem.addActionListener(this);
308
- menu.add("-");
309311 }
312
+ menu.add("-");
310313 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
311314 resetTransformItem.addActionListener(this);
312315 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
313316 resetCentroidItem.addActionListener(this);
314
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
315
- transformgeometryItem.addActionListener(this);
317
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
318
+ resetCentroidXZItem.addActionListener(this);
319
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
320
+ transformGeometryItem.addActionListener(this);
321
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
322
+ transformChildrenItem.addActionListener(this);
316323
317324 oe.menuBar.add(menu = new Menu("Geometry"));
318325 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -361,6 +368,10 @@
361368 oe.menuBar.add(menu = new Menu("Attributes"));
362369 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
363370 clearMaterialsItem.addActionListener(this);
371
+ resetAllItem = menu.add(new MenuItem("Reset All"));
372
+ resetAllItem.addActionListener(this);
373
+ stepAllItem = menu.add(new MenuItem("Step All"));
374
+ stepAllItem.addActionListener(this);
364375 menu.add("-");
365376 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
366377 liveleavesItem.addActionListener(this);
....@@ -415,31 +426,35 @@
415426 sortbysizeItem.addActionListener(this);
416427 sortbynameItem = menu.add(new MenuItem("Sort by name"));
417428 sortbynameItem.addActionListener(this);
429
+ menu.add("-");
430
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
431
+ shareGeometriesItem.addActionListener(this);
432
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
433
+ mergeGeometriesItem.addActionListener(this);
418434 if (Globals.ADVANCED)
419435 {
420
- menu.add("-");
436
+ // Pretty much the same as duplicate and clone.
421437 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
422438 extractGeometriesItem.addActionListener(this);
423439 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
424440 cloneGeometriesItem.addActionListener(this);
425
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
426
- shareGeometriesItem.addActionListener(this);
427
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
428
- mergeGeometriesItem.addActionListener(this);
429441 }
430442
431443 oe.menuBar.add(menu = new Menu("Insert"));
432444 buildCreateMenu(menu);
433445
434446 oe.menuBar.add(menu = new Menu("Include"));
435
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
436
- importGFDItem.addActionListener(this);
437
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
438
- importVRMLX3DItem.addActionListener(this);
439
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
447
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
440448 importOBJItem.addActionListener(this);
441
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
449
+ menu.add("-");
450
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
442451 import3DSItem.addActionListener(this);
452
+ menu.add("-");
453
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
+ importVRMLX3DItem.addActionListener(this);
455
+ menu.add("-");
456
+ importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
+ importGFDItem.addActionListener(this);
443458
444459 oe.menuBar.add(menu = new Menu("Tools"));
445460 buildToolsMenu(menu);
....@@ -478,10 +493,10 @@
478493 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
479494
480495 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
481
- liveCB.setToolTipText("Enabled animation");
496
+ liveCB.setToolTipText("Enable animation");
482497 liveCB.addItemListener(this);
483498
484
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
499
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485500 oneStepButton.setToolTipText("Animate one step forward");
486501 oneStepButton.addActionListener(this);
487502
....@@ -493,7 +508,7 @@
493508 trackCB.setToolTipText("Enable tracking");
494509 trackCB.addItemListener(this);
495510
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
511
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
497512 screenfitButton.setToolTipText("Screen fit");
498513 screenfitButton.addActionListener(this);
499514
....@@ -502,39 +517,39 @@
502517
503518 if (Globals.ADVANCED)
504519 {
505
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
520
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
506521 snapobjectButton.addActionListener(this);
507522 snapobjectButton.setToolTipText("Snap Object");
508523 }
509524
510
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
525
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
511526 flashSelectionButton.setToolTipText("Show selection");
512527 flashSelectionButton.addActionListener(this);
513528
514529 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
515530
516
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
531
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
517532 twoButton.setToolTipText("Show center view only");
518533 twoButton.addActionListener(this);
519
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
534
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520535 fourButton.addActionListener(this);
521536 fourButton.setToolTipText("Show left panel only");
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
537
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523538 sixButton.setToolTipText("2-column layout left");
524539 sixButton.addActionListener(this);
525
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
540
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526541 threeButton.setToolTipText("2-column layout right");
527542 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
543
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
529544 sevenButton.setToolTipText("3-column layout");
530545 sevenButton.addActionListener(this);
531546 //
532547
533
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
548
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534549 rootButton.setToolTipText("Edit selection in new tab");
535550 rootButton.addActionListener(this);
536551
537
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
552
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538553 closeButton.setToolTipText("Close tab");
539554 closeButton.addActionListener(this);
540555 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -542,11 +557,11 @@
542557
543558 cGridBag commandsPanel = new cGridBag();
544559
545
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
560
+ commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
546561 editButton.setToolTipText("Edit selection");
547562 editButton.addActionListener(this);
548563
549
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
564
+ commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
550565 uneditButton.setToolTipText("Unedit selection");
551566 uneditButton.addActionListener(this);
552567
....@@ -554,11 +569,11 @@
554569 allParamsButton.setToolTipText("Edit all params");
555570 allParamsButton.addActionListener(this);
556571
557
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
572
+ commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
558573 clearPanelButton.setToolTipText("Clear edit panel");
559574 clearPanelButton.addActionListener(this);
560575
561
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
576
+ commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
562577 unselectButton.setToolTipText("Unselect");
563578 unselectButton.addActionListener(this);
564579
....@@ -641,7 +656,7 @@
641656 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
642657 zoomBoxCB.addItemListener(this);
643658
644
- if (Globals.ADVANCED)
659
+ if (true) // Globals.ADVANCED)
645660 {
646661 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
647662 supportCB.setToolTipText("Enable rigging");
....@@ -930,7 +945,9 @@
930945 // objEditor.DropFile((java.io.File[]) object, true);
931946 // return;
932947 // }
933
- if (string.charAt(0) == '/')
948
+
949
+ // File path for Mac and Windows
950
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
934951 {
935952 // file(s)
936953 String[] names = string.split("\n");
....@@ -957,7 +974,7 @@
957974
958975 flashIt = false;
959976 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
977
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
961978 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
962979
963980 if (group.selection.size() == 1)
....@@ -1164,13 +1181,13 @@
11641181 parseverticesItem.addActionListener(this);
11651182 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661183 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1184
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681185 alignItem.addActionListener(this);
11691186 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701187 reduceMorphItem.addActionListener(this);
11711188 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721189 reduce34MorphItem.addActionListener(this);
1173
-
1190
+ menu.add("-");
11741191 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751192 computeAOItem.addActionListener(this);
11761193
....@@ -1530,9 +1547,9 @@
15301547
15311548 void Overwrite(int mask)
15321549 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1550
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15341551 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
1552
+ Object3D content = Grafreed.clipboard.get(0);
15361553
15371554 if (content instanceof cGroup && ((cGroup)content).transientlink )
15381555 content = ((cGroup)content).get(0);
....@@ -1852,7 +1869,15 @@
18521869 } else
18531870 if (source == importOBJItem)
18541871 {
1855
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1872
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
+ browser.setVisible(true);
1875
+ String filename = browser.getFile();
1876
+ if (filename != null && filename.length() > 0)
1877
+ {
1878
+ String fullname = browser.getDirectory() + filename;
1879
+ makeSomething(ReadOBJ(fullname), true);
1880
+ }
18561881 } else
18571882 if (source == computeAOItem)
18581883 {
....@@ -1872,7 +1897,7 @@
18721897 if (source == invariantsItem)
18731898 {
18741899 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
1900
+ Grafreed.grafreeD.universe.invariants();
18761901 } else
18771902 if (source == memoryItem)
18781903 {
....@@ -1947,10 +1972,10 @@
19471972 } else
19481973 if (source == duplicateItem)
19491974 {
1950
- Object3D keep = GrafreeD.clipboard;
1975
+ Object3D keep = Grafreed.clipboard;
19511976 loadClipboard(false);
19521977 paste(false);
1953
- GrafreeD.clipboard = keep;
1978
+ Grafreed.clipboard = keep;
19541979 } else
19551980 if (source == cloneItem)
19561981 {
....@@ -2170,9 +2195,9 @@
21702195 // group.selection.get(0).setMasterThis(content); // should be identity
21712196 // refreshContents();
21722197 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2198
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742199 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2200
+ Object3D content = Grafreed.clipboard.get(0);
21762201
21772202 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782203 content = ((cGroup)content).get(0);
....@@ -2222,9 +2247,9 @@
22222247 } else
22232248 if (source == setMasterItem)
22242249 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2250
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262251 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2252
+ Object3D content = Grafreed.clipboard.get(0);
22282253
22292254 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302255 content = ((cGroup)content).get(0);
....@@ -2237,9 +2262,9 @@
22372262 {
22382263 if (group.selection.size() == 1)
22392264 {
2240
- if (GrafreeD.clipboard.size() == 1)
2265
+ if (Grafreed.clipboard.size() == 1)
22412266 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
2267
+ Object3D content = Grafreed.clipboard.get(0);
22432268
22442269 if (content instanceof cGroup && ((cGroup)content).transientlink )
22452270 content = ((cGroup)content).get(0);
....@@ -2256,7 +2281,7 @@
22562281 {
22572282 RevertMeshes();
22582283 } else
2259
- if (source == resetMeshItem)
2284
+ if (source == resetAllItem)
22602285 {
22612286 ResetAll();
22622287 } else
....@@ -2594,9 +2619,13 @@
25942619 {
25952620 SmoothMesh();
25962621 } else
2597
- if (source == transformgeometryItem)
2622
+ if (source == transformGeometryItem)
25982623 {
25992624 TransformGeometry();
2625
+ } else
2626
+ if (source == transformChildrenItem)
2627
+ {
2628
+ TransformChildren();
26002629 } else
26012630 if (source == resetTransformItem)
26022631 {
....@@ -2604,7 +2633,11 @@
26042633 } else
26052634 if (source == resetCentroidItem)
26062635 {
2607
- ResetCentroid();
2636
+ ResetCentroid(true);
2637
+ } else
2638
+ if (source == resetCentroidXZItem)
2639
+ {
2640
+ ResetCentroid(false);
26082641 } else
26092642 if (source == resetParentItem)
26102643 {
....@@ -3120,6 +3153,28 @@
31203153 refreshContents();
31213154 }
31223155
3156
+ void TransformChildren()
3157
+ {
3158
+ Object3D obj;
3159
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3160
+ {
3161
+ obj = (Object3D)e.nextElement();
3162
+ obj.KeepTextureMatrices();
3163
+ obj.TransformChildren();
3164
+ obj.RestoreTextureMatrices();
3165
+
3166
+// if (obj.parent == null)
3167
+// {
3168
+// System.out.println("NULL PARENT!");
3169
+// new Exception().printStackTrace();
3170
+// }
3171
+// else
3172
+// TouchTransform(obj);
3173
+// //obj.parent.Touch();
3174
+ }
3175
+
3176
+ refreshContents();
3177
+ }
31233178
31243179 void ResetTransform()
31253180 {
....@@ -3232,7 +3287,7 @@
32323287 refreshContents();
32333288 }
32343289
3235
- void ResetCentroid()
3290
+ void ResetCentroid(boolean full)
32363291 {
32373292 Object3D obj;
32383293 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +3302,16 @@
32473302 LA.matIdentity(Object3D.mat);
32483303 obj.getBounds(minima, maxima, false);
32493304 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3305
+ if (full)
3306
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32513307 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32523308 obj.TransformMesh(Object3D.mat);
3309
+
32533310 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3311
+ if (full)
3312
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32553313 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3314
+
32563315 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32573316 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32583317 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3318,9 +3377,9 @@
33183377 obj = (Object3D)e.nextElement();
33193378
33203379 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
3380
+ Grafreed.AnalyzeObject(obj);
33223381 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
3382
+ Grafreed.AnalyzeObject(obj.bRep);
33243383
33253384 // System.err.println((size/1024) + " KB is the size of " + obj);
33263385 }
....@@ -3534,8 +3593,8 @@
35343593
35353594 void ParseVertices()
35363595 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
3596
+ boolean epsequal = Grafreed.epsequal;
3597
+ Grafreed.epsequal = true;
35393598
35403599 for (int i=0; i<group.selection.size(); i++)
35413600 {
....@@ -3560,7 +3619,7 @@
35603619 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35613620 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35623621
3563
- g.add(GrafreeD.clipboard);
3622
+ g.add(Grafreed.clipboard);
35643623
35653624 buffer.add(g);
35663625 }
....@@ -3575,7 +3634,7 @@
35753634 makeSomething(buffer, i==group.selection.size()-1);
35763635 }
35773636
3578
- GrafreeD.epsequal = epsequal;
3637
+ Grafreed.epsequal = epsequal;
35793638
35803639 refreshContents();
35813640 }
....@@ -3593,7 +3652,16 @@
35933652 String pigment = Object3D.GetPigment(tex);
35943653 //String bump = Object3D.GetBump(tex);
35953654
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3655
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3656
+
3657
+ try
3658
+ {
3659
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3660
+ }
3661
+ catch (Exception e)
3662
+ {
3663
+ System.err.println("FAIL: " + node);
3664
+ }
35973665
35983666 double s = v.s;
35993667
....@@ -3725,7 +3793,7 @@
37253793 return;
37263794
37273795 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
3796
+ Object3D ref = Grafreed.clipboard.get(0);
37293797
37303798 Object3D newgroup = new Object3D("Po:" + poses.name);
37313799
....@@ -3919,9 +3987,9 @@
39193987
39203988 void ClipMesh()
39213989 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3990
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39233991 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
3992
+ Object3D content = Grafreed.clipboard.get(0);
39253993
39263994 if (content instanceof cGroup && ((cGroup)content).transientlink )
39273995 content = ((cGroup)content).get(0);
....@@ -3930,7 +3998,7 @@
39303998 // {
39313999 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324000 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4001
+ group.selection.ClipMesh(Grafreed.clipboard);
39344002 }
39354003 // group.selection.ClipMesh(GrafreeD.clipboard);
39364004 System.out.println("DONE.");
....@@ -4270,12 +4338,12 @@
42704338 {
42714339 if (group.selection.isEmpty())
42724340 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
4341
+ Grafreed.clipboardIsTempGroup = false;
42744342 Composite tGroup = null;
42754343 if (group.selection.size() > 0) // 1)
42764344 {
42774345 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
4346
+ Grafreed.clipboardIsTempGroup = true;
42794347 }
42804348
42814349 if (cut)
....@@ -4315,16 +4383,16 @@
43154383 //System.out.println("cut " + child);
43164384 //System.out.println("parent = " + child.parent);
43174385 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
4386
+ if (Grafreed.clipboardIsTempGroup)
43194387 tGroup.add/*Child*/(tmp);
43204388 else
4321
- GrafreeD.clipboard = tmp;
4389
+ Grafreed.clipboard = tmp;
43224390 }
43234391 else
4324
- if (GrafreeD.clipboardIsTempGroup)
4392
+ if (Grafreed.clipboardIsTempGroup)
43254393 tGroup.add/*Child*/(child);
43264394 else
4327
- GrafreeD.clipboard = child;
4395
+ Grafreed.clipboard = child;
43284396 }
43294397
43304398 //ResetModel();
....@@ -4356,21 +4424,21 @@
43564424 //System.out.println("cut " + elem);
43574425 //System.out.println("parent = " + elem.parent);
43584426 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
4427
+ if (Grafreed.clipboardIsTempGroup)
43604428 tGroup.add/*Child*/(tmp);
43614429 else
4362
- GrafreeD.clipboard = tmp;
4430
+ Grafreed.clipboard = tmp;
43634431 }
43644432 else
4365
- if (GrafreeD.clipboardIsTempGroup)
4433
+ if (Grafreed.clipboardIsTempGroup)
43664434 tGroup.add/*Child*/(child);
43674435 else
4368
- GrafreeD.clipboard = child;
4436
+ Grafreed.clipboard = child;
43694437 }
43704438
43714439 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
4440
+ if (Grafreed.clipboardIsTempGroup)
4441
+ Grafreed.clipboard = tGroup;
43744442 if (cut)
43754443 {
43764444 ResetModel();
....@@ -4384,7 +4452,7 @@
43844452 // return;
43854453 boolean first = true;
43864454
4387
- if (GrafreeD.clipboardIsTempGroup)
4455
+ if (Grafreed.clipboardIsTempGroup)
43884456 {
43894457 Composite temp;
43904458
....@@ -4395,7 +4463,7 @@
43954463 temp = (Composite)Applet3D.clipboard.deepCopy();
43964464 */
43974465 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4466
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43994467 {
44004468 Object3D child = (Object3D)e.nextElement();
44014469
....@@ -4429,14 +4497,14 @@
44294497 //Object3D cb = Applet3D.clipboard;
44304498 //temp.addChild(cb);
44314499 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4432
- assert(GrafreeD.clipboard.parent == null);
4433
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4434
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4435
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4436
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4500
+ assert(Grafreed.clipboard.parent == null);
4501
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4502
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4503
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4504
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44374505 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
4506
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4507
+ Grafreed.clipboard.get(0).parent = keepparent;
44404508 }
44414509
44424510 ResetModel();
....@@ -4485,9 +4553,9 @@
44854553 {
44864554 boolean first = true;
44874555
4488
- if (GrafreeD.clipboardIsTempGroup)
4556
+ if (Grafreed.clipboardIsTempGroup)
44894557 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
4558
+ Composite temp = (Composite)Grafreed.clipboard;
44914559 Object3D copy;
44924560 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44934561 {
....@@ -4497,7 +4565,7 @@
44974565 }
44984566 } else
44994567 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
4568
+ linkSomething(Grafreed.clipboard); //.get(0));
45014569 }
45024570 }
45034571 }
....@@ -4942,7 +5010,7 @@
49425010
49435011 void ImportVRMLX3D()
49445012 {
4945
- if (GrafreeD.standAlone)
5013
+ if (Grafreed.standAlone)
49465014 {
49475015 /**/
49485016 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4959,7 +5027,7 @@
49595027
49605028 String GetFile(String dialogName)
49615029 {
4962
- if (GrafreeD.standAlone)
5030
+ if (Grafreed.standAlone)
49635031 {
49645032 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655033 browser.show();
....@@ -5072,7 +5140,7 @@
50725140 private MenuItem linkverticesItem;
50735141 private MenuItem relinkverticesItem;
50745142 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
5143
+ private MenuItem resetAllItem;
50765144 private MenuItem stepAllItem;
50775145 private MenuItem revertMeshItem;
50785146 private MenuItem poseMeshItem;
....@@ -5133,8 +5201,10 @@
51335201 private MenuItem panoTexturesItem;
51345202
51355203 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
5204
+ private MenuItem resetCentroidXZItem;
51375205 private MenuItem resetTransformItem;
5206
+ private MenuItem transformGeometryItem;
5207
+ private MenuItem transformChildrenItem;
51385208 private MenuItem hideItem;
51395209 private MenuItem grabItem;
51405210 private MenuItem backItem;