.. | .. |
---|
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 |
---|
.. | .. |
---|
171 | 171 | //editItem.addActionListener(this); |
---|
172 | 172 | duplicateItem = menu.add(new MenuItem("Duplicate")); |
---|
173 | 173 | 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("-"); |
---|
174 | 182 | cutItem = menu.add(new MenuItem("Cut")); |
---|
175 | 183 | cutItem.addActionListener(this); |
---|
176 | 184 | copyItem = menu.add(new MenuItem("Copy")); |
---|
.. | .. |
---|
178 | 186 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
179 | 187 | pasteItem.addActionListener(this); |
---|
180 | 188 | 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 | + |
---|
185 | 190 | menu.add("-"); |
---|
186 | 191 | pasteIntoItem = menu.add(new MenuItem("Paste into")); |
---|
187 | 192 | pasteIntoItem.addActionListener(this); |
---|
.. | .. |
---|
205 | 210 | oe.menuBar.add(menu = new Menu("Setting")); |
---|
206 | 211 | if (Globals.ADVANCED) |
---|
207 | 212 | { |
---|
208 | | - resetMeshItem = menu.add(new MenuItem("Reset All")); |
---|
209 | | - resetMeshItem.addActionListener(this); |
---|
210 | | - stepAllItem = menu.add(new MenuItem("Step All")); |
---|
211 | | - stepAllItem.addActionListener(this); |
---|
212 | 213 | revertMeshItem = menu.add(new MenuItem("Revert Meshes")); |
---|
213 | 214 | revertMeshItem.addActionListener(this); |
---|
214 | 215 | resetreferencesItem = menu.add(new MenuItem("Reset Mesh References")); |
---|
.. | .. |
---|
272 | 273 | |
---|
273 | 274 | if (Globals.ADVANCED) |
---|
274 | 275 | { |
---|
| 276 | + menu.add("-"); |
---|
275 | 277 | physicsItem = menu.add(new MenuItem("Physics")); |
---|
276 | 278 | physicsItem.addActionListener(this); |
---|
277 | 279 | frameselectorItem = menu.add(new MenuItem("Frame Selector")); |
---|
.. | .. |
---|
297 | 299 | shadowZItem.addActionListener(this); |
---|
298 | 300 | if (Globals.ADVANCED) |
---|
299 | 301 | { |
---|
| 302 | + menu.add("-"); |
---|
300 | 303 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
301 | 304 | linkerItem.addActionListener(this); |
---|
302 | 305 | attributeItem = menu.add(new MenuItem("Attribute")); |
---|
.. | .. |
---|
305 | 308 | templateItem.addActionListener(this); |
---|
306 | 309 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
307 | 310 | pointflowItem.addActionListener(this); |
---|
308 | | - menu.add("-"); |
---|
309 | 311 | } |
---|
| 312 | + menu.add("-"); |
---|
310 | 313 | resetTransformItem = menu.add(new MenuItem("Reset Transform")); |
---|
311 | 314 | resetTransformItem.addActionListener(this); |
---|
312 | 315 | resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); |
---|
313 | 316 | 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); |
---|
316 | 323 | |
---|
317 | 324 | oe.menuBar.add(menu = new Menu("Geometry")); |
---|
318 | 325 | genUVItem = menu.add(new MenuItem("Generate UV")); |
---|
.. | .. |
---|
361 | 368 | oe.menuBar.add(menu = new Menu("Attributes")); |
---|
362 | 369 | clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); |
---|
363 | 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); |
---|
364 | 375 | menu.add("-"); |
---|
365 | 376 | liveleavesItem = menu.add(new MenuItem("Live Leaves")); |
---|
366 | 377 | liveleavesItem.addActionListener(this); |
---|
.. | .. |
---|
415 | 426 | sortbysizeItem.addActionListener(this); |
---|
416 | 427 | sortbynameItem = menu.add(new MenuItem("Sort by name")); |
---|
417 | 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); |
---|
418 | 434 | if (Globals.ADVANCED) |
---|
419 | 435 | { |
---|
420 | | - menu.add("-"); |
---|
| 436 | + // Pretty much the same as duplicate and clone. |
---|
421 | 437 | extractGeometriesItem = menu.add(new MenuItem("Link Geometry")); |
---|
422 | 438 | extractGeometriesItem.addActionListener(this); |
---|
423 | 439 | cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry")); |
---|
424 | 440 | 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); |
---|
429 | 441 | } |
---|
430 | 442 | |
---|
431 | 443 | oe.menuBar.add(menu = new Menu("Insert")); |
---|
432 | 444 | buildCreateMenu(menu); |
---|
433 | 445 | |
---|
434 | 446 | 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...")); |
---|
440 | 448 | importOBJItem.addActionListener(this); |
---|
441 | | - import3DSItem = menu.add(new MenuItem("3DS Object...")); |
---|
| 449 | + menu.add("-"); |
---|
| 450 | + import3DSItem = menu.add(new MenuItem("3DS file...")); |
---|
442 | 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); |
---|
443 | 458 | |
---|
444 | 459 | oe.menuBar.add(menu = new Menu("Tools")); |
---|
445 | 460 | buildToolsMenu(menu); |
---|
.. | .. |
---|
478 | 493 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
479 | 494 | |
---|
480 | 495 | oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints); |
---|
481 | | - liveCB.setToolTipText("Enabled animation"); |
---|
| 496 | + liveCB.setToolTipText("Enable animation"); |
---|
482 | 497 | liveCB.addItemListener(this); |
---|
483 | 498 | |
---|
484 | | - oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 499 | + oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
485 | 500 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
486 | 501 | oneStepButton.addActionListener(this); |
---|
487 | 502 | |
---|
.. | .. |
---|
493 | 508 | trackCB.setToolTipText("Enable tracking"); |
---|
494 | 509 | trackCB.addItemListener(this); |
---|
495 | 510 | |
---|
496 | | - oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 511 | + oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
497 | 512 | screenfitButton.setToolTipText("Screen fit"); |
---|
498 | 513 | screenfitButton.addActionListener(this); |
---|
499 | 514 | |
---|
.. | .. |
---|
502 | 517 | |
---|
503 | 518 | if (Globals.ADVANCED) |
---|
504 | 519 | { |
---|
505 | | - oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 520 | + oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
506 | 521 | snapobjectButton.addActionListener(this); |
---|
507 | 522 | snapobjectButton.setToolTipText("Snap Object"); |
---|
508 | 523 | } |
---|
509 | 524 | |
---|
510 | | - oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 525 | + oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
511 | 526 | flashSelectionButton.setToolTipText("Show selection"); |
---|
512 | 527 | flashSelectionButton.addActionListener(this); |
---|
513 | 528 | |
---|
514 | 529 | oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
515 | 530 | |
---|
516 | | - oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 531 | + oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
517 | 532 | twoButton.setToolTipText("Show center view only"); |
---|
518 | 533 | 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); |
---|
520 | 535 | fourButton.addActionListener(this); |
---|
521 | 536 | 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); |
---|
523 | 538 | sixButton.setToolTipText("2-column layout left"); |
---|
524 | 539 | 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); |
---|
526 | 541 | threeButton.setToolTipText("2-column layout right"); |
---|
527 | 542 | 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); |
---|
529 | 544 | sevenButton.setToolTipText("3-column layout"); |
---|
530 | 545 | sevenButton.addActionListener(this); |
---|
531 | 546 | // |
---|
532 | 547 | |
---|
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); |
---|
534 | 549 | rootButton.setToolTipText("Edit selection in new tab"); |
---|
535 | 550 | rootButton.addActionListener(this); |
---|
536 | 551 | |
---|
537 | | - oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 552 | + oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
538 | 553 | closeButton.setToolTipText("Close tab"); |
---|
539 | 554 | closeButton.addActionListener(this); |
---|
540 | 555 | //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); |
---|
.. | .. |
---|
542 | 557 | |
---|
543 | 558 | cGridBag commandsPanel = new cGridBag(); |
---|
544 | 559 | |
---|
545 | | - commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 560 | + commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
546 | 561 | editButton.setToolTipText("Edit selection"); |
---|
547 | 562 | editButton.addActionListener(this); |
---|
548 | 563 | |
---|
549 | | - commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 564 | + commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
550 | 565 | uneditButton.setToolTipText("Unedit selection"); |
---|
551 | 566 | uneditButton.addActionListener(this); |
---|
552 | 567 | |
---|
.. | .. |
---|
554 | 569 | allParamsButton.setToolTipText("Edit all params"); |
---|
555 | 570 | allParamsButton.addActionListener(this); |
---|
556 | 571 | |
---|
557 | | - commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 572 | + commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
558 | 573 | clearPanelButton.setToolTipText("Clear edit panel"); |
---|
559 | 574 | clearPanelButton.addActionListener(this); |
---|
560 | 575 | |
---|
561 | | - commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 576 | + commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
562 | 577 | unselectButton.setToolTipText("Unselect"); |
---|
563 | 578 | unselectButton.addActionListener(this); |
---|
564 | 579 | |
---|
.. | .. |
---|
641 | 656 | zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel"); |
---|
642 | 657 | zoomBoxCB.addItemListener(this); |
---|
643 | 658 | |
---|
644 | | - if (Globals.ADVANCED) |
---|
| 659 | + if (true) // Globals.ADVANCED) |
---|
645 | 660 | { |
---|
646 | 661 | panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
647 | 662 | supportCB.setToolTipText("Enable rigging"); |
---|
.. | .. |
---|
930 | 945 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
931 | 946 | // return; |
---|
932 | 947 | // } |
---|
933 | | - if (string.charAt(0) == '/') |
---|
| 948 | + |
---|
| 949 | + // File path for Mac and Windows |
---|
| 950 | + if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
934 | 951 | { |
---|
935 | 952 | // file(s) |
---|
936 | 953 | String[] names = string.split("\n"); |
---|
.. | .. |
---|
957 | 974 | |
---|
958 | 975 | flashIt = false; |
---|
959 | 976 | 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); |
---|
961 | 978 | pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true); |
---|
962 | 979 | |
---|
963 | 980 | if (group.selection.size() == 1) |
---|
.. | .. |
---|
1164 | 1181 | parseverticesItem.addActionListener(this); |
---|
1165 | 1182 | textureFieldItem = menu.add(new MenuItem("Texture Field")); |
---|
1166 | 1183 | textureFieldItem.addActionListener(this); |
---|
1167 | | - alignItem = menu.add(new MenuItem("Align Object")); |
---|
| 1184 | + alignItem = menu.add(new MenuItem("Align Objects")); |
---|
1168 | 1185 | alignItem.addActionListener(this); |
---|
1169 | 1186 | reduceMorphItem = menu.add(new MenuItem("Reduce Morphs")); |
---|
1170 | 1187 | reduceMorphItem.addActionListener(this); |
---|
1171 | 1188 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1172 | 1189 | reduce34MorphItem.addActionListener(this); |
---|
1173 | | - |
---|
| 1190 | + menu.add("-"); |
---|
1174 | 1191 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1175 | 1192 | computeAOItem.addActionListener(this); |
---|
1176 | 1193 | |
---|
.. | .. |
---|
1530 | 1547 | |
---|
1531 | 1548 | void Overwrite(int mask) |
---|
1532 | 1549 | { |
---|
1533 | | - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
| 1550 | + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) |
---|
1534 | 1551 | { |
---|
1535 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 1552 | + Object3D content = Grafreed.clipboard.get(0); |
---|
1536 | 1553 | |
---|
1537 | 1554 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
1538 | 1555 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
1852 | 1869 | } else |
---|
1853 | 1870 | if (source == importOBJItem) |
---|
1854 | 1871 | { |
---|
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 | + } |
---|
1856 | 1881 | } else |
---|
1857 | 1882 | if (source == computeAOItem) |
---|
1858 | 1883 | { |
---|
.. | .. |
---|
1872 | 1897 | if (source == invariantsItem) |
---|
1873 | 1898 | { |
---|
1874 | 1899 | System.out.println("Invariants:"); |
---|
1875 | | - GrafreeD.grafreeD.universe.invariants(); |
---|
| 1900 | + Grafreed.grafreeD.universe.invariants(); |
---|
1876 | 1901 | } else |
---|
1877 | 1902 | if (source == memoryItem) |
---|
1878 | 1903 | { |
---|
.. | .. |
---|
1947 | 1972 | } else |
---|
1948 | 1973 | if (source == duplicateItem) |
---|
1949 | 1974 | { |
---|
1950 | | - Object3D keep = GrafreeD.clipboard; |
---|
| 1975 | + Object3D keep = Grafreed.clipboard; |
---|
1951 | 1976 | loadClipboard(false); |
---|
1952 | 1977 | paste(false); |
---|
1953 | | - GrafreeD.clipboard = keep; |
---|
| 1978 | + Grafreed.clipboard = keep; |
---|
1954 | 1979 | } else |
---|
1955 | 1980 | if (source == cloneItem) |
---|
1956 | 1981 | { |
---|
.. | .. |
---|
2170 | 2195 | // group.selection.get(0).setMasterThis(content); // should be identity |
---|
2171 | 2196 | // refreshContents(); |
---|
2172 | 2197 | // } |
---|
2173 | | - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
| 2198 | + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) |
---|
2174 | 2199 | { |
---|
2175 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 2200 | + Object3D content = Grafreed.clipboard.get(0); |
---|
2176 | 2201 | |
---|
2177 | 2202 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2178 | 2203 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2222 | 2247 | } else |
---|
2223 | 2248 | if (source == setMasterItem) |
---|
2224 | 2249 | { |
---|
2225 | | - if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1) |
---|
| 2250 | + if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1) |
---|
2226 | 2251 | { |
---|
2227 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 2252 | + Object3D content = Grafreed.clipboard.get(0); |
---|
2228 | 2253 | |
---|
2229 | 2254 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2230 | 2255 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2237 | 2262 | { |
---|
2238 | 2263 | if (group.selection.size() == 1) |
---|
2239 | 2264 | { |
---|
2240 | | - if (GrafreeD.clipboard.size() == 1) |
---|
| 2265 | + if (Grafreed.clipboard.size() == 1) |
---|
2241 | 2266 | { |
---|
2242 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 2267 | + Object3D content = Grafreed.clipboard.get(0); |
---|
2243 | 2268 | |
---|
2244 | 2269 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
2245 | 2270 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
2256 | 2281 | { |
---|
2257 | 2282 | RevertMeshes(); |
---|
2258 | 2283 | } else |
---|
2259 | | - if (source == resetMeshItem) |
---|
| 2284 | + if (source == resetAllItem) |
---|
2260 | 2285 | { |
---|
2261 | 2286 | ResetAll(); |
---|
2262 | 2287 | } else |
---|
.. | .. |
---|
2594 | 2619 | { |
---|
2595 | 2620 | SmoothMesh(); |
---|
2596 | 2621 | } else |
---|
2597 | | - if (source == transformgeometryItem) |
---|
| 2622 | + if (source == transformGeometryItem) |
---|
2598 | 2623 | { |
---|
2599 | 2624 | TransformGeometry(); |
---|
| 2625 | + } else |
---|
| 2626 | + if (source == transformChildrenItem) |
---|
| 2627 | + { |
---|
| 2628 | + TransformChildren(); |
---|
2600 | 2629 | } else |
---|
2601 | 2630 | if (source == resetTransformItem) |
---|
2602 | 2631 | { |
---|
.. | .. |
---|
2604 | 2633 | } else |
---|
2605 | 2634 | if (source == resetCentroidItem) |
---|
2606 | 2635 | { |
---|
2607 | | - ResetCentroid(); |
---|
| 2636 | + ResetCentroid(true); |
---|
| 2637 | + } else |
---|
| 2638 | + if (source == resetCentroidXZItem) |
---|
| 2639 | + { |
---|
| 2640 | + ResetCentroid(false); |
---|
2608 | 2641 | } else |
---|
2609 | 2642 | if (source == resetParentItem) |
---|
2610 | 2643 | { |
---|
.. | .. |
---|
3120 | 3153 | refreshContents(); |
---|
3121 | 3154 | } |
---|
3122 | 3155 | |
---|
| 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 | + } |
---|
3123 | 3178 | |
---|
3124 | 3179 | void ResetTransform() |
---|
3125 | 3180 | { |
---|
.. | .. |
---|
3232 | 3287 | refreshContents(); |
---|
3233 | 3288 | } |
---|
3234 | 3289 | |
---|
3235 | | - void ResetCentroid() |
---|
| 3290 | + void ResetCentroid(boolean full) |
---|
3236 | 3291 | { |
---|
3237 | 3292 | Object3D obj; |
---|
3238 | 3293 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
3247 | 3302 | LA.matIdentity(Object3D.mat); |
---|
3248 | 3303 | obj.getBounds(minima, maxima, false); |
---|
3249 | 3304 | 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; |
---|
3251 | 3307 | Object3D.mat[3][2] = -(minima.z + maxima.z)/2; |
---|
3252 | 3308 | obj.TransformMesh(Object3D.mat); |
---|
| 3309 | + |
---|
3253 | 3310 | 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; |
---|
3255 | 3313 | Object3D.mat[3][2] = (minima.z + maxima.z)/2; |
---|
| 3314 | + |
---|
3256 | 3315 | LA.matConcat(Object3D.mat, obj.toParent, obj.toParent); |
---|
3257 | 3316 | //Object3D.mat[3][0] = -Object3D.mat[3][0]; |
---|
3258 | 3317 | //Object3D.mat[3][1] = -Object3D.mat[3][1]; |
---|
.. | .. |
---|
3318 | 3377 | obj = (Object3D)e.nextElement(); |
---|
3319 | 3378 | |
---|
3320 | 3379 | System.out.println("Object is: " + obj); |
---|
3321 | | - GrafreeD.AnalyzeObject(obj); |
---|
| 3380 | + Grafreed.AnalyzeObject(obj); |
---|
3322 | 3381 | System.out.println("Boundary rep: " + obj.bRep); |
---|
3323 | | - GrafreeD.AnalyzeObject(obj.bRep); |
---|
| 3382 | + Grafreed.AnalyzeObject(obj.bRep); |
---|
3324 | 3383 | |
---|
3325 | 3384 | // System.err.println((size/1024) + " KB is the size of " + obj); |
---|
3326 | 3385 | } |
---|
.. | .. |
---|
3534 | 3593 | |
---|
3535 | 3594 | void ParseVertices() |
---|
3536 | 3595 | { |
---|
3537 | | - boolean epsequal = GrafreeD.epsequal; |
---|
3538 | | - GrafreeD.epsequal = true; |
---|
| 3596 | + boolean epsequal = Grafreed.epsequal; |
---|
| 3597 | + Grafreed.epsequal = true; |
---|
3539 | 3598 | |
---|
3540 | 3599 | for (int i=0; i<group.selection.size(); i++) |
---|
3541 | 3600 | { |
---|
.. | .. |
---|
3560 | 3619 | LA.matTranslate(g.toParent, temp.x, temp.y, temp.z); |
---|
3561 | 3620 | LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z); |
---|
3562 | 3621 | |
---|
3563 | | - g.add(GrafreeD.clipboard); |
---|
| 3622 | + g.add(Grafreed.clipboard); |
---|
3564 | 3623 | |
---|
3565 | 3624 | buffer.add(g); |
---|
3566 | 3625 | } |
---|
.. | .. |
---|
3575 | 3634 | makeSomething(buffer, i==group.selection.size()-1); |
---|
3576 | 3635 | } |
---|
3577 | 3636 | |
---|
3578 | | - GrafreeD.epsequal = epsequal; |
---|
| 3637 | + Grafreed.epsequal = epsequal; |
---|
3579 | 3638 | |
---|
3580 | 3639 | refreshContents(); |
---|
3581 | 3640 | } |
---|
.. | .. |
---|
3593 | 3652 | String pigment = Object3D.GetPigment(tex); |
---|
3594 | 3653 | //String bump = Object3D.GetBump(tex); |
---|
3595 | 3654 | |
---|
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 | + } |
---|
3597 | 3665 | |
---|
3598 | 3666 | double s = v.s; |
---|
3599 | 3667 | |
---|
.. | .. |
---|
3725 | 3793 | return; |
---|
3726 | 3794 | |
---|
3727 | 3795 | Object3D poses = group.selection.get(0); |
---|
3728 | | - Object3D ref = GrafreeD.clipboard.get(0); |
---|
| 3796 | + Object3D ref = Grafreed.clipboard.get(0); |
---|
3729 | 3797 | |
---|
3730 | 3798 | Object3D newgroup = new Object3D("Po:" + poses.name); |
---|
3731 | 3799 | |
---|
.. | .. |
---|
3919 | 3987 | |
---|
3920 | 3988 | void ClipMesh() |
---|
3921 | 3989 | { |
---|
3922 | | - if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1) |
---|
| 3990 | + if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1) |
---|
3923 | 3991 | { |
---|
3924 | | - Object3D content = GrafreeD.clipboard.get(0); |
---|
| 3992 | + Object3D content = Grafreed.clipboard.get(0); |
---|
3925 | 3993 | |
---|
3926 | 3994 | if (content instanceof cGroup && ((cGroup)content).transientlink ) |
---|
3927 | 3995 | content = ((cGroup)content).get(0); |
---|
.. | .. |
---|
3930 | 3998 | // { |
---|
3931 | 3999 | // group.selection.get(i).ClipMesh(GrafreeD.clipboard); |
---|
3932 | 4000 | // } |
---|
3933 | | - group.selection.ClipMesh(GrafreeD.clipboard); |
---|
| 4001 | + group.selection.ClipMesh(Grafreed.clipboard); |
---|
3934 | 4002 | } |
---|
3935 | 4003 | // group.selection.ClipMesh(GrafreeD.clipboard); |
---|
3936 | 4004 | System.out.println("DONE."); |
---|
.. | .. |
---|
4270 | 4338 | { |
---|
4271 | 4339 | if (group.selection.isEmpty()) |
---|
4272 | 4340 | return; |
---|
4273 | | - GrafreeD.clipboardIsTempGroup = false; |
---|
| 4341 | + Grafreed.clipboardIsTempGroup = false; |
---|
4274 | 4342 | Composite tGroup = null; |
---|
4275 | 4343 | if (group.selection.size() > 0) // 1) |
---|
4276 | 4344 | { |
---|
4277 | 4345 | tGroup = new cGroup(); |
---|
4278 | | - GrafreeD.clipboardIsTempGroup = true; |
---|
| 4346 | + Grafreed.clipboardIsTempGroup = true; |
---|
4279 | 4347 | } |
---|
4280 | 4348 | |
---|
4281 | 4349 | if (cut) |
---|
.. | .. |
---|
4315 | 4383 | //System.out.println("cut " + child); |
---|
4316 | 4384 | //System.out.println("parent = " + child.parent); |
---|
4317 | 4385 | // tmp.addChild(child); |
---|
4318 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4386 | + if (Grafreed.clipboardIsTempGroup) |
---|
4319 | 4387 | tGroup.add/*Child*/(tmp); |
---|
4320 | 4388 | else |
---|
4321 | | - GrafreeD.clipboard = tmp; |
---|
| 4389 | + Grafreed.clipboard = tmp; |
---|
4322 | 4390 | } |
---|
4323 | 4391 | else |
---|
4324 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4392 | + if (Grafreed.clipboardIsTempGroup) |
---|
4325 | 4393 | tGroup.add/*Child*/(child); |
---|
4326 | 4394 | else |
---|
4327 | | - GrafreeD.clipboard = child; |
---|
| 4395 | + Grafreed.clipboard = child; |
---|
4328 | 4396 | } |
---|
4329 | 4397 | |
---|
4330 | 4398 | //ResetModel(); |
---|
.. | .. |
---|
4356 | 4424 | //System.out.println("cut " + elem); |
---|
4357 | 4425 | //System.out.println("parent = " + elem.parent); |
---|
4358 | 4426 | // tmp.addChild(elem); |
---|
4359 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4427 | + if (Grafreed.clipboardIsTempGroup) |
---|
4360 | 4428 | tGroup.add/*Child*/(tmp); |
---|
4361 | 4429 | else |
---|
4362 | | - GrafreeD.clipboard = tmp; |
---|
| 4430 | + Grafreed.clipboard = tmp; |
---|
4363 | 4431 | } |
---|
4364 | 4432 | else |
---|
4365 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4433 | + if (Grafreed.clipboardIsTempGroup) |
---|
4366 | 4434 | tGroup.add/*Child*/(child); |
---|
4367 | 4435 | else |
---|
4368 | | - GrafreeD.clipboard = child; |
---|
| 4436 | + Grafreed.clipboard = child; |
---|
4369 | 4437 | } |
---|
4370 | 4438 | |
---|
4371 | 4439 | } |
---|
4372 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
4373 | | - GrafreeD.clipboard = tGroup; |
---|
| 4440 | + if (Grafreed.clipboardIsTempGroup) |
---|
| 4441 | + Grafreed.clipboard = tGroup; |
---|
4374 | 4442 | if (cut) |
---|
4375 | 4443 | { |
---|
4376 | 4444 | ResetModel(); |
---|
.. | .. |
---|
4384 | 4452 | // return; |
---|
4385 | 4453 | boolean first = true; |
---|
4386 | 4454 | |
---|
4387 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4455 | + if (Grafreed.clipboardIsTempGroup) |
---|
4388 | 4456 | { |
---|
4389 | 4457 | Composite temp; |
---|
4390 | 4458 | |
---|
.. | .. |
---|
4395 | 4463 | temp = (Composite)Applet3D.clipboard.deepCopy(); |
---|
4396 | 4464 | */ |
---|
4397 | 4465 | 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)) |
---|
4399 | 4467 | { |
---|
4400 | 4468 | Object3D child = (Object3D)e.nextElement(); |
---|
4401 | 4469 | |
---|
.. | .. |
---|
4429 | 4497 | //Object3D cb = Applet3D.clipboard; |
---|
4430 | 4498 | //temp.addChild(cb); |
---|
4431 | 4499 | //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()); |
---|
4437 | 4505 | 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; |
---|
4440 | 4508 | } |
---|
4441 | 4509 | |
---|
4442 | 4510 | ResetModel(); |
---|
.. | .. |
---|
4485 | 4553 | { |
---|
4486 | 4554 | boolean first = true; |
---|
4487 | 4555 | |
---|
4488 | | - if (GrafreeD.clipboardIsTempGroup) |
---|
| 4556 | + if (Grafreed.clipboardIsTempGroup) |
---|
4489 | 4557 | { |
---|
4490 | | - Composite temp = (Composite)GrafreeD.clipboard; |
---|
| 4558 | + Composite temp = (Composite)Grafreed.clipboard; |
---|
4491 | 4559 | Object3D copy; |
---|
4492 | 4560 | for (Enumeration e = temp.children.elements(); e.hasMoreElements();) |
---|
4493 | 4561 | { |
---|
.. | .. |
---|
4497 | 4565 | } |
---|
4498 | 4566 | } else |
---|
4499 | 4567 | { |
---|
4500 | | - linkSomething(GrafreeD.clipboard); //.get(0)); |
---|
| 4568 | + linkSomething(Grafreed.clipboard); //.get(0)); |
---|
4501 | 4569 | } |
---|
4502 | 4570 | } |
---|
4503 | 4571 | } |
---|
.. | .. |
---|
4942 | 5010 | |
---|
4943 | 5011 | void ImportVRMLX3D() |
---|
4944 | 5012 | { |
---|
4945 | | - if (GrafreeD.standAlone) |
---|
| 5013 | + if (Grafreed.standAlone) |
---|
4946 | 5014 | { |
---|
4947 | 5015 | /**/ |
---|
4948 | 5016 | FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD); |
---|
.. | .. |
---|
4959 | 5027 | |
---|
4960 | 5028 | String GetFile(String dialogName) |
---|
4961 | 5029 | { |
---|
4962 | | - if (GrafreeD.standAlone) |
---|
| 5030 | + if (Grafreed.standAlone) |
---|
4963 | 5031 | { |
---|
4964 | 5032 | FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD); |
---|
4965 | 5033 | browser.show(); |
---|
.. | .. |
---|
5072 | 5140 | private MenuItem linkverticesItem; |
---|
5073 | 5141 | private MenuItem relinkverticesItem; |
---|
5074 | 5142 | private MenuItem setMasterItem; |
---|
5075 | | - private MenuItem resetMeshItem; |
---|
| 5143 | + private MenuItem resetAllItem; |
---|
5076 | 5144 | private MenuItem stepAllItem; |
---|
5077 | 5145 | private MenuItem revertMeshItem; |
---|
5078 | 5146 | private MenuItem poseMeshItem; |
---|
.. | .. |
---|
5133 | 5201 | private MenuItem panoTexturesItem; |
---|
5134 | 5202 | |
---|
5135 | 5203 | private MenuItem resetCentroidItem; |
---|
5136 | | - private MenuItem transformgeometryItem; |
---|
| 5204 | + private MenuItem resetCentroidXZItem; |
---|
5137 | 5205 | private MenuItem resetTransformItem; |
---|
| 5206 | + private MenuItem transformGeometryItem; |
---|
| 5207 | + private MenuItem transformChildrenItem; |
---|
5138 | 5208 | private MenuItem hideItem; |
---|
5139 | 5209 | private MenuItem grabItem; |
---|
5140 | 5210 | private MenuItem backItem; |
---|