.. | .. |
---|
16 | 16 | //import buoy.widget.BFileChooser; |
---|
17 | 17 | |
---|
18 | 18 | class GroupEditor extends ObjEditor implements //iParse, //iCallBack, |
---|
| 19 | + Grafreed.iResourceCallBack, |
---|
19 | 20 | ObjectUI, |
---|
20 | 21 | Runnable, |
---|
21 | 22 | ActionListener, |
---|
.. | .. |
---|
30 | 31 | final String path = "cubemaps/" + f + "-skyboxes/" + s; |
---|
31 | 32 | row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); |
---|
32 | 33 | //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); |
---|
33 | | - skyboxButton.setToolTipText(s); |
---|
| 34 | + skyboxButton.setToolTipText(s.equals("") ? "No background" : s); |
---|
34 | 35 | skyboxButton.addActionListener(new ActionListener() |
---|
35 | 36 | { |
---|
36 | 37 | @Override |
---|
.. | .. |
---|
41 | 42 | }); |
---|
42 | 43 | } |
---|
43 | 44 | |
---|
| 45 | + public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) |
---|
| 46 | + { |
---|
| 47 | + cButton textureButton; |
---|
| 48 | + final String path = "textures/" + f + "/" + c + "/"; // + t; |
---|
| 49 | + row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF)); |
---|
| 50 | + textureButton.setToolTipText(c + count); |
---|
| 51 | + textureButton.addActionListener(new ActionListener() |
---|
| 52 | + { |
---|
| 53 | + @Override |
---|
| 54 | + public void actionPerformed(ActionEvent e) |
---|
| 55 | + { |
---|
| 56 | + ChangeTexture(path + t); |
---|
| 57 | + } |
---|
| 58 | + }); |
---|
| 59 | + } |
---|
| 60 | + |
---|
44 | 61 | public void AddSkyboxTab0(JTabbedPane skyboxpanel) |
---|
45 | 62 | { |
---|
46 | 63 | cGridBag tab0 = new cGridBag().setVertical(true); |
---|
.. | .. |
---|
56 | 73 | cGridBag row5 = new cGridBag(); |
---|
57 | 74 | cGridBag row6 = new cGridBag(); |
---|
58 | 75 | |
---|
59 | | - AddSkyboxButton("default", "rgb", row0); |
---|
| 76 | + AddSkyboxButton("default", "", row0); |
---|
60 | 77 | //AddSkyboxButton("default", "cornell", row0); |
---|
61 | 78 | AddSkyboxButton("penguins", "dust", row0); |
---|
62 | 79 | AddSkyboxButton("penguins", "tropic", row0); |
---|
.. | .. |
---|
311 | 328 | } |
---|
312 | 329 | } |
---|
313 | 330 | |
---|
314 | | - public void ChangeSkybox(String name) |
---|
| 331 | + public void ChangeSkybox(String skybox) |
---|
315 | 332 | { |
---|
316 | | - //cameraView.envyoff = false; |
---|
317 | | - group.skyboxname = name; |
---|
318 | | - group.skyboxext = "jpg"; |
---|
319 | | - cameraView.repaint(); |
---|
| 333 | + if (skybox.endsWith("/")) |
---|
| 334 | + { |
---|
| 335 | + group.skyboxname = null; |
---|
| 336 | + group.skyboxext = null; |
---|
| 337 | + cameraView.repaint(); |
---|
| 338 | + } |
---|
| 339 | + else |
---|
| 340 | + { |
---|
| 341 | + //cameraView.envyoff = false; |
---|
| 342 | + group.skyboxname = skybox; |
---|
| 343 | + group.skyboxext = "jpg"; |
---|
| 344 | + cameraView.repaint(); |
---|
| 345 | + } |
---|
| 346 | + } |
---|
| 347 | + |
---|
| 348 | + public void CreateSkyboxPanel(cGridBag skyboxPanel) |
---|
| 349 | + { |
---|
| 350 | + JTabbedPane skyboxpane = new JTabbedPane(); |
---|
| 351 | + |
---|
| 352 | + AddSkyboxTab0(skyboxpane); |
---|
| 353 | + AddSkyboxTab1(skyboxpane); |
---|
| 354 | + AddSkyboxTab2(skyboxpane); |
---|
| 355 | + AddSkyboxTab3(skyboxpane); |
---|
| 356 | + |
---|
| 357 | + skyboxPanel.add(skyboxpane); |
---|
320 | 358 | } |
---|
321 | 359 | |
---|
| 360 | + public void ChangeTexture(String texture) |
---|
| 361 | + { |
---|
| 362 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 363 | + { |
---|
| 364 | + Object3D obj = group.selection.get(i); |
---|
| 365 | + obj.SetPigmentTexture("@" + texture); |
---|
| 366 | + } |
---|
| 367 | + |
---|
| 368 | + refreshContents(); |
---|
| 369 | + } |
---|
| 370 | + |
---|
| 371 | + public void Show3DView() |
---|
| 372 | + { |
---|
| 373 | + // bug |
---|
| 374 | + //gridPanel.setDividerLocation(1.0); |
---|
| 375 | + //bigPanel.setDividerLocation(0.0); |
---|
| 376 | + bigThree.ClearUI(); |
---|
| 377 | + bigThree.add(centralPanel); |
---|
| 378 | + bigThree.FlushUI(); |
---|
| 379 | + } |
---|
| 380 | + |
---|
322 | 381 | //ObjEditor objEditor; |
---|
323 | 382 | public void closeUI2() |
---|
324 | 383 | { |
---|
.. | .. |
---|
356 | 415 | this.copy = this.group = group; |
---|
357 | 416 | //selectees = this.group.selectees; |
---|
358 | 417 | |
---|
359 | | - if (copy.versions == null) |
---|
| 418 | + assert(false); |
---|
| 419 | + |
---|
| 420 | + if (copy.versionlist == null) |
---|
360 | 421 | { |
---|
361 | | - copy.versions = new byte[100][]; |
---|
| 422 | + copy.versionlist = new Object3D[100]; |
---|
362 | 423 | copy.versionindex = -1; |
---|
| 424 | + |
---|
| 425 | + //Save(true); |
---|
363 | 426 | } |
---|
364 | 427 | |
---|
365 | 428 | if(ui) |
---|
.. | .. |
---|
383 | 446 | |
---|
384 | 447 | ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); |
---|
385 | 448 | |
---|
386 | | - if (copy.versions == null) |
---|
| 449 | + if (copy.versionlist == null) |
---|
387 | 450 | { |
---|
388 | | - copy.versions = new byte[100][]; |
---|
| 451 | + copy.versionlist = new Object3D[100]; |
---|
389 | 452 | copy.versionindex = -1; |
---|
390 | 453 | |
---|
391 | | - Save(true); |
---|
| 454 | + //Save(true); |
---|
392 | 455 | } |
---|
393 | 456 | } |
---|
394 | 457 | |
---|
.. | .. |
---|
479 | 542 | // menu.add("-"); |
---|
480 | 543 | duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
481 | 544 | duplicateItem.addActionListener(this); |
---|
482 | | - cloneItem = menu.add(new MenuItem("Clone")); |
---|
| 545 | + |
---|
| 546 | + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); |
---|
483 | 547 | cloneItem.addActionListener(this); |
---|
484 | | - if (Globals.ADVANCED) |
---|
| 548 | + //if (Globals.ADVANCED) |
---|
485 | 549 | { |
---|
486 | 550 | cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); |
---|
487 | 551 | cloneSupportItem.addActionListener(this); |
---|
488 | 552 | } |
---|
| 553 | + oe.jTree.popup.addSeparator(); |
---|
489 | 554 | menu.add("-"); |
---|
490 | | - cutItem = menu.add(new MenuItem("Cut")); |
---|
| 555 | + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); |
---|
491 | 556 | cutItem.addActionListener(this); |
---|
492 | | - copyItem = menu.add(new MenuItem("Copy")); |
---|
| 557 | + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); |
---|
493 | 558 | copyItem.addActionListener(this); |
---|
494 | 559 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
495 | 560 | pasteItem.addActionListener(this); |
---|
496 | 561 | |
---|
497 | | - menu.add("-"); |
---|
498 | | - pasteIntoItem = menu.add(new MenuItem("Paste into")); |
---|
| 562 | + oe.jTree.popup.addSeparator(); |
---|
| 563 | + //menu.add("-"); |
---|
| 564 | + pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into")); |
---|
499 | 565 | pasteIntoItem.addActionListener(this); |
---|
500 | | - pasteLinkItem = menu.add(new MenuItem("Paste link")); |
---|
| 566 | + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); |
---|
501 | 567 | pasteLinkItem.addActionListener(this); |
---|
502 | | - pasteCloneItem = menu.add(new MenuItem("Paste clone")); |
---|
| 568 | + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); |
---|
503 | 569 | pasteCloneItem.addActionListener(this); |
---|
504 | | -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
| 570 | +// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); |
---|
505 | 571 | // pasteExpandItem.addActionListener(this); |
---|
506 | | - menu.add("-"); |
---|
507 | | - deleteItem = menu.add(new MenuItem("Delete")); |
---|
508 | | - deleteItem.addActionListener(this); |
---|
| 572 | + //menu.add("-"); |
---|
| 573 | + oe.jTree.popup.addSeparator(); |
---|
509 | 574 | |
---|
510 | 575 | if (Globals.ADVANCED) |
---|
511 | 576 | { |
---|
.. | .. |
---|
591 | 656 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
592 | 657 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
593 | 658 | //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
594 | | - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
595 | 659 | oe.cameraMenu.add("-"); |
---|
596 | 660 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
597 | 661 | openWindowItem.addActionListener(this); |
---|
598 | | - editLeafItem.addActionListener(this); |
---|
599 | 662 | lookAtItem.addActionListener(this); |
---|
600 | 663 | //lookFromItem.addActinoListener(this); |
---|
601 | 664 | //switchViewItem.addActionListener(this); |
---|
.. | .. |
---|
642 | 705 | setMasterItem.addActionListener(this); |
---|
643 | 706 | } |
---|
644 | 707 | |
---|
645 | | - oe.menuBar.add(menu = new Menu("Group")); |
---|
646 | | -// grabItem = menu.add(new MenuItem("Grab")); |
---|
647 | | -// grabItem.addActionListener(this); |
---|
| 708 | + oe.menuBar.add(menu = new Menu("Order")); |
---|
| 709 | + |
---|
648 | 710 | backItem = menu.add(new MenuItem("Back")); |
---|
649 | 711 | backItem.addActionListener(this); |
---|
650 | 712 | frontItem = menu.add(new MenuItem("Front")); |
---|
.. | .. |
---|
652 | 714 | // compositeItem = menu.add(new MenuItem("Composite")); |
---|
653 | 715 | // compositeItem.addActionListener(this); |
---|
654 | 716 | |
---|
| 717 | + grabItem = oe.jTree.popup.add(new JMenuItem("Group")); |
---|
| 718 | + grabItem.addActionListener(this); |
---|
| 719 | + |
---|
655 | 720 | if (Globals.ADVANCED) |
---|
656 | 721 | { |
---|
657 | 722 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
658 | 723 | hideItem.addActionListener(this); |
---|
659 | 724 | } |
---|
660 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 725 | + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
661 | 726 | ungroupItem.addActionListener(this); |
---|
| 727 | + |
---|
| 728 | + oe.jTree.popup.addSeparator(); |
---|
| 729 | + |
---|
| 730 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
| 731 | + deleteItem.addActionListener(this); |
---|
662 | 732 | |
---|
663 | 733 | // menu.add("-"); |
---|
664 | 734 | // |
---|
.. | .. |
---|
843 | 913 | shareGeometriesItem.addActionListener(this); |
---|
844 | 914 | mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); |
---|
845 | 915 | mergeGeometriesItem.addActionListener(this); |
---|
| 916 | + menu.add("-"); |
---|
| 917 | + editLeafItem = menu.add(new MenuItem("Edit leaf...")); |
---|
| 918 | + editLeafItem.addActionListener(this); |
---|
846 | 919 | if (Globals.ADVANCED) |
---|
847 | 920 | { |
---|
848 | 921 | // Pretty much the same as duplicate and clone. |
---|
.. | .. |
---|
859 | 932 | buildToolsMenu(menu); |
---|
860 | 933 | } |
---|
861 | 934 | |
---|
| 935 | + JTabbedPane resourcecontainer; |
---|
| 936 | + cGridBag currenttab; |
---|
| 937 | + //boolean added; // patch for jar |
---|
| 938 | + |
---|
| 939 | + int tabcount = 0; |
---|
| 940 | + int colcount = 0; |
---|
| 941 | + int rowcount = 0; |
---|
| 942 | + int texturecount = 0; |
---|
| 943 | + |
---|
| 944 | + int columns = 5; |
---|
| 945 | + int rows = 7; |
---|
| 946 | + |
---|
| 947 | + public void ResourceCallBack(String[] path) |
---|
| 948 | + { |
---|
| 949 | +// for (int i = 0; i < path.length; i++) |
---|
| 950 | +// System.out.print(path[i] + "/"); |
---|
| 951 | +// System.out.println(); |
---|
| 952 | + |
---|
| 953 | + if (//rowcount == 0 || |
---|
| 954 | + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) |
---|
| 955 | + { |
---|
| 956 | + currenttab = new cGridBag(); |
---|
| 957 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 958 | + currenttab.setName(tabname); |
---|
| 959 | + //added = false; |
---|
| 960 | + resourcecontainer.add(currenttab); |
---|
| 961 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 962 | + rowcount = 1; |
---|
| 963 | + colcount = 0; |
---|
| 964 | + texturecount = 0; |
---|
| 965 | + } |
---|
| 966 | + |
---|
| 967 | + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
| 968 | + { |
---|
| 969 | + //if (!added) |
---|
| 970 | + { |
---|
| 971 | + //added = true; |
---|
| 972 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 973 | + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); |
---|
| 974 | + } |
---|
| 975 | + |
---|
| 976 | + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 977 | + |
---|
| 978 | + if (++colcount >= columns) |
---|
| 979 | + { |
---|
| 980 | + colcount = 0; |
---|
| 981 | + currenttab.Return(); |
---|
| 982 | + |
---|
| 983 | + if (rowcount++ >= rows) |
---|
| 984 | + { |
---|
| 985 | + rowcount = 0; |
---|
| 986 | + } |
---|
| 987 | + } |
---|
| 988 | + } |
---|
| 989 | + else |
---|
| 990 | + { |
---|
| 991 | +// if (!path[path.length-1].equals("icons")) |
---|
| 992 | +// resourcecontainer.Return(); |
---|
| 993 | + } |
---|
| 994 | + } |
---|
| 995 | + |
---|
| 996 | + void CreateTexturePanel(cGridBag container) |
---|
| 997 | + { |
---|
| 998 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
| 999 | + container.add(resourcecontainer); |
---|
| 1000 | + |
---|
| 1001 | + Grafreed.ParseResources("textures", this); |
---|
| 1002 | + } |
---|
862 | 1003 | |
---|
863 | 1004 | void SetupUI2(ObjEditor oe) |
---|
864 | 1005 | { |
---|
.. | .. |
---|
877 | 1018 | //new Exception().printStackTrace(); |
---|
878 | 1019 | |
---|
879 | 1020 | oe.radioPanel = new JPanel(new GridBagLayout()); |
---|
880 | | - oe.aConstraints.weightx = 1; |
---|
881 | | - oe.aConstraints.weighty = 0; |
---|
882 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
883 | | - oe.aConstraints.gridwidth = 100; |
---|
884 | | - oe.aConstraints.gridheight = 1; |
---|
885 | 1021 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
886 | 1022 | |
---|
887 | 1023 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
914 | 1050 | |
---|
915 | 1051 | if (Globals.ADVANCED) |
---|
916 | 1052 | { |
---|
917 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
918 | | - maxButton.setToolTipText("Maximize window"); |
---|
919 | | - maxButton.addActionListener(this); |
---|
| 1053 | +// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1054 | +// maxButton.setToolTipText("Maximize window"); |
---|
| 1055 | +// maxButton.addActionListener(this); |
---|
920 | 1056 | } |
---|
| 1057 | + |
---|
| 1058 | + cButton gcButton; |
---|
| 1059 | + |
---|
| 1060 | +// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1061 | +// gcButton.setToolTipText("Garbage collect"); |
---|
| 1062 | +// gcButton.addActionListener(new ActionListener() |
---|
| 1063 | +// { |
---|
| 1064 | +// public void actionPerformed(ActionEvent e) |
---|
| 1065 | +// { |
---|
| 1066 | +// System.gc(); |
---|
| 1067 | +// } |
---|
| 1068 | +// }); |
---|
| 1069 | + |
---|
| 1070 | + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1071 | + collapseButton.setToolTipText("Collapse toolbar"); |
---|
| 1072 | + collapseButton.addActionListener(this); |
---|
| 1073 | + |
---|
| 1074 | + oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1075 | + maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
| 1076 | + maximize3DButton.addActionListener(this); |
---|
| 1077 | + |
---|
| 1078 | + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1079 | + twoButton.setToolTipText("Show 3D view only"); |
---|
| 1080 | + twoButton.addActionListener(this); |
---|
| 1081 | + this.fullscreenLayout = twoButton; |
---|
| 1082 | + |
---|
| 1083 | + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1084 | + threeButton.setToolTipText("Show controls and 3D view"); |
---|
| 1085 | + threeButton.addActionListener(this); |
---|
| 1086 | + if (Globals.ADVANCED) |
---|
| 1087 | + { |
---|
| 1088 | + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1089 | + sixButton.setToolTipText("Show 3D view and controls"); |
---|
| 1090 | + sixButton.addActionListener(this); |
---|
| 1091 | + } |
---|
| 1092 | +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1093 | +// sevenButton.setToolTipText("3-column layout"); |
---|
| 1094 | +// sevenButton.addActionListener(this); |
---|
| 1095 | + // |
---|
921 | 1096 | |
---|
922 | 1097 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
923 | 1098 | fullButton.setToolTipText("Full-screen window"); |
---|
.. | .. |
---|
931 | 1106 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
932 | 1107 | restoreCameraButton.addActionListener(this); |
---|
933 | 1108 | |
---|
934 | | - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
935 | | - saveButton.setToolTipText("New version"); |
---|
936 | | - saveButton.addActionListener(this); |
---|
| 1109 | + copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1110 | + saveVersionButton.setToolTipText("Duplicate current version"); |
---|
| 1111 | + saveVersionButton.addActionListener(this); |
---|
937 | 1112 | |
---|
938 | | - copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
939 | | - undoButton.setToolTipText("Previous version"); |
---|
940 | | - undoButton.addActionListener(this); |
---|
941 | | - undoButton.setEnabled(false); |
---|
| 1113 | + copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1114 | + deleteVersionButton.setToolTipText("Delete current version"); |
---|
| 1115 | + deleteVersionButton.addActionListener(this); |
---|
| 1116 | + deleteVersionButton.setEnabled(false); |
---|
| 1117 | + |
---|
| 1118 | + copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1119 | + previousVersionButton.setToolTipText("Previous version"); |
---|
| 1120 | + previousVersionButton.addActionListener(this); |
---|
| 1121 | + previousVersionButton.setEnabled(false); |
---|
942 | 1122 | |
---|
943 | 1123 | cGridBag updown = new cGridBag().setVertical(true); |
---|
944 | 1124 | updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
945 | | - restoreButton.setToolTipText("Restore current"); |
---|
| 1125 | + restoreButton.setToolTipText("Undo (restore current version)"); |
---|
946 | 1126 | restoreButton.addActionListener(this); |
---|
947 | 1127 | restoreButton.setEnabled(false); |
---|
948 | 1128 | |
---|
949 | 1129 | updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
950 | | - replaceButton.setToolTipText("Replace current"); |
---|
| 1130 | + replaceButton.setToolTipText("Save (replace current version)"); |
---|
951 | 1131 | replaceButton.addActionListener(this); |
---|
952 | 1132 | replaceButton.setEnabled(false); |
---|
953 | 1133 | |
---|
954 | 1134 | copyOptionsPanel.add(updown); |
---|
955 | 1135 | |
---|
956 | | - copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
957 | | - redoButton.setToolTipText("Next version"); |
---|
958 | | - redoButton.addActionListener(this); |
---|
959 | | - redoButton.setEnabled(false); |
---|
| 1136 | + copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1137 | + nextVersionButton.setToolTipText("Next version"); |
---|
| 1138 | + nextVersionButton.addActionListener(this); |
---|
| 1139 | + nextVersionButton.setEnabled(false); |
---|
| 1140 | + |
---|
| 1141 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1142 | + oneStepButton.setToolTipText("Animate one step forward"); |
---|
| 1143 | + oneStepButton.addActionListener(this); |
---|
960 | 1144 | |
---|
961 | 1145 | oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
962 | 1146 | liveCB.setToolTipText("Enable animation"); |
---|
963 | 1147 | liveCB.addItemListener(this); |
---|
964 | 1148 | |
---|
965 | | - oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
966 | | - oneStepButton.setToolTipText("Animate one step forward"); |
---|
967 | | - oneStepButton.addActionListener(this); |
---|
968 | | - |
---|
969 | 1149 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
970 | 1150 | fastCB.setToolTipText("Fast mode"); |
---|
971 | 1151 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
992 | 1172 | |
---|
993 | 1173 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
994 | 1174 | |
---|
995 | | - oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
996 | | - twoButton.setToolTipText("Show 3D view only"); |
---|
997 | | - twoButton.addActionListener(this); |
---|
998 | | - this.fullscreenLayout = twoButton; |
---|
999 | | - |
---|
1000 | | - oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1001 | | - threeButton.setToolTipText("Show controls and 3D view"); |
---|
1002 | | - threeButton.addActionListener(this); |
---|
1003 | | - oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1004 | | - sixButton.setToolTipText("Show 3D view and controls"); |
---|
1005 | | - sixButton.addActionListener(this); |
---|
1006 | | -// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1007 | | -// sevenButton.setToolTipText("3-column layout"); |
---|
1008 | | -// sevenButton.addActionListener(this); |
---|
1009 | | - // |
---|
1010 | 1175 | |
---|
1011 | 1176 | oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1012 | 1177 | rootButton.setToolTipText("Open selection in new tab"); |
---|
.. | .. |
---|
1022 | 1187 | |
---|
1023 | 1188 | // INSERT |
---|
1024 | 1189 | row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1025 | | - gridButton.setToolTipText("Create grid"); |
---|
| 1190 | + gridButton.setToolTipText("Create ground"); |
---|
1026 | 1191 | gridButton.addActionListener(this); |
---|
1027 | 1192 | |
---|
1028 | 1193 | row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1029 | 1194 | boxButton.setToolTipText("Create box"); |
---|
1030 | 1195 | boxButton.addActionListener(this); |
---|
| 1196 | + |
---|
| 1197 | + row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1198 | + superButton.setToolTipText("Create superellipsoid"); |
---|
| 1199 | + superButton.addActionListener(this); |
---|
1031 | 1200 | |
---|
1032 | 1201 | row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1033 | 1202 | sphereButton.setToolTipText("Create sphere"); |
---|
.. | .. |
---|
1040 | 1209 | row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1041 | 1210 | torusButton.setToolTipText("Create torus"); |
---|
1042 | 1211 | torusButton.addActionListener(this); |
---|
1043 | | - |
---|
1044 | | - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1045 | | - superButton.setToolTipText("Create superellipsoid"); |
---|
1046 | | - superButton.addActionListener(this); |
---|
1047 | 1212 | |
---|
1048 | 1213 | if (Globals.ADVANCED) |
---|
1049 | 1214 | { |
---|
.. | .. |
---|
1090 | 1255 | |
---|
1091 | 1256 | oe.toolboxPanel.add(row2); |
---|
1092 | 1257 | |
---|
1093 | | - // ENVYMAPS |
---|
1094 | | - cGridBag skyboxpane = new cGridBag(); |
---|
1095 | | - skyboxpane.preferredHeight = 100; |
---|
| 1258 | + cGridBag textures = new cGridBag(); |
---|
1096 | 1259 | |
---|
1097 | | - oe.toolboxPanel.add(skyboxpane); |
---|
| 1260 | + CreateTexturePanel(textures); |
---|
1098 | 1261 | |
---|
1099 | | - JTabbedPane skyboxpanel = new JTabbedPane(); |
---|
1100 | | - skyboxpane.add(skyboxpanel); |
---|
| 1262 | + resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount())); |
---|
1101 | 1263 | |
---|
1102 | | - AddSkyboxTab0(skyboxpanel); |
---|
1103 | | - AddSkyboxTab1(skyboxpanel); |
---|
1104 | | - AddSkyboxTab2(skyboxpanel); |
---|
1105 | | - AddSkyboxTab3(skyboxpanel); |
---|
| 1264 | + oe.toolboxPanel.add(textures); |
---|
| 1265 | + |
---|
| 1266 | + textures.preferredHeight = 100; |
---|
| 1267 | + |
---|
| 1268 | + CreateSkyboxPanel(oe.skyboxPanel); |
---|
1106 | 1269 | |
---|
1107 | 1270 | // EDIT panel |
---|
1108 | 1271 | editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1110 | 1273 | editButton.addActionListener(this); |
---|
1111 | 1274 | |
---|
1112 | 1275 | editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1113 | | - uneditButton.setToolTipText("Remove selection controls"); |
---|
| 1276 | + uneditButton.setToolTipText("Unpin and remove selection controls"); |
---|
1114 | 1277 | uneditButton.addActionListener(this); |
---|
1115 | 1278 | |
---|
1116 | 1279 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
1117 | | - allParamsButton.setToolTipText("Show all controle"); |
---|
| 1280 | + allParamsButton.setToolTipText("Show all controls"); |
---|
1118 | 1281 | allParamsButton.addActionListener(this); |
---|
1119 | 1282 | |
---|
1120 | | - editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1121 | | - clearPanelButton.setToolTipText("Clear edit panel"); |
---|
| 1283 | + editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1284 | + clearPanelButton.setToolTipText("Clear all controls"); |
---|
1122 | 1285 | clearPanelButton.addActionListener(this); |
---|
1123 | 1286 | |
---|
1124 | | - editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1125 | | - unselectButton.setToolTipText("Unselect"); |
---|
1126 | | - unselectButton.addActionListener(this); |
---|
| 1287 | + //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1288 | + //unselectButton.setToolTipText("Unselect"); |
---|
| 1289 | + //unselectButton.addActionListener(this); |
---|
1127 | 1290 | |
---|
1128 | 1291 | editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1129 | 1292 | flashSelectionButton.setToolTipText("Highlight selection"); |
---|
.. | .. |
---|
1183 | 1346 | dgr.addDragGestureListener(this); |
---|
1184 | 1347 | }catch(Exception e) {} |
---|
1185 | 1348 | */ |
---|
1186 | | - radio.layout = sixButton; // sevenButton; |
---|
| 1349 | + radio.layout = threeButton; // sixButton; |
---|
1187 | 1350 | oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
1188 | 1351 | } |
---|
1189 | 1352 | |
---|
.. | .. |
---|
1234 | 1397 | smoothCB.setToolTipText("Snapping delay"); |
---|
1235 | 1398 | smoothCB.addItemListener(this); |
---|
1236 | 1399 | |
---|
1237 | | - panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints); |
---|
1238 | | - slowCB.setToolTipText("Smooth interpolation"); |
---|
1239 | | - slowCB.addItemListener(this); |
---|
| 1400 | +// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints); |
---|
| 1401 | +// slowCB.setToolTipText("Smooth interpolation"); |
---|
| 1402 | +// slowCB.addItemListener(this); |
---|
| 1403 | + panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints); |
---|
| 1404 | + minshaderCB.setToolTipText("Minimal fast shader"); |
---|
| 1405 | + minshaderCB.addItemListener(this); |
---|
1240 | 1406 | |
---|
1241 | 1407 | // constraints.gridy += 1; |
---|
1242 | 1408 | // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints); |
---|
.. | .. |
---|
1315 | 1481 | |
---|
1316 | 1482 | void EditObject(Object3D obj) |
---|
1317 | 1483 | { |
---|
| 1484 | + assert(obj instanceof Composite); |
---|
| 1485 | + |
---|
| 1486 | +// if (obj.versionlist == null) |
---|
| 1487 | +// { |
---|
| 1488 | +// obj.versionlist = new Object3D[100]; |
---|
| 1489 | +// obj.versionindex = -1; |
---|
| 1490 | +// } |
---|
| 1491 | + |
---|
1318 | 1492 | cRadio radioButton = new cRadio(obj.name); |
---|
1319 | 1493 | |
---|
1320 | 1494 | // June 2019. Patch to avoid bug with transparency. |
---|
.. | .. |
---|
1325 | 1499 | } |
---|
1326 | 1500 | |
---|
1327 | 1501 | radioButton.SetObject(obj); |
---|
1328 | | - radioButton.layout = sixButton; // sevenButton; |
---|
| 1502 | + radioButton.layout = threeButton; // sixButton; |
---|
1329 | 1503 | radioButton.SetCamera(cameraView.renderCamera, false); |
---|
1330 | 1504 | radioButton.addActionListener(this); |
---|
1331 | 1505 | radioPanel.add(radioButton); |
---|
.. | .. |
---|
1339 | 1513 | |
---|
1340 | 1514 | oe.SetupViews(); |
---|
1341 | 1515 | |
---|
| 1516 | + if (Globals.DEBUG) |
---|
1342 | 1517 | System.out.println("SetupViews"); |
---|
1343 | 1518 | DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( |
---|
1344 | 1519 | oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? |
---|
.. | .. |
---|
1350 | 1525 | cCheckBox localCB; |
---|
1351 | 1526 | cCheckBox crowdCB; |
---|
1352 | 1527 | cCheckBox smoothCB; |
---|
| 1528 | + cCheckBox minshaderCB; |
---|
| 1529 | + |
---|
1353 | 1530 | cToggleButton fastCB; |
---|
1354 | 1531 | cCheckBox slowCB; |
---|
1355 | 1532 | cCheckBox boxCB; |
---|
.. | .. |
---|
1420 | 1597 | { |
---|
1421 | 1598 | cameraView.ToggleInertia(); |
---|
1422 | 1599 | cameraView.repaint(); |
---|
| 1600 | + } |
---|
| 1601 | + else if(e.getSource() == minshaderCB) |
---|
| 1602 | + { |
---|
| 1603 | + Globals.MINSHADER ^= true; |
---|
| 1604 | + cameraView.programInitialized = false; |
---|
| 1605 | + cameraView.repaint(); |
---|
1423 | 1606 | } |
---|
1424 | 1607 | else if(e.getSource() == localCB) |
---|
1425 | 1608 | { |
---|
.. | .. |
---|
1697 | 1880 | TreePath path; |
---|
1698 | 1881 | |
---|
1699 | 1882 | public TransferableTreePath(TreePath tp) { |
---|
1700 | | - path = tp; |
---|
| 1883 | + Object[] objs = new Object[tp.getPathCount()]; |
---|
| 1884 | + for (int i=0; i<objs.length; i++) |
---|
| 1885 | + { |
---|
| 1886 | + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); |
---|
| 1887 | + } |
---|
| 1888 | + path = new TreePath(objs); |
---|
1701 | 1889 | } |
---|
1702 | 1890 | |
---|
1703 | 1891 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
1987 | 2175 | shadow.material = new cMaterial(obj.material); |
---|
1988 | 2176 | shadow.material.diffuse = 0.0001f; |
---|
1989 | 2177 | shadow.material.specular = 0.0001f; |
---|
1990 | | - //shadow.projectedVertices[1].x = 300; |
---|
| 2178 | + shadow.material.opacity = 0.75f; |
---|
| 2179 | + |
---|
| 2180 | + AllocProjectedVertices(shadow); |
---|
| 2181 | + |
---|
| 2182 | + shadow.projectedVertices[1].x = 300; |
---|
1991 | 2183 | |
---|
1992 | 2184 | makeSomething(shadow); |
---|
1993 | 2185 | } |
---|
.. | .. |
---|
2508 | 2700 | } else |
---|
2509 | 2701 | if (source == loopItem || source == loopButton) |
---|
2510 | 2702 | { |
---|
| 2703 | + if (!group.selection.isEmpty()) |
---|
| 2704 | + { |
---|
2511 | 2705 | Composite csg = new GroupLeaf(); |
---|
2512 | 2706 | csg.count = 5; |
---|
2513 | | - group(csg); |
---|
2514 | 2707 | Composite child = new cGroup("Branch"); |
---|
2515 | 2708 | csg.addChild(child); |
---|
2516 | 2709 | child.addChild(csg); |
---|
| 2710 | + group(csg); |
---|
| 2711 | + } |
---|
2517 | 2712 | } else |
---|
2518 | 2713 | if (source == doubleItem) |
---|
2519 | 2714 | { |
---|
| 2715 | + if (!group.selection.isEmpty()) |
---|
| 2716 | + { |
---|
2520 | 2717 | Composite csg = new GroupLeaf("Fork"); |
---|
2521 | 2718 | csg.count = 5; |
---|
2522 | | - group(csg); |
---|
2523 | 2719 | Composite child = new cGroup("Branch A"); |
---|
2524 | 2720 | csg.addChild(child); |
---|
2525 | 2721 | child.addChild(csg); |
---|
2526 | 2722 | child = new cGroup("Branch B"); |
---|
2527 | 2723 | csg.addChild(child); |
---|
2528 | 2724 | child.addChild(csg); |
---|
| 2725 | + group(csg); |
---|
| 2726 | + } |
---|
2529 | 2727 | } else |
---|
2530 | 2728 | if (source == tripleItem) |
---|
2531 | 2729 | { |
---|
| 2730 | + if (!group.selection.isEmpty()) |
---|
| 2731 | + { |
---|
2532 | 2732 | Composite csg = new GroupLeaf("Trident"); |
---|
2533 | 2733 | csg.count = 4; |
---|
2534 | 2734 | group(csg); |
---|
.. | .. |
---|
2541 | 2741 | child = new cGroup(); |
---|
2542 | 2742 | csg.addChild(child); |
---|
2543 | 2743 | child.addChild(csg); |
---|
| 2744 | + } |
---|
2544 | 2745 | } else |
---|
2545 | 2746 | if (source == computeAOItem) |
---|
2546 | 2747 | { |
---|
.. | .. |
---|
2560 | 2761 | if (source == invariantsItem) |
---|
2561 | 2762 | { |
---|
2562 | 2763 | System.out.println("Invariants:"); |
---|
2563 | | - Grafreed.grafreeD.universe.invariants(); |
---|
| 2764 | + Grafreed.grafreed.universe.invariants(); |
---|
2564 | 2765 | } else |
---|
2565 | 2766 | if (source == memoryItem) |
---|
2566 | 2767 | { |
---|
.. | .. |
---|
2591 | 2792 | { |
---|
2592 | 2793 | ToggleFullScreen(); |
---|
2593 | 2794 | } else |
---|
2594 | | - if (source == undoButton) |
---|
| 2795 | + if (source == collapseButton) |
---|
| 2796 | + { |
---|
| 2797 | + this.expandedLayout = radio.layout; |
---|
| 2798 | + CollapseToolbar(); |
---|
| 2799 | + } else |
---|
| 2800 | + if (source == maximize3DButton) |
---|
| 2801 | + { |
---|
| 2802 | + this.expandedLayout = radio.layout; |
---|
| 2803 | + radio.layout = twoButton; |
---|
| 2804 | + Show3DView(); |
---|
| 2805 | + CollapseToolbar(); |
---|
| 2806 | + } else |
---|
| 2807 | + if (source == previousVersionButton) |
---|
2595 | 2808 | { |
---|
2596 | 2809 | // Go to previous version |
---|
2597 | 2810 | //if (!Undo()) |
---|
2598 | 2811 | //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2599 | | - Undo(); |
---|
| 2812 | + PreviousVersion(); |
---|
2600 | 2813 | } else |
---|
2601 | 2814 | if (source == restoreButton) |
---|
2602 | 2815 | { |
---|
2603 | 2816 | // Restore current version |
---|
2604 | 2817 | Restore(); |
---|
| 2818 | + //restoreButton.setEnabled(false); |
---|
2605 | 2819 | } else |
---|
2606 | 2820 | if (source == replaceButton) |
---|
2607 | 2821 | { |
---|
2608 | 2822 | // Overwrite current version |
---|
2609 | 2823 | Replace(); |
---|
| 2824 | + //replaceButton.setEnabled(false); |
---|
2610 | 2825 | } else |
---|
2611 | | - if (source == redoButton) |
---|
| 2826 | + if (source == nextVersionButton) |
---|
2612 | 2827 | { |
---|
2613 | 2828 | // Go to next version |
---|
2614 | | - Redo(); |
---|
| 2829 | + NextVersion(); |
---|
2615 | 2830 | } else |
---|
2616 | | - if (source == saveButton) |
---|
| 2831 | + if (source == saveVersionButton) |
---|
2617 | 2832 | { |
---|
2618 | 2833 | // Save a new version |
---|
2619 | 2834 | if (!Save(true)) |
---|
2620 | 2835 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 2836 | + } else |
---|
| 2837 | + if (source == deleteVersionButton) |
---|
| 2838 | + { |
---|
| 2839 | + // Delete a new version |
---|
| 2840 | + DeleteVersion(); |
---|
2621 | 2841 | } else |
---|
2622 | 2842 | if (source == oneStepButton) |
---|
2623 | 2843 | { |
---|
.. | .. |
---|
2672 | 2892 | } else |
---|
2673 | 2893 | if (source == undoItem) |
---|
2674 | 2894 | { |
---|
2675 | | - Undo(); |
---|
| 2895 | + PreviousVersion(); |
---|
2676 | 2896 | } else |
---|
2677 | 2897 | if (source == redoItem) |
---|
2678 | 2898 | { |
---|
2679 | | - Redo(); |
---|
| 2899 | + NextVersion(); |
---|
2680 | 2900 | } else |
---|
2681 | 2901 | if (source == duplicateItem) |
---|
2682 | 2902 | { |
---|
.. | .. |
---|
3157 | 3377 | } else |
---|
3158 | 3378 | if (source == ungroupItem || source == ungroupButton) |
---|
3159 | 3379 | { |
---|
3160 | | - boolean hasRoot = false; |
---|
| 3380 | + boolean canUngroup = true; |
---|
3161 | 3381 | |
---|
3162 | 3382 | for (int i=0; i<group.selection.size(); i++) |
---|
3163 | 3383 | { |
---|
3164 | | - if (group.selection.get(i) == group) |
---|
| 3384 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3385 | + |
---|
| 3386 | + if (selectedItem.Size() == 0) |
---|
3165 | 3387 | { |
---|
3166 | | - hasRoot = true; |
---|
| 3388 | + // Cannot ungroup leaves |
---|
| 3389 | + canUngroup = false; |
---|
| 3390 | + break; |
---|
| 3391 | + } |
---|
| 3392 | + |
---|
| 3393 | + if (selectedItem == group) |
---|
| 3394 | + { |
---|
| 3395 | + // Cannot ungroup root |
---|
| 3396 | + canUngroup = false; |
---|
3167 | 3397 | break; |
---|
3168 | 3398 | } |
---|
3169 | 3399 | } |
---|
3170 | 3400 | |
---|
3171 | | - if (!hasRoot) |
---|
| 3401 | + if (canUngroup) |
---|
3172 | 3402 | { |
---|
3173 | 3403 | for (int i=0; i<group.selection.size(); i++) |
---|
3174 | 3404 | { |
---|
3175 | | - Ungroup(group.selection.get(i)); |
---|
| 3405 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3406 | + |
---|
| 3407 | + Ungroup(selectedItem); |
---|
3176 | 3408 | } |
---|
3177 | 3409 | |
---|
3178 | 3410 | ClearSelection(false); |
---|
.. | .. |
---|
3535 | 3767 | if (CameraPane.FULLSCREEN) |
---|
3536 | 3768 | fullscreenLayout = radio.layout; |
---|
3537 | 3769 | |
---|
3538 | | - // bug |
---|
3539 | | - //gridPanel.setDividerLocation(1.0); |
---|
3540 | | - //bigPanel.setDividerLocation(0.0); |
---|
3541 | | -// bigThree.remove(scenePanel); |
---|
3542 | | -// bigThree.remove(centralPanel); |
---|
3543 | | -// bigThree.remove(XYZPanel); |
---|
3544 | | -// aWindowConstraints.gridx = 0; |
---|
3545 | | -// aWindowConstraints.gridy = 0; |
---|
3546 | | -// aWindowConstraints.gridwidth = 1; |
---|
3547 | | -// // aConstraints.gridheight = 3; |
---|
3548 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3549 | | -// aWindowConstraints.weightx = 0; |
---|
3550 | | -// aWindowConstraints.weighty = 1; |
---|
3551 | | -// //bigThree.add(jtp, aWindowConstraints); |
---|
3552 | | -// aWindowConstraints.weightx = 1; |
---|
3553 | | -// aWindowConstraints.gridwidth = 3; |
---|
3554 | | -// // aConstraints.gridheight = 3; |
---|
3555 | | -// aWindowConstraints.gridx = 1; |
---|
3556 | | -// aWindowConstraints.fill = GridBagConstraints.BOTH; |
---|
3557 | | -// bigThree.add(centralPanel, aWindowConstraints); |
---|
3558 | | -// aWindowConstraints.weightx = 0; |
---|
3559 | | -// aWindowConstraints.gridx = 4; |
---|
3560 | | -// aWindowConstraints.gridwidth = 1; |
---|
3561 | | -// // aConstraints.gridheight = 3; |
---|
3562 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3563 | | -// //bigThree.add(XYZPanel, aWindowConstraints); |
---|
3564 | | -// scenePanel.setVisible(false); |
---|
3565 | | -// centralPanel.setVisible(true); |
---|
3566 | | -// XYZPanel.setVisible(false); |
---|
3567 | | - bigThree.ClearUI(); |
---|
3568 | | - bigThree.add(centralPanel); |
---|
3569 | | - bigThree.FlushUI(); |
---|
| 3770 | + Show3DView(); |
---|
3570 | 3771 | |
---|
3571 | 3772 | cameraView.requestFocusInWindow(); |
---|
3572 | 3773 | |
---|
.. | .. |
---|
3752 | 3953 | } else |
---|
3753 | 3954 | if (source == rootButton) |
---|
3754 | 3955 | { |
---|
| 3956 | + Replace(); |
---|
3755 | 3957 | Object3D obj; |
---|
3756 | 3958 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3757 | 3959 | { |
---|
.. | .. |
---|
3809 | 4011 | { |
---|
3810 | 4012 | Object3D child = (Object3D)e.nextElement(); |
---|
3811 | 4013 | if(child.editWindow != null) |
---|
3812 | | - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3813 | 4014 | child.pinned = false; |
---|
3814 | 4015 | child.CloseUI(); |
---|
3815 | 4016 | listUI.remove(child); |
---|
| 4017 | +// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3816 | 4018 | |
---|
3817 | 4019 | //child.editWindow = null; // ??????????? |
---|
3818 | 4020 | } |
---|
.. | .. |
---|
3831 | 4033 | obj.CloseUI(); |
---|
3832 | 4034 | } |
---|
3833 | 4035 | listUI.clear(); |
---|
| 4036 | + SetPinStates(group.selection.size() > 0); |
---|
3834 | 4037 | refreshContents(true); |
---|
3835 | 4038 | } else |
---|
3836 | 4039 | if (source == allParamsButton) |
---|
.. | .. |
---|
3887 | 4090 | |
---|
3888 | 4091 | copy = group; |
---|
3889 | 4092 | |
---|
3890 | | - SetUndoStates(); |
---|
3891 | | - |
---|
3892 | 4093 | //Globals.theRenderer.object = group; |
---|
3893 | 4094 | if(!useclient) |
---|
3894 | 4095 | { |
---|
.. | .. |
---|
3916 | 4117 | */ |
---|
3917 | 4118 | radio.layout.doClick(); |
---|
3918 | 4119 | |
---|
| 4120 | + assert(copy instanceof Composite); |
---|
| 4121 | + |
---|
| 4122 | + if (copy.versionlist == null) |
---|
| 4123 | + { |
---|
| 4124 | + copy.versionlist = new Object3D[100]; |
---|
| 4125 | + copy.versionindex = -1; |
---|
| 4126 | + |
---|
| 4127 | + // Cannot work with loops |
---|
| 4128 | + // To fix this issue, first mark all nodes above the root, |
---|
| 4129 | + // and check if any of these nodes are reachable below the root. |
---|
| 4130 | + //Save(true); |
---|
| 4131 | + } |
---|
| 4132 | + |
---|
| 4133 | + SetVersionStates(); |
---|
| 4134 | + |
---|
3919 | 4135 | ClearUnpinned(); |
---|
| 4136 | + |
---|
3920 | 4137 | //Grafreed.Assert(group != null); |
---|
3921 | 4138 | //Grafreed.Assert(group.selection != null); |
---|
3922 | 4139 | SetPinStates(group.selection == null || group.selection.size() > 0); |
---|
.. | .. |
---|
3933 | 4150 | } else if (event.getSource() == editCameraItem) |
---|
3934 | 4151 | { |
---|
3935 | 4152 | cameraView.ProtectCamera(); |
---|
| 4153 | + cameraView.requestFocusInWindow(); |
---|
3936 | 4154 | cameraView.repaint(); |
---|
3937 | 4155 | return; |
---|
3938 | 4156 | } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton) |
---|
3939 | 4157 | { |
---|
3940 | 4158 | cameraView.RevertCamera(); |
---|
| 4159 | + cameraView.requestFocusInWindow(); |
---|
3941 | 4160 | cameraView.repaint(); |
---|
3942 | 4161 | return; |
---|
3943 | 4162 | // } else if (event.getSource() == textureButton) |
---|
.. | .. |
---|
5070 | 5289 | |
---|
5071 | 5290 | freezemodel = false; |
---|
5072 | 5291 | } |
---|
5073 | | - |
---|
5074 | | - boolean flashIt = true; |
---|
5075 | | - |
---|
| 5292 | + |
---|
5076 | 5293 | public void valueChanged(TreeSelectionEvent e) |
---|
5077 | 5294 | //public boolean handleEvent(Event event) |
---|
5078 | 5295 | { |
---|
.. | .. |
---|
5145 | 5362 | { |
---|
5146 | 5363 | editButton.setEnabled(enabled); |
---|
5147 | 5364 | uneditButton.setEnabled(enabled); |
---|
5148 | | - unselectButton.setEnabled(enabled); |
---|
| 5365 | + //unselectButton.setEnabled(enabled); |
---|
5149 | 5366 | flashSelectionButton.setEnabled(enabled); |
---|
| 5367 | + |
---|
| 5368 | + clearPanelButton.setEnabled(!listUI.isEmpty()); |
---|
| 5369 | + |
---|
| 5370 | + boolean allComposites = true; |
---|
| 5371 | + |
---|
| 5372 | + if (group.selection != null) |
---|
| 5373 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 5374 | + { |
---|
| 5375 | + Object next = e.nextElement(); |
---|
| 5376 | + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) |
---|
| 5377 | + { |
---|
| 5378 | + allComposites = false; |
---|
| 5379 | + break; |
---|
| 5380 | + } |
---|
| 5381 | + } |
---|
| 5382 | + |
---|
| 5383 | + rootButton.setEnabled(allComposites); |
---|
5150 | 5384 | } |
---|
5151 | 5385 | |
---|
5152 | 5386 | void refreshContents(boolean cp) |
---|
5153 | 5387 | { |
---|
5154 | | - if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
| 5388 | + //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
5155 | 5389 | if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
5156 | 5390 | { |
---|
5157 | 5391 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
.. | .. |
---|
5161 | 5395 | Object3D child = (Object3D) group.selection.get(i); |
---|
5162 | 5396 | |
---|
5163 | 5397 | objEditor.AddInfo(child, this, true); |
---|
5164 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5398 | +// System.err.println("info : " + child.GetPath()); |
---|
5165 | 5399 | } |
---|
5166 | 5400 | |
---|
5167 | 5401 | objEditor.SetText(); // jan 2014 |
---|
.. | .. |
---|
5987 | 6221 | |
---|
5988 | 6222 | cButton restoreCameraButton; |
---|
5989 | 6223 | |
---|
5990 | | - cButton saveButton; |
---|
5991 | 6224 | cButton oneStepButton; |
---|
5992 | 6225 | |
---|
5993 | 6226 | cButton groupButton; |
---|
.. | .. |
---|
6045 | 6278 | private MenuItem lookAtItem; |
---|
6046 | 6279 | private MenuItem lookFromItem; |
---|
6047 | 6280 | private MenuItem switchViewItem; |
---|
6048 | | - private MenuItem cutItem; |
---|
| 6281 | + private JMenuItem cutItem; |
---|
6049 | 6282 | private MenuItem undoItem; |
---|
6050 | 6283 | private MenuItem redoItem; |
---|
6051 | 6284 | private JMenuItem duplicateItem; |
---|
6052 | | - private MenuItem cloneItem; |
---|
| 6285 | + private JMenuItem cloneItem; |
---|
6053 | 6286 | private MenuItem cloneSupportItem; |
---|
6054 | 6287 | private MenuItem overwriteGeoItem; |
---|
6055 | 6288 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6070 | 6303 | private MenuItem cloneGeometriesItem; |
---|
6071 | 6304 | private MenuItem shareGeometriesItem; |
---|
6072 | 6305 | private MenuItem mergeGeometriesItem; |
---|
6073 | | - private MenuItem copyItem; |
---|
| 6306 | + private JMenuItem copyItem; |
---|
6074 | 6307 | private MenuItem pasteItem; |
---|
6075 | | - private MenuItem pasteIntoItem; |
---|
6076 | | - private MenuItem pasteLinkItem; |
---|
6077 | | - private MenuItem pasteCloneItem; |
---|
6078 | | - private MenuItem pasteExpandItem; |
---|
6079 | | - private MenuItem deleteItem; |
---|
| 6308 | + private JMenuItem pasteIntoItem; |
---|
| 6309 | + private JMenuItem pasteLinkItem; |
---|
| 6310 | + private JMenuItem pasteCloneItem; |
---|
| 6311 | + private JMenuItem pasteExpandItem; |
---|
| 6312 | + private JMenuItem deleteItem; |
---|
6080 | 6313 | private MenuItem clearAllItem; |
---|
6081 | 6314 | private MenuItem genUVItem; |
---|
6082 | 6315 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6131 | 6364 | private MenuItem transformGeometryItem; |
---|
6132 | 6365 | private MenuItem transformChildrenItem; |
---|
6133 | 6366 | private MenuItem hideItem; |
---|
6134 | | - private MenuItem grabItem; |
---|
| 6367 | + private JMenuItem grabItem; |
---|
6135 | 6368 | private MenuItem backItem; |
---|
6136 | 6369 | private MenuItem frontItem; |
---|
6137 | 6370 | private MenuItem cameraItem; |
---|
.. | .. |
---|
6144 | 6377 | private MenuItem switchTransfoItem; |
---|
6145 | 6378 | private MenuItem morphItem; |
---|
6146 | 6379 | private MenuItem linkerItem; |
---|
6147 | | - private MenuItem ungroupItem; |
---|
| 6380 | + private JMenuItem ungroupItem; |
---|
6148 | 6381 | private MenuItem editItem; |
---|
6149 | 6382 | private MenuItem openWindowItem; |
---|
6150 | 6383 | private MenuItem editLeafItem; |
---|