.. | .. |
---|
98 | 98 | |
---|
99 | 99 | void CloneClipboard(boolean supports) |
---|
100 | 100 | { |
---|
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)); |
---|
106 | 106 | 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; |
---|
109 | 109 | } |
---|
110 | 110 | |
---|
111 | 111 | static Object3D CloneObject(Object3D obj, boolean supports) |
---|
.. | .. |
---|
119 | 119 | // obj.support = null; |
---|
120 | 120 | if (!supports) |
---|
121 | 121 | obj.SaveSupports(); |
---|
122 | | - Object3D clone = (Object3D)GrafreeD.clone(obj); |
---|
| 122 | + Object3D clone = (Object3D)Grafreed.clone(obj); |
---|
123 | 123 | obj.parent = parent; |
---|
124 | 124 | // obj.support = support; |
---|
125 | 125 | // clone.support = support; // aout 2013 |
---|
.. | .. |
---|
210 | 210 | oe.menuBar.add(menu = new Menu("Setting")); |
---|
211 | 211 | if (Globals.ADVANCED) |
---|
212 | 212 | { |
---|
213 | | - resetMeshItem = menu.add(new MenuItem("Reset All")); |
---|
214 | | - resetMeshItem.addActionListener(this); |
---|
215 | | - stepAllItem = menu.add(new MenuItem("Step All")); |
---|
216 | | - stepAllItem.addActionListener(this); |
---|
217 | 213 | revertMeshItem = menu.add(new MenuItem("Revert Meshes")); |
---|
218 | 214 | revertMeshItem.addActionListener(this); |
---|
219 | 215 | resetreferencesItem = menu.add(new MenuItem("Reset Mesh References")); |
---|
.. | .. |
---|
318 | 314 | resetTransformItem.addActionListener(this); |
---|
319 | 315 | resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); |
---|
320 | 316 | resetCentroidItem.addActionListener(this); |
---|
321 | | - transformgeometryItem = menu.add(new MenuItem("Transform Geometry")); |
---|
322 | | - 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); |
---|
323 | 323 | |
---|
324 | 324 | oe.menuBar.add(menu = new Menu("Geometry")); |
---|
325 | 325 | genUVItem = menu.add(new MenuItem("Generate UV")); |
---|
.. | .. |
---|
368 | 368 | oe.menuBar.add(menu = new Menu("Attributes")); |
---|
369 | 369 | clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); |
---|
370 | 370 | 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); |
---|
371 | 375 | menu.add("-"); |
---|
372 | 376 | liveleavesItem = menu.add(new MenuItem("Live Leaves")); |
---|
373 | 377 | liveleavesItem.addActionListener(this); |
---|
.. | .. |
---|
422 | 426 | sortbysizeItem.addActionListener(this); |
---|
423 | 427 | sortbynameItem = menu.add(new MenuItem("Sort by name")); |
---|
424 | 428 | 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); |
---|
425 | 434 | if (Globals.ADVANCED) |
---|
426 | 435 | { |
---|
427 | | - menu.add("-"); |
---|
| 436 | + // Pretty much the same as duplicate and clone. |
---|
428 | 437 | extractGeometriesItem = menu.add(new MenuItem("Link Geometry")); |
---|
429 | 438 | extractGeometriesItem.addActionListener(this); |
---|
430 | 439 | cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry")); |
---|
431 | 440 | 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); |
---|
436 | 441 | } |
---|
437 | 442 | |
---|
438 | 443 | oe.menuBar.add(menu = new Menu("Insert")); |
---|
439 | 444 | buildCreateMenu(menu); |
---|
440 | 445 | |
---|
441 | 446 | 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 = menu.add(new MenuItem("OBJ file...")); |
---|
447 | 448 | importOBJItem.addActionListener(this); |
---|
448 | | - import3DSItem = menu.add(new MenuItem("3DS Object...")); |
---|
| 449 | + menu.add("-"); |
---|
| 450 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
449 | 451 | 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); |
---|
450 | 458 | |
---|
451 | 459 | oe.menuBar.add(menu = new Menu("Tools")); |
---|
452 | 460 | buildToolsMenu(menu); |
---|
.. | .. |
---|
485 | 493 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
486 | 494 | |
---|
487 | 495 | oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints); |
---|
488 | | - liveCB.setToolTipText("Enabled animation"); |
---|
| 496 | + liveCB.setToolTipText("Enable animation"); |
---|
489 | 497 | liveCB.addItemListener(this); |
---|
490 | 498 | |
---|
491 | | - oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 499 | + oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
492 | 500 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
493 | 501 | oneStepButton.addActionListener(this); |
---|
494 | 502 | |
---|
.. | .. |
---|
500 | 508 | trackCB.setToolTipText("Enable tracking"); |
---|
501 | 509 | trackCB.addItemListener(this); |
---|
502 | 510 | |
---|
503 | | - oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 511 | + oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
504 | 512 | screenfitButton.setToolTipText("Screen fit"); |
---|
505 | 513 | screenfitButton.addActionListener(this); |
---|
506 | 514 | |
---|
.. | .. |
---|
509 | 517 | |
---|
510 | 518 | if (Globals.ADVANCED) |
---|
511 | 519 | { |
---|
512 | | - oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 520 | + oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
513 | 521 | snapobjectButton.addActionListener(this); |
---|
514 | 522 | snapobjectButton.setToolTipText("Snap Object"); |
---|
515 | 523 | } |
---|
516 | 524 | |
---|
517 | | - oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 525 | + oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
518 | 526 | flashSelectionButton.setToolTipText("Show selection"); |
---|
519 | 527 | flashSelectionButton.addActionListener(this); |
---|
520 | 528 | |
---|
521 | 529 | oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
522 | 530 | |
---|
523 | | - oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 531 | + oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
524 | 532 | twoButton.setToolTipText("Show center view only"); |
---|
525 | 533 | twoButton.addActionListener(this); |
---|
526 | | - oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 534 | + oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
527 | 535 | fourButton.addActionListener(this); |
---|
528 | 536 | fourButton.setToolTipText("Show left panel only"); |
---|
529 | | - oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 537 | + oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
530 | 538 | sixButton.setToolTipText("2-column layout left"); |
---|
531 | 539 | sixButton.addActionListener(this); |
---|
532 | | - oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 540 | + oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
533 | 541 | threeButton.setToolTipText("2-column layout right"); |
---|
534 | 542 | threeButton.addActionListener(this); |
---|
535 | | - oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 543 | + oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
536 | 544 | sevenButton.setToolTipText("3-column layout"); |
---|
537 | 545 | sevenButton.addActionListener(this); |
---|
538 | 546 | // |
---|
539 | 547 | |
---|
540 | | - 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); |
---|
541 | 549 | rootButton.setToolTipText("Edit selection in new tab"); |
---|
542 | 550 | rootButton.addActionListener(this); |
---|
543 | 551 | |
---|
544 | | - oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 552 | + oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
545 | 553 | closeButton.setToolTipText("Close tab"); |
---|
546 | 554 | closeButton.addActionListener(this); |
---|
547 | 555 | //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); |
---|
.. | .. |
---|
549 | 557 | |
---|
550 | 558 | cGridBag commandsPanel = new cGridBag(); |
---|
551 | 559 | |
---|
552 | | - commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 560 | + commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
553 | 561 | editButton.setToolTipText("Edit selection"); |
---|
554 | 562 | editButton.addActionListener(this); |
---|
555 | 563 | |
---|
556 | | - commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 564 | + commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
557 | 565 | uneditButton.setToolTipText("Unedit selection"); |
---|
558 | 566 | uneditButton.addActionListener(this); |
---|
559 | 567 | |
---|
.. | .. |
---|
561 | 569 | allParamsButton.setToolTipText("Edit all params"); |
---|
562 | 570 | allParamsButton.addActionListener(this); |
---|
563 | 571 | |
---|
564 | | - commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 572 | + commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
565 | 573 | clearPanelButton.setToolTipText("Clear edit panel"); |
---|
566 | 574 | clearPanelButton.addActionListener(this); |
---|
567 | 575 | |
---|
568 | | - commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 576 | + commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
569 | 577 | unselectButton.setToolTipText("Unselect"); |
---|
570 | 578 | unselectButton.addActionListener(this); |
---|
571 | 579 | |
---|
.. | .. |
---|
648 | 656 | zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel"); |
---|
649 | 657 | zoomBoxCB.addItemListener(this); |
---|
650 | 658 | |
---|
651 | | - if (Globals.ADVANCED) |
---|
| 659 | + if (true) // Globals.ADVANCED) |
---|
652 | 660 | { |
---|
653 | 661 | panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
654 | 662 | supportCB.setToolTipText("Enable rigging"); |
---|
.. | .. |
---|
721 | 729 | buttonGroup.add(radioButton); |
---|
722 | 730 | radioButton.doClick(); |
---|
723 | 731 | } |
---|
| 732 | + |
---|
724 | 733 | void SetupViews(ObjEditor oe) |
---|
725 | 734 | { |
---|
726 | 735 | oe.SetupViews(); |
---|
.. | .. |
---|
937 | 946 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
938 | 947 | // return; |
---|
939 | 948 | // } |
---|
940 | | - if (string.charAt(0) == '/') |
---|
| 949 | + |
---|
| 950 | + // File path for Mac and Windows |
---|
| 951 | + if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
941 | 952 | { |
---|
942 | 953 | // file(s) |
---|
943 | 954 | String[] names = string.split("\n"); |
---|
.. | .. |
---|
964 | 975 | |
---|
965 | 976 | flashIt = false; |
---|
966 | 977 | CameraPane pane = (CameraPane) target; |
---|
967 | | - pane.clickStart(objEditor.location.x, objEditor.location.y, 0); |
---|
| 978 | + pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0); |
---|
968 | 979 | pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true); |
---|
969 | 980 | |
---|
970 | 981 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1537 | 1548 | |
---|
1538 | 1549 | void Overwrite(int mask) |
---|
1539 | 1550 | { |
---|
1540 | | - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
| 1551 | + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) |
---|
1541 | 1552 | { |
---|
1542 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 1553 | + Object3D content = Grafreed.clipboard.get(0); |
---|
1543 | 1554 | |
---|
1544 | 1555 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
1545 | 1556 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
1859 | 1870 | } else |
---|
1860 | 1871 | if (source == importOBJItem) |
---|
1861 | 1872 | { |
---|
1862 | | - 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 | + } |
---|
1863 | 1882 | } else |
---|
1864 | 1883 | if (source == computeAOItem) |
---|
1865 | 1884 | { |
---|
.. | .. |
---|
1879 | 1898 | if (source == invariantsItem) |
---|
1880 | 1899 | { |
---|
1881 | 1900 | System.out.println("Invariants:"); |
---|
1882 | | - GrafreeD.grafreeD.universe.invariants(); |
---|
| 1901 | + Grafreed.grafreeD.universe.invariants(); |
---|
1883 | 1902 | } else |
---|
1884 | 1903 | if (source == memoryItem) |
---|
1885 | 1904 | { |
---|
.. | .. |
---|
1954 | 1973 | } else |
---|
1955 | 1974 | if (source == duplicateItem) |
---|
1956 | 1975 | { |
---|
1957 | | - Object3D keep = GrafreeD.clipboard; |
---|
| 1976 | + Object3D keep = Grafreed.clipboard; |
---|
1958 | 1977 | loadClipboard(false); |
---|
1959 | 1978 | paste(false); |
---|
1960 | | - GrafreeD.clipboard = keep; |
---|
| 1979 | + Grafreed.clipboard = keep; |
---|
1961 | 1980 | } else |
---|
1962 | 1981 | if (source == cloneItem) |
---|
1963 | 1982 | { |
---|
.. | .. |
---|
2177 | 2196 | // group.selection.get(0).setMasterThis(content); // should be identity |
---|
2178 | 2197 | // refreshContents(); |
---|
2179 | 2198 | // } |
---|
2180 | | - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
| 2199 | + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) |
---|
2181 | 2200 | { |
---|
2182 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 2201 | + Object3D content = Grafreed.clipboard.get(0); |
---|
2183 | 2202 | |
---|
2184 | 2203 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2185 | 2204 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2229 | 2248 | } else |
---|
2230 | 2249 | if (source == setMasterItem) |
---|
2231 | 2250 | { |
---|
2232 | | - if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) |
---|
| 2251 | + if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1) |
---|
2233 | 2252 | { |
---|
2234 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 2253 | + Object3D content = Grafreed.clipboard.get(0); |
---|
2235 | 2254 | |
---|
2236 | 2255 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2237 | 2256 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2244 | 2263 | { |
---|
2245 | 2264 | if (group.selection.size() == 1) |
---|
2246 | 2265 | { |
---|
2247 | | - if (GrafreeD.clipboard.size() == 1) |
---|
| 2266 | + if (Grafreed.clipboard.size() == 1) |
---|
2248 | 2267 | { |
---|
2249 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 2268 | + Object3D content = Grafreed.clipboard.get(0); |
---|
2250 | 2269 | |
---|
2251 | 2270 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2252 | 2271 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2263 | 2282 | { |
---|
2264 | 2283 | RevertMeshes(); |
---|
2265 | 2284 | } else |
---|
2266 | | - if (source == resetMeshItem) |
---|
| 2285 | + if (source == resetAllItem) |
---|
2267 | 2286 | { |
---|
2268 | 2287 | ResetAll(); |
---|
2269 | 2288 | } else |
---|
.. | .. |
---|
2601 | 2620 | { |
---|
2602 | 2621 | SmoothMesh(); |
---|
2603 | 2622 | } else |
---|
2604 | | - if (source == transformgeometryItem) |
---|
| 2623 | + if (source == transformGeometryItem) |
---|
2605 | 2624 | { |
---|
2606 | 2625 | TransformGeometry(); |
---|
| 2626 | + } else |
---|
| 2627 | + if (source == transformChildrenItem) |
---|
| 2628 | + { |
---|
| 2629 | + TransformChildren(); |
---|
2607 | 2630 | } else |
---|
2608 | 2631 | if (source == resetTransformItem) |
---|
2609 | 2632 | { |
---|
.. | .. |
---|
2611 | 2634 | } else |
---|
2612 | 2635 | if (source == resetCentroidItem) |
---|
2613 | 2636 | { |
---|
2614 | | - ResetCentroid(); |
---|
| 2637 | + ResetCentroid(true); |
---|
| 2638 | + } else |
---|
| 2639 | + if (source == resetCentroidXZItem) |
---|
| 2640 | + { |
---|
| 2641 | + ResetCentroid(false); |
---|
2615 | 2642 | } else |
---|
2616 | 2643 | if (source == resetParentItem) |
---|
2617 | 2644 | { |
---|
.. | .. |
---|
3053 | 3080 | frontView.object = group; |
---|
3054 | 3081 | sideView.object = group; |
---|
3055 | 3082 | } |
---|
3056 | | - group.editWindow = this; |
---|
| 3083 | + |
---|
| 3084 | +// fix "+" issue group.editWindow = this; |
---|
| 3085 | + |
---|
3057 | 3086 | /* |
---|
3058 | 3087 | currentLayout = radio.layout; |
---|
3059 | 3088 | if (currentLayout == null) |
---|
.. | .. |
---|
3127 | 3156 | refreshContents(); |
---|
3128 | 3157 | } |
---|
3129 | 3158 | |
---|
| 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 | + } |
---|
3130 | 3181 | |
---|
3131 | 3182 | void ResetTransform() |
---|
3132 | 3183 | { |
---|
.. | .. |
---|
3239 | 3290 | refreshContents(); |
---|
3240 | 3291 | } |
---|
3241 | 3292 | |
---|
3242 | | - void ResetCentroid() |
---|
| 3293 | + void ResetCentroid(boolean full) |
---|
3243 | 3294 | { |
---|
3244 | 3295 | Object3D obj; |
---|
3245 | 3296 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
3254 | 3305 | LA.matIdentity(Object3D.mat); |
---|
3255 | 3306 | obj.getBounds(minima, maxima, false); |
---|
3256 | 3307 | Object3D.mat[3][0] = -(minima.x + maxima.x)/2; |
---|
3257 | | - Object3D.mat[3][1] = -(minima.y + maxima.y)/2; |
---|
| 3308 | + if (full) |
---|
| 3309 | + Object3D.mat[3][1] = -(minima.y + maxima.y)/2; |
---|
3258 | 3310 | Object3D.mat[3][2] = -(minima.z + maxima.z)/2; |
---|
3259 | 3311 | obj.TransformMesh(Object3D.mat); |
---|
| 3312 | + |
---|
3260 | 3313 | Object3D.mat[3][0] = (minima.x + maxima.x)/2; |
---|
3261 | | - Object3D.mat[3][1] = (minima.y + maxima.y)/2; |
---|
| 3314 | + if (full) |
---|
| 3315 | + Object3D.mat[3][1] = (minima.y + maxima.y)/2; |
---|
3262 | 3316 | Object3D.mat[3][2] = (minima.z + maxima.z)/2; |
---|
| 3317 | + |
---|
3263 | 3318 | LA.matConcat(Object3D.mat, obj.toParent, obj.toParent); |
---|
3264 | 3319 | //Object3D.mat[3][0] = -Object3D.mat[3][0]; |
---|
3265 | 3320 | //Object3D.mat[3][1] = -Object3D.mat[3][1]; |
---|
.. | .. |
---|
3325 | 3380 | obj = (Object3D)e.nextElement(); |
---|
3326 | 3381 | |
---|
3327 | 3382 | System.out.println("Object is: " + obj); |
---|
3328 | | - GrafreeD.AnalyzeObject(obj); |
---|
| 3383 | + Grafreed.AnalyzeObject(obj); |
---|
3329 | 3384 | System.out.println("Boundary rep: " + obj.bRep); |
---|
3330 | | - GrafreeD.AnalyzeObject(obj.bRep); |
---|
| 3385 | + Grafreed.AnalyzeObject(obj.bRep); |
---|
3331 | 3386 | |
---|
3332 | 3387 | // System.err.println((size/1024) + " KB is the size of " + obj); |
---|
3333 | 3388 | } |
---|
.. | .. |
---|
3541 | 3596 | |
---|
3542 | 3597 | void ParseVertices() |
---|
3543 | 3598 | { |
---|
3544 | | - boolean epsequal = GrafreeD.epsequal; |
---|
3545 | | - GrafreeD.epsequal = true; |
---|
| 3599 | + boolean epsequal = Grafreed.epsequal; |
---|
| 3600 | + Grafreed.epsequal = true; |
---|
3546 | 3601 | |
---|
3547 | 3602 | for (int i=0; i<group.selection.size(); i++) |
---|
3548 | 3603 | { |
---|
.. | .. |
---|
3567 | 3622 | LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
3568 | 3623 | LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
3569 | 3624 | |
---|
3570 | | - g.add(GrafreeD.clipboard); |
---|
| 3625 | + g.add(Grafreed.clipboard); |
---|
3571 | 3626 | |
---|
3572 | 3627 | buffer.add(g); |
---|
3573 | 3628 | } |
---|
.. | .. |
---|
3582 | 3637 | makeSomething(buffer, i==group.selection.size()-1); |
---|
3583 | 3638 | } |
---|
3584 | 3639 | |
---|
3585 | | - GrafreeD.epsequal = epsequal; |
---|
| 3640 | + Grafreed.epsequal = epsequal; |
---|
3586 | 3641 | |
---|
3587 | 3642 | refreshContents(); |
---|
3588 | 3643 | } |
---|
.. | .. |
---|
3600 | 3655 | String pigment = Object3D.GetPigment(tex); |
---|
3601 | 3656 | //String bump = Object3D.GetBump(tex); |
---|
3602 | 3657 | |
---|
3603 | | - 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 | + } |
---|
3604 | 3668 | |
---|
3605 | 3669 | double s = v.s; |
---|
3606 | 3670 | |
---|
.. | .. |
---|
3732 | 3796 | return; |
---|
3733 | 3797 | |
---|
3734 | 3798 | Object3D poses = group.selection.get(0); |
---|
3735 | | - Object3D ref = GrafreeD.clipboard.get(0); |
---|
| 3799 | + Object3D ref = Grafreed.clipboard.get(0); |
---|
3736 | 3800 | |
---|
3737 | 3801 | Object3D newgroup = new Object3D("Po:" + poses.name); |
---|
3738 | 3802 | |
---|
.. | .. |
---|
3926 | 3990 | |
---|
3927 | 3991 | void ClipMesh() |
---|
3928 | 3992 | { |
---|
3929 | | - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
| 3993 | + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) |
---|
3930 | 3994 | { |
---|
3931 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 3995 | + Object3D content = Grafreed.clipboard.get(0); |
---|
3932 | 3996 | |
---|
3933 | 3997 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
3934 | 3998 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
3937 | 4001 | // { |
---|
3938 | 4002 | // group.selection.get(i).ClipMesh(GrafreeD.clipboard); |
---|
3939 | 4003 | // } |
---|
3940 | | - group.selection.ClipMesh(GrafreeD.clipboard); |
---|
| 4004 | + group.selection.ClipMesh(Grafreed.clipboard); |
---|
3941 | 4005 | } |
---|
3942 | 4006 | // group.selection.ClipMesh(GrafreeD.clipboard); |
---|
3943 | 4007 | System.out.println("DONE."); |
---|
.. | .. |
---|
4072 | 4136 | objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
4073 | 4137 | |
---|
4074 | 4138 | Object3D elem = (Object3D)group.selection.elementAt(i); |
---|
4075 | | - if(elem != group) |
---|
| 4139 | + if(elem != group || !newWindow) |
---|
4076 | 4140 | { |
---|
4077 | 4141 | // if (!(elem instanceof Composite)) |
---|
4078 | 4142 | // newWindow = false; |
---|
.. | .. |
---|
4277 | 4341 | { |
---|
4278 | 4342 | if (group.selection.isEmpty()) |
---|
4279 | 4343 | return; |
---|
4280 | | - GrafreeD.clipboardIsTempGroup = false; |
---|
| 4344 | + Grafreed.clipboardIsTempGroup = false; |
---|
4281 | 4345 | Composite tGroup = null; |
---|
4282 | 4346 | if (group.selection.size() > 0) // 1) |
---|
4283 | 4347 | { |
---|
4284 | 4348 | tGroup = new cGroup(); |
---|
4285 | | - GrafreeD.clipboardIsTempGroup = true; |
---|
| 4349 | + Grafreed.clipboardIsTempGroup = true; |
---|
4286 | 4350 | } |
---|
4287 | 4351 | |
---|
4288 | 4352 | if (cut) |
---|
.. | .. |
---|
4322 | 4386 | //System.out.println("cut " + child); |
---|
4323 | 4387 | //System.out.println("parent = " + child.parent); |
---|
4324 | 4388 | // tmp.addChild(child); |
---|
4325 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4389 | + if (Grafreed.clipboardIsTempGroup) |
---|
4326 | 4390 | tGroup.add/*Child*/(tmp); |
---|
4327 | 4391 | else |
---|
4328 | | - GrafreeD.clipboard = tmp; |
---|
| 4392 | + Grafreed.clipboard = tmp; |
---|
4329 | 4393 | } |
---|
4330 | 4394 | else |
---|
4331 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4395 | + if (Grafreed.clipboardIsTempGroup) |
---|
4332 | 4396 | tGroup.add/*Child*/(child); |
---|
4333 | 4397 | else |
---|
4334 | | - GrafreeD.clipboard = child; |
---|
| 4398 | + Grafreed.clipboard = child; |
---|
4335 | 4399 | } |
---|
4336 | 4400 | |
---|
4337 | 4401 | //ResetModel(); |
---|
.. | .. |
---|
4363 | 4427 | //System.out.println("cut " + elem); |
---|
4364 | 4428 | //System.out.println("parent = " + elem.parent); |
---|
4365 | 4429 | // tmp.addChild(elem); |
---|
4366 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4430 | + if (Grafreed.clipboardIsTempGroup) |
---|
4367 | 4431 | tGroup.add/*Child*/(tmp); |
---|
4368 | 4432 | else |
---|
4369 | | - GrafreeD.clipboard = tmp; |
---|
| 4433 | + Grafreed.clipboard = tmp; |
---|
4370 | 4434 | } |
---|
4371 | 4435 | else |
---|
4372 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4436 | + if (Grafreed.clipboardIsTempGroup) |
---|
4373 | 4437 | tGroup.add/*Child*/(child); |
---|
4374 | 4438 | else |
---|
4375 | | - GrafreeD.clipboard = child; |
---|
| 4439 | + Grafreed.clipboard = child; |
---|
4376 | 4440 | } |
---|
4377 | 4441 | |
---|
4378 | 4442 | } |
---|
4379 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
4380 | | - GrafreeD.clipboard = tGroup; |
---|
| 4443 | + if (Grafreed.clipboardIsTempGroup) |
---|
| 4444 | + Grafreed.clipboard = tGroup; |
---|
4381 | 4445 | if (cut) |
---|
4382 | 4446 | { |
---|
4383 | 4447 | ResetModel(); |
---|
.. | .. |
---|
4391 | 4455 | // return; |
---|
4392 | 4456 | boolean first = true; |
---|
4393 | 4457 | |
---|
4394 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4458 | + if (Grafreed.clipboardIsTempGroup) |
---|
4395 | 4459 | { |
---|
4396 | 4460 | Composite temp; |
---|
4397 | 4461 | |
---|
.. | .. |
---|
4402 | 4466 | temp = (Composite)Applet3D.clipboard.deepCopy(); |
---|
4403 | 4467 | */ |
---|
4404 | 4468 | Object3D elem; |
---|
4405 | | - 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)) |
---|
4406 | 4470 | { |
---|
4407 | 4471 | Object3D child = (Object3D)e.nextElement(); |
---|
4408 | 4472 | |
---|
.. | .. |
---|
4436 | 4500 | //Object3D cb = Applet3D.clipboard; |
---|
4437 | 4501 | //temp.addChild(cb); |
---|
4438 | 4502 | //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()); |
---|
| 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()); |
---|
4444 | 4508 | else |
---|
4445 | | - makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy()); |
---|
4446 | | - GrafreeD.clipboard.get(0).parent = keepparent; |
---|
| 4509 | + makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy()); |
---|
| 4510 | + Grafreed.clipboard.get(0).parent = keepparent; |
---|
4447 | 4511 | } |
---|
4448 | 4512 | |
---|
4449 | 4513 | ResetModel(); |
---|
.. | .. |
---|
4492 | 4556 | { |
---|
4493 | 4557 | boolean first = true; |
---|
4494 | 4558 | |
---|
4495 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4559 | + if (Grafreed.clipboardIsTempGroup) |
---|
4496 | 4560 | { |
---|
4497 | | - Composite temp = (Composite)GrafreeD.clipboard; |
---|
| 4561 | + Composite temp = (Composite)Grafreed.clipboard; |
---|
4498 | 4562 | Object3D copy; |
---|
4499 | 4563 | for (Enumeration e = temp.children.elements(); e.hasMoreElements();) |
---|
4500 | 4564 | { |
---|
.. | .. |
---|
4504 | 4568 | } |
---|
4505 | 4569 | } else |
---|
4506 | 4570 | { |
---|
4507 | | - linkSomething(GrafreeD.clipboard); //.get(0)); |
---|
| 4571 | + linkSomething(Grafreed.clipboard); //.get(0)); |
---|
4508 | 4572 | } |
---|
4509 | 4573 | } |
---|
4510 | 4574 | } |
---|
.. | .. |
---|
4949 | 5013 | |
---|
4950 | 5014 | void ImportVRMLX3D() |
---|
4951 | 5015 | { |
---|
4952 | | - if (GrafreeD.standAlone) |
---|
| 5016 | + if (Grafreed.standAlone) |
---|
4953 | 5017 | { |
---|
4954 | 5018 | /**/ |
---|
4955 | 5019 | FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
.. | .. |
---|
4966 | 5030 | |
---|
4967 | 5031 | String GetFile(String dialogName) |
---|
4968 | 5032 | { |
---|
4969 | | - if (GrafreeD.standAlone) |
---|
| 5033 | + if (Grafreed.standAlone) |
---|
4970 | 5034 | { |
---|
4971 | 5035 | FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD); |
---|
4972 | 5036 | browser.show(); |
---|
.. | .. |
---|
5079 | 5143 | private MenuItem linkverticesItem; |
---|
5080 | 5144 | private MenuItem relinkverticesItem; |
---|
5081 | 5145 | private MenuItem setMasterItem; |
---|
5082 | | - private MenuItem resetMeshItem; |
---|
| 5146 | + private MenuItem resetAllItem; |
---|
5083 | 5147 | private MenuItem stepAllItem; |
---|
5084 | 5148 | private MenuItem revertMeshItem; |
---|
5085 | 5149 | private MenuItem poseMeshItem; |
---|
.. | .. |
---|
5140 | 5204 | private MenuItem panoTexturesItem; |
---|
5141 | 5205 | |
---|
5142 | 5206 | private MenuItem resetCentroidItem; |
---|
5143 | | - private MenuItem transformgeometryItem; |
---|
| 5207 | + private MenuItem resetCentroidXZItem; |
---|
5144 | 5208 | private MenuItem resetTransformItem; |
---|
| 5209 | + private MenuItem transformGeometryItem; |
---|
| 5210 | + private MenuItem transformChildrenItem; |
---|
5145 | 5211 | private MenuItem hideItem; |
---|
5146 | 5212 | private MenuItem grabItem; |
---|
5147 | 5213 | private MenuItem backItem; |
---|