Normand Briere
2019-06-09 3ae9b1de47e51e7c150412f2bb14383cb6a5f8f8
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");
....@@ -714,6 +729,7 @@
714729 buttonGroup.add(radioButton);
715730 radioButton.doClick();
716731 }
732
+
717733 void SetupViews(ObjEditor oe)
718734 {
719735 oe.SetupViews();
....@@ -930,7 +946,9 @@
930946 // objEditor.DropFile((java.io.File[]) object, true);
931947 // return;
932948 // }
933
- if (string.charAt(0) == '/')
949
+
950
+ // File path for Mac and Windows
951
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
934952 {
935953 // file(s)
936954 String[] names = string.split("\n");
....@@ -957,7 +975,7 @@
957975
958976 flashIt = false;
959977 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
978
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
961979 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
962980
963981 if (group.selection.size() == 1)
....@@ -1164,13 +1182,13 @@
11641182 parseverticesItem.addActionListener(this);
11651183 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661184 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1185
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681186 alignItem.addActionListener(this);
11691187 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701188 reduceMorphItem.addActionListener(this);
11711189 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721190 reduce34MorphItem.addActionListener(this);
1173
-
1191
+ menu.add("-");
11741192 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751193 computeAOItem.addActionListener(this);
11761194
....@@ -1530,9 +1548,9 @@
15301548
15311549 void Overwrite(int mask)
15321550 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1551
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15341552 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
1553
+ Object3D content = Grafreed.clipboard.get(0);
15361554
15371555 if (content instanceof cGroup && ((cGroup)content).transientlink )
15381556 content = ((cGroup)content).get(0);
....@@ -1852,7 +1870,15 @@
18521870 } else
18531871 if (source == importOBJItem)
18541872 {
1855
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1874
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1875
+ browser.setVisible(true);
1876
+ String filename = browser.getFile();
1877
+ if (filename != null && filename.length() > 0)
1878
+ {
1879
+ String fullname = browser.getDirectory() + filename;
1880
+ makeSomething(ReadOBJ(fullname), true);
1881
+ }
18561882 } else
18571883 if (source == computeAOItem)
18581884 {
....@@ -1872,7 +1898,7 @@
18721898 if (source == invariantsItem)
18731899 {
18741900 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
1901
+ Grafreed.grafreeD.universe.invariants();
18761902 } else
18771903 if (source == memoryItem)
18781904 {
....@@ -1947,10 +1973,10 @@
19471973 } else
19481974 if (source == duplicateItem)
19491975 {
1950
- Object3D keep = GrafreeD.clipboard;
1976
+ Object3D keep = Grafreed.clipboard;
19511977 loadClipboard(false);
19521978 paste(false);
1953
- GrafreeD.clipboard = keep;
1979
+ Grafreed.clipboard = keep;
19541980 } else
19551981 if (source == cloneItem)
19561982 {
....@@ -2170,9 +2196,9 @@
21702196 // group.selection.get(0).setMasterThis(content); // should be identity
21712197 // refreshContents();
21722198 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2199
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742200 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2201
+ Object3D content = Grafreed.clipboard.get(0);
21762202
21772203 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782204 content = ((cGroup)content).get(0);
....@@ -2222,9 +2248,9 @@
22222248 } else
22232249 if (source == setMasterItem)
22242250 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2251
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262252 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2253
+ Object3D content = Grafreed.clipboard.get(0);
22282254
22292255 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302256 content = ((cGroup)content).get(0);
....@@ -2237,9 +2263,9 @@
22372263 {
22382264 if (group.selection.size() == 1)
22392265 {
2240
- if (GrafreeD.clipboard.size() == 1)
2266
+ if (Grafreed.clipboard.size() == 1)
22412267 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
2268
+ Object3D content = Grafreed.clipboard.get(0);
22432269
22442270 if (content instanceof cGroup && ((cGroup)content).transientlink )
22452271 content = ((cGroup)content).get(0);
....@@ -2256,7 +2282,7 @@
22562282 {
22572283 RevertMeshes();
22582284 } else
2259
- if (source == resetMeshItem)
2285
+ if (source == resetAllItem)
22602286 {
22612287 ResetAll();
22622288 } else
....@@ -2594,9 +2620,13 @@
25942620 {
25952621 SmoothMesh();
25962622 } else
2597
- if (source == transformgeometryItem)
2623
+ if (source == transformGeometryItem)
25982624 {
25992625 TransformGeometry();
2626
+ } else
2627
+ if (source == transformChildrenItem)
2628
+ {
2629
+ TransformChildren();
26002630 } else
26012631 if (source == resetTransformItem)
26022632 {
....@@ -2604,7 +2634,11 @@
26042634 } else
26052635 if (source == resetCentroidItem)
26062636 {
2607
- ResetCentroid();
2637
+ ResetCentroid(true);
2638
+ } else
2639
+ if (source == resetCentroidXZItem)
2640
+ {
2641
+ ResetCentroid(false);
26082642 } else
26092643 if (source == resetParentItem)
26102644 {
....@@ -3046,7 +3080,9 @@
30463080 frontView.object = group;
30473081 sideView.object = group;
30483082 }
3049
- group.editWindow = this;
3083
+
3084
+// fix "+" issue group.editWindow = this;
3085
+
30503086 /*
30513087 currentLayout = radio.layout;
30523088 if (currentLayout == null)
....@@ -3120,6 +3156,28 @@
31203156 refreshContents();
31213157 }
31223158
3159
+ void TransformChildren()
3160
+ {
3161
+ Object3D obj;
3162
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3163
+ {
3164
+ obj = (Object3D)e.nextElement();
3165
+ obj.KeepTextureMatrices();
3166
+ obj.TransformChildren();
3167
+ obj.RestoreTextureMatrices();
3168
+
3169
+// if (obj.parent == null)
3170
+// {
3171
+// System.out.println("NULL PARENT!");
3172
+// new Exception().printStackTrace();
3173
+// }
3174
+// else
3175
+// TouchTransform(obj);
3176
+// //obj.parent.Touch();
3177
+ }
3178
+
3179
+ refreshContents();
3180
+ }
31233181
31243182 void ResetTransform()
31253183 {
....@@ -3232,7 +3290,7 @@
32323290 refreshContents();
32333291 }
32343292
3235
- void ResetCentroid()
3293
+ void ResetCentroid(boolean full)
32363294 {
32373295 Object3D obj;
32383296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +3305,16 @@
32473305 LA.matIdentity(Object3D.mat);
32483306 obj.getBounds(minima, maxima, false);
32493307 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3308
+ if (full)
3309
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32513310 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32523311 obj.TransformMesh(Object3D.mat);
3312
+
32533313 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3314
+ if (full)
3315
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32553316 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3317
+
32563318 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32573319 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32583320 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3318,9 +3380,9 @@
33183380 obj = (Object3D)e.nextElement();
33193381
33203382 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
3383
+ Grafreed.AnalyzeObject(obj);
33223384 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
3385
+ Grafreed.AnalyzeObject(obj.bRep);
33243386
33253387 // System.err.println((size/1024) + " KB is the size of " + obj);
33263388 }
....@@ -3534,8 +3596,8 @@
35343596
35353597 void ParseVertices()
35363598 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
3599
+ boolean epsequal = Grafreed.epsequal;
3600
+ Grafreed.epsequal = true;
35393601
35403602 for (int i=0; i<group.selection.size(); i++)
35413603 {
....@@ -3560,7 +3622,7 @@
35603622 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35613623 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35623624
3563
- g.add(GrafreeD.clipboard);
3625
+ g.add(Grafreed.clipboard);
35643626
35653627 buffer.add(g);
35663628 }
....@@ -3575,7 +3637,7 @@
35753637 makeSomething(buffer, i==group.selection.size()-1);
35763638 }
35773639
3578
- GrafreeD.epsequal = epsequal;
3640
+ Grafreed.epsequal = epsequal;
35793641
35803642 refreshContents();
35813643 }
....@@ -3593,7 +3655,16 @@
35933655 String pigment = Object3D.GetPigment(tex);
35943656 //String bump = Object3D.GetBump(tex);
35953657
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3658
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3659
+
3660
+ try
3661
+ {
3662
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3663
+ }
3664
+ catch (Exception e)
3665
+ {
3666
+ System.err.println("FAIL: " + node);
3667
+ }
35973668
35983669 double s = v.s;
35993670
....@@ -3725,7 +3796,7 @@
37253796 return;
37263797
37273798 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
3799
+ Object3D ref = Grafreed.clipboard.get(0);
37293800
37303801 Object3D newgroup = new Object3D("Po:" + poses.name);
37313802
....@@ -3919,9 +3990,9 @@
39193990
39203991 void ClipMesh()
39213992 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3993
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39233994 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
3995
+ Object3D content = Grafreed.clipboard.get(0);
39253996
39263997 if (content instanceof cGroup && ((cGroup)content).transientlink )
39273998 content = ((cGroup)content).get(0);
....@@ -3930,7 +4001,7 @@
39304001 // {
39314002 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324003 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4004
+ group.selection.ClipMesh(Grafreed.clipboard);
39344005 }
39354006 // group.selection.ClipMesh(GrafreeD.clipboard);
39364007 System.out.println("DONE.");
....@@ -4065,7 +4136,7 @@
40654136 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40664137
40674138 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
4139
+ if(elem != group || !newWindow)
40694140 {
40704141 // if (!(elem instanceof Composite))
40714142 // newWindow = false;
....@@ -4270,12 +4341,12 @@
42704341 {
42714342 if (group.selection.isEmpty())
42724343 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
4344
+ Grafreed.clipboardIsTempGroup = false;
42744345 Composite tGroup = null;
42754346 if (group.selection.size() > 0) // 1)
42764347 {
42774348 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
4349
+ Grafreed.clipboardIsTempGroup = true;
42794350 }
42804351
42814352 if (cut)
....@@ -4315,16 +4386,16 @@
43154386 //System.out.println("cut " + child);
43164387 //System.out.println("parent = " + child.parent);
43174388 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
4389
+ if (Grafreed.clipboardIsTempGroup)
43194390 tGroup.add/*Child*/(tmp);
43204391 else
4321
- GrafreeD.clipboard = tmp;
4392
+ Grafreed.clipboard = tmp;
43224393 }
43234394 else
4324
- if (GrafreeD.clipboardIsTempGroup)
4395
+ if (Grafreed.clipboardIsTempGroup)
43254396 tGroup.add/*Child*/(child);
43264397 else
4327
- GrafreeD.clipboard = child;
4398
+ Grafreed.clipboard = child;
43284399 }
43294400
43304401 //ResetModel();
....@@ -4356,21 +4427,21 @@
43564427 //System.out.println("cut " + elem);
43574428 //System.out.println("parent = " + elem.parent);
43584429 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
4430
+ if (Grafreed.clipboardIsTempGroup)
43604431 tGroup.add/*Child*/(tmp);
43614432 else
4362
- GrafreeD.clipboard = tmp;
4433
+ Grafreed.clipboard = tmp;
43634434 }
43644435 else
4365
- if (GrafreeD.clipboardIsTempGroup)
4436
+ if (Grafreed.clipboardIsTempGroup)
43664437 tGroup.add/*Child*/(child);
43674438 else
4368
- GrafreeD.clipboard = child;
4439
+ Grafreed.clipboard = child;
43694440 }
43704441
43714442 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
4443
+ if (Grafreed.clipboardIsTempGroup)
4444
+ Grafreed.clipboard = tGroup;
43744445 if (cut)
43754446 {
43764447 ResetModel();
....@@ -4384,7 +4455,7 @@
43844455 // return;
43854456 boolean first = true;
43864457
4387
- if (GrafreeD.clipboardIsTempGroup)
4458
+ if (Grafreed.clipboardIsTempGroup)
43884459 {
43894460 Composite temp;
43904461
....@@ -4395,7 +4466,7 @@
43954466 temp = (Composite)Applet3D.clipboard.deepCopy();
43964467 */
43974468 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4469
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43994470 {
44004471 Object3D child = (Object3D)e.nextElement();
44014472
....@@ -4429,14 +4500,14 @@
44294500 //Object3D cb = Applet3D.clipboard;
44304501 //temp.addChild(cb);
44314502 //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());
4503
+ assert(Grafreed.clipboard.parent == null);
4504
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4505
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4506
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4507
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44374508 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
4509
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4510
+ Grafreed.clipboard.get(0).parent = keepparent;
44404511 }
44414512
44424513 ResetModel();
....@@ -4485,9 +4556,9 @@
44854556 {
44864557 boolean first = true;
44874558
4488
- if (GrafreeD.clipboardIsTempGroup)
4559
+ if (Grafreed.clipboardIsTempGroup)
44894560 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
4561
+ Composite temp = (Composite)Grafreed.clipboard;
44914562 Object3D copy;
44924563 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44934564 {
....@@ -4497,7 +4568,7 @@
44974568 }
44984569 } else
44994570 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
4571
+ linkSomething(Grafreed.clipboard); //.get(0));
45014572 }
45024573 }
45034574 }
....@@ -4942,7 +5013,7 @@
49425013
49435014 void ImportVRMLX3D()
49445015 {
4945
- if (GrafreeD.standAlone)
5016
+ if (Grafreed.standAlone)
49465017 {
49475018 /**/
49485019 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4959,7 +5030,7 @@
49595030
49605031 String GetFile(String dialogName)
49615032 {
4962
- if (GrafreeD.standAlone)
5033
+ if (Grafreed.standAlone)
49635034 {
49645035 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655036 browser.show();
....@@ -5072,7 +5143,7 @@
50725143 private MenuItem linkverticesItem;
50735144 private MenuItem relinkverticesItem;
50745145 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
5146
+ private MenuItem resetAllItem;
50765147 private MenuItem stepAllItem;
50775148 private MenuItem revertMeshItem;
50785149 private MenuItem poseMeshItem;
....@@ -5133,8 +5204,10 @@
51335204 private MenuItem panoTexturesItem;
51345205
51355206 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
5207
+ private MenuItem resetCentroidXZItem;
51375208 private MenuItem resetTransformItem;
5209
+ private MenuItem transformGeometryItem;
5210
+ private MenuItem transformChildrenItem;
51385211 private MenuItem hideItem;
51395212 private MenuItem grabItem;
51405213 private MenuItem backItem;