.. | .. |
---|
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); |
---|
63 | | - AddSkyboxButton("default", "skycube", row0); |
---|
| 80 | + AddSkyboxButton("penguins", "yonder", row0); |
---|
64 | 81 | |
---|
65 | 82 | AddSkyboxButton("default", "uffizi", row1); |
---|
66 | 83 | AddSkyboxButton("bridge", "Bridge", row1); |
---|
.. | .. |
---|
90 | 107 | AddSkyboxButton("park", "Skansen3", row6); |
---|
91 | 108 | AddSkyboxButton("park", "Skansen4", row6); |
---|
92 | 109 | AddSkyboxButton("park", "Skansen5", row6); |
---|
93 | | - AddSkyboxButton("park", "Stairs", row6); |
---|
| 110 | + AddSkyboxButton("persson", "VancouverConventionCentre", row6); |
---|
94 | 111 | |
---|
95 | 112 | tab0.add(row0); |
---|
96 | 113 | tab0.add(row1); |
---|
.. | .. |
---|
144 | 161 | |
---|
145 | 162 | AddSkyboxButton("mountain", "Maskonaive2", row4); |
---|
146 | 163 | AddSkyboxButton("mountain", "Maskonaive3", row4); |
---|
147 | | - AddSkyboxButton("mountain", "Ryfjallet", row4); |
---|
148 | 164 | AddSkyboxButton("mountain", "Teide", row4); |
---|
149 | 165 | AddSkyboxButton("park", "Tantolunden4", row4); |
---|
150 | 166 | |
---|
151 | | - AddSkyboxButton("penguins", "wrath", row5); |
---|
152 | | - AddSkyboxButton("penguins", "yonder", row5); |
---|
| 167 | + AddSkyboxButton("park", "Stairs", row5); |
---|
| 168 | + AddSkyboxButton("default", "skycube", row6); |
---|
153 | 169 | AddSkyboxButton("rocky", "Langholmen", row5); |
---|
154 | 170 | AddSkyboxButton("rocky", "Skinnarviksberget", row5); |
---|
155 | | - AddSkyboxButton("rocky", "Tantolunden6", row5); |
---|
156 | 171 | |
---|
| 172 | + AddSkyboxButton("rocky", "Tantolunden6", row5); |
---|
157 | 173 | AddSkyboxButton("default", "CloudyHills", row6); |
---|
158 | 174 | AddSkyboxButton("daz", "Autumn", row6); |
---|
159 | | - AddSkyboxButton("daz", "Greenlands", row6); |
---|
160 | 175 | AddSkyboxButton("daz", "MountainTrail", row6); |
---|
161 | | - AddSkyboxButton("daz", "Oasis", row6); |
---|
162 | 176 | /* |
---|
163 | 177 | Autumn |
---|
164 | 178 | Greenlands |
---|
.. | .. |
---|
210 | 224 | AddSkyboxButton("penguins", "sleepyhollow", row1); |
---|
211 | 225 | |
---|
212 | 226 | AddSkyboxButton("penguins", "kenon_star", row2); |
---|
213 | | - AddSkyboxButton("indoors", "DallasW", row2); |
---|
214 | | - AddSkyboxButton("indoors", "MarriottMadisonWest", row2); |
---|
| 227 | + AddSkyboxButton("persson", "corona", row2); |
---|
| 228 | + AddSkyboxButton("persson", "spaceskybox", row2); |
---|
215 | 229 | AddSkyboxButton("indoors", "Vasa", row2); |
---|
216 | 230 | |
---|
217 | 231 | AddSkyboxButton("winter", "Backyard", row3); |
---|
.. | .. |
---|
232 | 246 | AddSkyboxButton("daz", "TheRock", row6); |
---|
233 | 247 | AddSkyboxButton("daz", "TopOfTheWorld", row6); |
---|
234 | 248 | AddSkyboxButton("daz", "Winter", row6); |
---|
235 | | - AddSkyboxButton("penguins", "desertdawn", row6); |
---|
| 249 | + AddSkyboxButton("mountain", "Ryfjallet", row6); |
---|
236 | 250 | |
---|
237 | 251 | tab0.add(row0); |
---|
238 | 252 | tab0.add(row1); |
---|
.. | .. |
---|
248 | 262 | //tab0.add(new cGridBag()); |
---|
249 | 263 | } |
---|
250 | 264 | } |
---|
251 | | - |
---|
252 | | - public void ChangeSkybox(String name) |
---|
| 265 | + |
---|
| 266 | + public void AddSkyboxTab3(JTabbedPane skyboxpanel) |
---|
253 | 267 | { |
---|
254 | | - //cameraView.envyoff = false; |
---|
255 | | - group.skyboxname = name; |
---|
256 | | - group.skyboxext = "jpg"; |
---|
257 | | - cameraView.repaint(); |
---|
| 268 | + cGridBag tab0 = new cGridBag().setVertical(true); |
---|
| 269 | + |
---|
| 270 | + tab0.setName("Others"); |
---|
| 271 | + skyboxpanel.add(tab0); |
---|
| 272 | + |
---|
| 273 | + cGridBag row0 = new cGridBag(); |
---|
| 274 | + cGridBag row1 = new cGridBag(); |
---|
| 275 | + cGridBag row2 = new cGridBag(); |
---|
| 276 | + cGridBag row3 = new cGridBag(); |
---|
| 277 | + cGridBag row4 = new cGridBag(); |
---|
| 278 | + cGridBag row5 = new cGridBag(); |
---|
| 279 | + cGridBag row6 = new cGridBag(); |
---|
| 280 | + |
---|
| 281 | + AddSkyboxButton("mayhem", "afterrain", row0); |
---|
| 282 | + AddSkyboxButton("mayhem", "aqua4", row0); |
---|
| 283 | + AddSkyboxButton("mayhem", "aqua9", row0); |
---|
| 284 | + AddSkyboxButton("mayhem", "flame", row0); |
---|
| 285 | + |
---|
| 286 | + AddSkyboxButton("mayhem", "h2s", row1); |
---|
| 287 | + AddSkyboxButton("mayhem", "prehistoric", row1); |
---|
| 288 | + AddSkyboxButton("mayhem", "scorched", row1); |
---|
| 289 | + AddSkyboxButton("penguins", "desertdawn", row1); |
---|
| 290 | + |
---|
| 291 | + AddSkyboxButton("persson", "Citadella", row2); |
---|
| 292 | + AddSkyboxButton("persson", "Citadella2", row2); |
---|
| 293 | + AddSkyboxButton("persson", "clouds1", row2); |
---|
| 294 | + AddSkyboxButton("penguins", "wrath", row2); |
---|
| 295 | + |
---|
| 296 | + AddSkyboxButton("persson", "FishermansBastion", row3); |
---|
| 297 | + AddSkyboxButton("persson", "HeroesSquare", row3); |
---|
| 298 | + AddSkyboxButton("indoors", "DallasW", row3); |
---|
| 299 | + AddSkyboxButton("indoors", "MarriottMadisonWest", row3); |
---|
| 300 | + |
---|
| 301 | + AddSkyboxButton("persson", "LancellottiChapel", row4); |
---|
| 302 | + AddSkyboxButton("persson", "PereaBeach1", row4); |
---|
| 303 | + AddSkyboxButton("persson", "PereaBeach2", row4); |
---|
| 304 | + AddSkyboxButton("persson", "redeclipse", row4); |
---|
| 305 | + |
---|
| 306 | + AddSkyboxButton("daz", "Greenlands", row5); |
---|
| 307 | + AddSkyboxButton("daz", "Oasis", row5); |
---|
| 308 | + AddSkyboxButton("elyvisions", "arch3", row5); |
---|
| 309 | + AddSkyboxButton("elyvisions", "calm_sea", row5); |
---|
| 310 | + |
---|
| 311 | + AddSkyboxButton("elyvisions", "rainbow", row6); |
---|
| 312 | + AddSkyboxButton("elyvisions", "distant_sunset", row6); |
---|
| 313 | + AddSkyboxButton("elyvisions", "heaven", row6); |
---|
| 314 | + AddSkyboxButton("elyvisions", "hot", row6); |
---|
| 315 | + |
---|
| 316 | + tab0.add(row0); |
---|
| 317 | + tab0.add(row1); |
---|
| 318 | + tab0.add(row2); |
---|
| 319 | + tab0.add(row3); |
---|
| 320 | + tab0.add(row4); |
---|
| 321 | + tab0.add(row5); |
---|
| 322 | + tab0.add(row6); |
---|
| 323 | + |
---|
| 324 | + for (int i=5; --i>=0;) |
---|
| 325 | + { |
---|
| 326 | + //oe.toolboxPanel.Return(); |
---|
| 327 | + //tab0.add(new cGridBag()); |
---|
| 328 | + } |
---|
| 329 | + } |
---|
| 330 | + |
---|
| 331 | + public void ChangeSkybox(String skybox) |
---|
| 332 | + { |
---|
| 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); |
---|
258 | 358 | } |
---|
259 | 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 | + |
---|
260 | 381 | //ObjEditor objEditor; |
---|
261 | 382 | public void closeUI2() |
---|
262 | 383 | { |
---|
.. | .. |
---|
294 | 415 | this.copy = this.group = group; |
---|
295 | 416 | //selectees = this.group.selectees; |
---|
296 | 417 | |
---|
297 | | - if (copy.versions == null) |
---|
| 418 | + assert(false); |
---|
| 419 | + |
---|
| 420 | + if (copy.versionlist == null) |
---|
298 | 421 | { |
---|
299 | | - copy.versions = new byte[100][]; |
---|
| 422 | + copy.versionlist = new Object3D[100]; |
---|
300 | 423 | copy.versionindex = -1; |
---|
| 424 | + |
---|
| 425 | + //Save(true); |
---|
301 | 426 | } |
---|
302 | 427 | |
---|
303 | 428 | if(ui) |
---|
.. | .. |
---|
321 | 446 | |
---|
322 | 447 | ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); |
---|
323 | 448 | |
---|
324 | | - if (copy.versions == null) |
---|
| 449 | + if (copy.versionlist == null) |
---|
325 | 450 | { |
---|
326 | | - copy.versions = new byte[100][]; |
---|
| 451 | + copy.versionlist = new Object3D[100]; |
---|
327 | 452 | copy.versionindex = -1; |
---|
328 | 453 | |
---|
329 | | - Save(true); |
---|
| 454 | + //Save(true); |
---|
330 | 455 | } |
---|
331 | 456 | } |
---|
332 | 457 | |
---|
.. | .. |
---|
417 | 542 | // menu.add("-"); |
---|
418 | 543 | duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
419 | 544 | duplicateItem.addActionListener(this); |
---|
420 | | - cloneItem = menu.add(new MenuItem("Clone")); |
---|
| 545 | + |
---|
| 546 | + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); |
---|
421 | 547 | cloneItem.addActionListener(this); |
---|
422 | | - if (Globals.ADVANCED) |
---|
| 548 | + //if (Globals.ADVANCED) |
---|
423 | 549 | { |
---|
424 | 550 | cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); |
---|
425 | 551 | cloneSupportItem.addActionListener(this); |
---|
426 | 552 | } |
---|
| 553 | + oe.jTree.popup.addSeparator(); |
---|
427 | 554 | menu.add("-"); |
---|
428 | | - cutItem = menu.add(new MenuItem("Cut")); |
---|
| 555 | + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); |
---|
429 | 556 | cutItem.addActionListener(this); |
---|
430 | | - copyItem = menu.add(new MenuItem("Copy")); |
---|
| 557 | + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); |
---|
431 | 558 | copyItem.addActionListener(this); |
---|
432 | 559 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
433 | 560 | pasteItem.addActionListener(this); |
---|
434 | 561 | |
---|
435 | | - menu.add("-"); |
---|
436 | | - 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")); |
---|
437 | 565 | pasteIntoItem.addActionListener(this); |
---|
438 | | - pasteLinkItem = menu.add(new MenuItem("Paste link")); |
---|
| 566 | + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); |
---|
439 | 567 | pasteLinkItem.addActionListener(this); |
---|
440 | | - pasteCloneItem = menu.add(new MenuItem("Paste clone")); |
---|
| 568 | + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); |
---|
441 | 569 | pasteCloneItem.addActionListener(this); |
---|
442 | | -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
| 570 | +// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); |
---|
443 | 571 | // pasteExpandItem.addActionListener(this); |
---|
444 | | - menu.add("-"); |
---|
445 | | - deleteItem = menu.add(new MenuItem("Delete")); |
---|
446 | | - deleteItem.addActionListener(this); |
---|
| 572 | + //menu.add("-"); |
---|
| 573 | + oe.jTree.popup.addSeparator(); |
---|
447 | 574 | |
---|
448 | 575 | if (Globals.ADVANCED) |
---|
449 | 576 | { |
---|
.. | .. |
---|
529 | 656 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
530 | 657 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
531 | 658 | //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
532 | | - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
533 | 659 | oe.cameraMenu.add("-"); |
---|
534 | 660 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
535 | 661 | openWindowItem.addActionListener(this); |
---|
536 | | - editLeafItem.addActionListener(this); |
---|
537 | 662 | lookAtItem.addActionListener(this); |
---|
538 | 663 | //lookFromItem.addActinoListener(this); |
---|
539 | 664 | //switchViewItem.addActionListener(this); |
---|
.. | .. |
---|
580 | 705 | setMasterItem.addActionListener(this); |
---|
581 | 706 | } |
---|
582 | 707 | |
---|
583 | | - oe.menuBar.add(menu = new Menu("Group")); |
---|
584 | | -// grabItem = menu.add(new MenuItem("Grab")); |
---|
585 | | -// grabItem.addActionListener(this); |
---|
| 708 | + oe.menuBar.add(menu = new Menu("Order")); |
---|
| 709 | + |
---|
586 | 710 | backItem = menu.add(new MenuItem("Back")); |
---|
587 | 711 | backItem.addActionListener(this); |
---|
588 | 712 | frontItem = menu.add(new MenuItem("Front")); |
---|
.. | .. |
---|
590 | 714 | // compositeItem = menu.add(new MenuItem("Composite")); |
---|
591 | 715 | // compositeItem.addActionListener(this); |
---|
592 | 716 | |
---|
| 717 | + grabItem = oe.jTree.popup.add(new JMenuItem("Group")); |
---|
| 718 | + grabItem.addActionListener(this); |
---|
| 719 | + |
---|
593 | 720 | if (Globals.ADVANCED) |
---|
594 | 721 | { |
---|
595 | 722 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
596 | 723 | hideItem.addActionListener(this); |
---|
597 | 724 | } |
---|
598 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 725 | + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
599 | 726 | ungroupItem.addActionListener(this); |
---|
| 727 | + |
---|
| 728 | + oe.jTree.popup.addSeparator(); |
---|
| 729 | + |
---|
| 730 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
| 731 | + deleteItem.addActionListener(this); |
---|
600 | 732 | |
---|
601 | 733 | // menu.add("-"); |
---|
602 | 734 | // |
---|
.. | .. |
---|
781 | 913 | shareGeometriesItem.addActionListener(this); |
---|
782 | 914 | mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); |
---|
783 | 915 | mergeGeometriesItem.addActionListener(this); |
---|
| 916 | + menu.add("-"); |
---|
| 917 | + editLeafItem = menu.add(new MenuItem("Edit leaf...")); |
---|
| 918 | + editLeafItem.addActionListener(this); |
---|
784 | 919 | if (Globals.ADVANCED) |
---|
785 | 920 | { |
---|
786 | 921 | // Pretty much the same as duplicate and clone. |
---|
.. | .. |
---|
797 | 932 | buildToolsMenu(menu); |
---|
798 | 933 | } |
---|
799 | 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 | + } |
---|
800 | 1003 | |
---|
801 | 1004 | void SetupUI2(ObjEditor oe) |
---|
802 | 1005 | { |
---|
.. | .. |
---|
815 | 1018 | //new Exception().printStackTrace(); |
---|
816 | 1019 | |
---|
817 | 1020 | oe.radioPanel = new JPanel(new GridBagLayout()); |
---|
818 | | - oe.aConstraints.weightx = 1; |
---|
819 | | - oe.aConstraints.weighty = 0; |
---|
820 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
821 | | - oe.aConstraints.gridwidth = 100; |
---|
822 | | - oe.aConstraints.gridheight = 1; |
---|
823 | 1021 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
824 | 1022 | |
---|
825 | 1023 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
852 | 1050 | |
---|
853 | 1051 | if (Globals.ADVANCED) |
---|
854 | 1052 | { |
---|
855 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
856 | | - maxButton.setToolTipText("Maximize window"); |
---|
857 | | - 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); |
---|
858 | 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 | + // |
---|
859 | 1096 | |
---|
860 | 1097 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
861 | 1098 | fullButton.setToolTipText("Full-screen window"); |
---|
.. | .. |
---|
869 | 1106 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
870 | 1107 | restoreCameraButton.addActionListener(this); |
---|
871 | 1108 | |
---|
872 | | - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
873 | | - saveButton.setToolTipText("New version"); |
---|
874 | | - 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); |
---|
875 | 1112 | |
---|
876 | | - copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
877 | | - undoButton.setToolTipText("Previous version"); |
---|
878 | | - undoButton.addActionListener(this); |
---|
879 | | - 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); |
---|
880 | 1122 | |
---|
881 | 1123 | cGridBag updown = new cGridBag().setVertical(true); |
---|
882 | 1124 | updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
883 | | - restoreButton.setToolTipText("Restore current"); |
---|
| 1125 | + restoreButton.setToolTipText("Undo (restore current version)"); |
---|
884 | 1126 | restoreButton.addActionListener(this); |
---|
885 | 1127 | restoreButton.setEnabled(false); |
---|
886 | 1128 | |
---|
887 | 1129 | updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
888 | | - replaceButton.setToolTipText("Replace current"); |
---|
| 1130 | + replaceButton.setToolTipText("Save (replace current version)"); |
---|
889 | 1131 | replaceButton.addActionListener(this); |
---|
890 | 1132 | replaceButton.setEnabled(false); |
---|
891 | 1133 | |
---|
892 | 1134 | copyOptionsPanel.add(updown); |
---|
893 | 1135 | |
---|
894 | | - copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
895 | | - redoButton.setToolTipText("Next version"); |
---|
896 | | - redoButton.addActionListener(this); |
---|
897 | | - 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); |
---|
898 | 1144 | |
---|
899 | 1145 | oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
900 | 1146 | liveCB.setToolTipText("Enable animation"); |
---|
901 | 1147 | liveCB.addItemListener(this); |
---|
902 | 1148 | |
---|
903 | | - oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
904 | | - oneStepButton.setToolTipText("Animate one step forward"); |
---|
905 | | - oneStepButton.addActionListener(this); |
---|
906 | | - |
---|
907 | 1149 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
908 | 1150 | fastCB.setToolTipText("Fast mode"); |
---|
909 | 1151 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
930 | 1172 | |
---|
931 | 1173 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
932 | 1174 | |
---|
933 | | - oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
934 | | - twoButton.setToolTipText("Show 3D view only"); |
---|
935 | | - twoButton.addActionListener(this); |
---|
936 | | - this.fullscreenLayout = twoButton; |
---|
937 | | - |
---|
938 | | - oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
939 | | - threeButton.setToolTipText("Show controls and 3D view"); |
---|
940 | | - threeButton.addActionListener(this); |
---|
941 | | - oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
942 | | - sixButton.setToolTipText("Show 3D view and controls"); |
---|
943 | | - sixButton.addActionListener(this); |
---|
944 | | -// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
945 | | -// sevenButton.setToolTipText("3-column layout"); |
---|
946 | | -// sevenButton.addActionListener(this); |
---|
947 | | - // |
---|
948 | 1175 | |
---|
949 | 1176 | oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
950 | 1177 | rootButton.setToolTipText("Open selection in new tab"); |
---|
.. | .. |
---|
960 | 1187 | |
---|
961 | 1188 | // INSERT |
---|
962 | 1189 | row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
963 | | - gridButton.setToolTipText("Create grid"); |
---|
| 1190 | + gridButton.setToolTipText("Create ground"); |
---|
964 | 1191 | gridButton.addActionListener(this); |
---|
965 | 1192 | |
---|
966 | 1193 | row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
967 | 1194 | boxButton.setToolTipText("Create box"); |
---|
968 | 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); |
---|
969 | 1200 | |
---|
970 | 1201 | row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
971 | 1202 | sphereButton.setToolTipText("Create sphere"); |
---|
.. | .. |
---|
978 | 1209 | row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
979 | 1210 | torusButton.setToolTipText("Create torus"); |
---|
980 | 1211 | torusButton.addActionListener(this); |
---|
981 | | - |
---|
982 | | - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
983 | | - superButton.setToolTipText("Create superellipsoid"); |
---|
984 | | - superButton.addActionListener(this); |
---|
985 | 1212 | |
---|
986 | 1213 | if (Globals.ADVANCED) |
---|
987 | 1214 | { |
---|
.. | .. |
---|
1028 | 1255 | |
---|
1029 | 1256 | oe.toolboxPanel.add(row2); |
---|
1030 | 1257 | |
---|
1031 | | - // ENVYMAPS |
---|
1032 | | - cGridBag skyboxpane = new cGridBag(); |
---|
1033 | | - skyboxpane.preferredHeight = 100; |
---|
| 1258 | + cGridBag textures = new cGridBag(); |
---|
1034 | 1259 | |
---|
1035 | | - oe.toolboxPanel.add(skyboxpane); |
---|
| 1260 | + CreateTexturePanel(textures); |
---|
1036 | 1261 | |
---|
1037 | | - JTabbedPane skyboxpanel = new JTabbedPane(); |
---|
1038 | | - skyboxpane.add(skyboxpanel); |
---|
| 1262 | + oe.toolboxPanel.add(textures); |
---|
1039 | 1263 | |
---|
1040 | | - AddSkyboxTab0(skyboxpanel); |
---|
1041 | | - AddSkyboxTab1(skyboxpanel); |
---|
1042 | | - AddSkyboxTab2(skyboxpanel); |
---|
| 1264 | + textures.preferredHeight = 100; |
---|
| 1265 | + |
---|
| 1266 | + CreateSkyboxPanel(oe.skyboxPanel); |
---|
1043 | 1267 | |
---|
1044 | 1268 | // EDIT panel |
---|
1045 | 1269 | editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1047 | 1271 | editButton.addActionListener(this); |
---|
1048 | 1272 | |
---|
1049 | 1273 | editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1050 | | - uneditButton.setToolTipText("Remove selection controls"); |
---|
| 1274 | + uneditButton.setToolTipText("Unpin and remove selection controls"); |
---|
1051 | 1275 | uneditButton.addActionListener(this); |
---|
1052 | 1276 | |
---|
1053 | 1277 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
1054 | | - allParamsButton.setToolTipText("Show all controle"); |
---|
| 1278 | + allParamsButton.setToolTipText("Show all controls"); |
---|
1055 | 1279 | allParamsButton.addActionListener(this); |
---|
1056 | 1280 | |
---|
1057 | | - editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1058 | | - clearPanelButton.setToolTipText("Clear edit panel"); |
---|
| 1281 | + editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1282 | + clearPanelButton.setToolTipText("Clear all controls"); |
---|
1059 | 1283 | clearPanelButton.addActionListener(this); |
---|
1060 | 1284 | |
---|
1061 | | - editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1062 | | - unselectButton.setToolTipText("Unselect"); |
---|
1063 | | - unselectButton.addActionListener(this); |
---|
| 1285 | + //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1286 | + //unselectButton.setToolTipText("Unselect"); |
---|
| 1287 | + //unselectButton.addActionListener(this); |
---|
1064 | 1288 | |
---|
1065 | 1289 | editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1066 | 1290 | flashSelectionButton.setToolTipText("Highlight selection"); |
---|
.. | .. |
---|
1120 | 1344 | dgr.addDragGestureListener(this); |
---|
1121 | 1345 | }catch(Exception e) {} |
---|
1122 | 1346 | */ |
---|
1123 | | - radio.layout = sixButton; // sevenButton; |
---|
| 1347 | + radio.layout = threeButton; // sixButton; |
---|
1124 | 1348 | oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
1125 | 1349 | } |
---|
1126 | 1350 | |
---|
.. | .. |
---|
1171 | 1395 | smoothCB.setToolTipText("Snapping delay"); |
---|
1172 | 1396 | smoothCB.addItemListener(this); |
---|
1173 | 1397 | |
---|
1174 | | - panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints); |
---|
1175 | | - slowCB.setToolTipText("Smooth interpolation"); |
---|
1176 | | - slowCB.addItemListener(this); |
---|
| 1398 | +// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints); |
---|
| 1399 | +// slowCB.setToolTipText("Smooth interpolation"); |
---|
| 1400 | +// slowCB.addItemListener(this); |
---|
| 1401 | + panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints); |
---|
| 1402 | + minshaderCB.setToolTipText("Minimal fast shader"); |
---|
| 1403 | + minshaderCB.addItemListener(this); |
---|
1177 | 1404 | |
---|
1178 | 1405 | // constraints.gridy += 1; |
---|
1179 | 1406 | // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints); |
---|
.. | .. |
---|
1252 | 1479 | |
---|
1253 | 1480 | void EditObject(Object3D obj) |
---|
1254 | 1481 | { |
---|
| 1482 | + assert(obj instanceof Composite); |
---|
| 1483 | + |
---|
| 1484 | +// if (obj.versionlist == null) |
---|
| 1485 | +// { |
---|
| 1486 | +// obj.versionlist = new Object3D[100]; |
---|
| 1487 | +// obj.versionindex = -1; |
---|
| 1488 | +// } |
---|
| 1489 | + |
---|
1255 | 1490 | cRadio radioButton = new cRadio(obj.name); |
---|
1256 | 1491 | |
---|
1257 | 1492 | // June 2019. Patch to avoid bug with transparency. |
---|
.. | .. |
---|
1262 | 1497 | } |
---|
1263 | 1498 | |
---|
1264 | 1499 | radioButton.SetObject(obj); |
---|
1265 | | - radioButton.layout = sixButton; // sevenButton; |
---|
| 1500 | + radioButton.layout = threeButton; // sixButton; |
---|
1266 | 1501 | radioButton.SetCamera(cameraView.renderCamera, false); |
---|
1267 | 1502 | radioButton.addActionListener(this); |
---|
1268 | 1503 | radioPanel.add(radioButton); |
---|
.. | .. |
---|
1276 | 1511 | |
---|
1277 | 1512 | oe.SetupViews(); |
---|
1278 | 1513 | |
---|
| 1514 | + if (Globals.DEBUG) |
---|
1279 | 1515 | System.out.println("SetupViews"); |
---|
1280 | 1516 | DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( |
---|
1281 | 1517 | oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? |
---|
.. | .. |
---|
1287 | 1523 | cCheckBox localCB; |
---|
1288 | 1524 | cCheckBox crowdCB; |
---|
1289 | 1525 | cCheckBox smoothCB; |
---|
| 1526 | + cCheckBox minshaderCB; |
---|
| 1527 | + |
---|
1290 | 1528 | cToggleButton fastCB; |
---|
1291 | 1529 | cCheckBox slowCB; |
---|
1292 | 1530 | cCheckBox boxCB; |
---|
.. | .. |
---|
1357 | 1595 | { |
---|
1358 | 1596 | cameraView.ToggleInertia(); |
---|
1359 | 1597 | cameraView.repaint(); |
---|
| 1598 | + } |
---|
| 1599 | + else if(e.getSource() == minshaderCB) |
---|
| 1600 | + { |
---|
| 1601 | + Globals.MINSHADER ^= true; |
---|
| 1602 | + cameraView.programInitialized = false; |
---|
| 1603 | + cameraView.repaint(); |
---|
1360 | 1604 | } |
---|
1361 | 1605 | else if(e.getSource() == localCB) |
---|
1362 | 1606 | { |
---|
.. | .. |
---|
1634 | 1878 | TreePath path; |
---|
1635 | 1879 | |
---|
1636 | 1880 | public TransferableTreePath(TreePath tp) { |
---|
1637 | | - path = tp; |
---|
| 1881 | + Object[] objs = new Object[tp.getPathCount()]; |
---|
| 1882 | + for (int i=0; i<objs.length; i++) |
---|
| 1883 | + { |
---|
| 1884 | + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); |
---|
| 1885 | + } |
---|
| 1886 | + path = new TreePath(objs); |
---|
1638 | 1887 | } |
---|
1639 | 1888 | |
---|
1640 | 1889 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
1924 | 2173 | shadow.material = new cMaterial(obj.material); |
---|
1925 | 2174 | shadow.material.diffuse = 0.0001f; |
---|
1926 | 2175 | shadow.material.specular = 0.0001f; |
---|
1927 | | - //shadow.projectedVertices[1].x = 300; |
---|
| 2176 | + shadow.material.opacity = 0.75f; |
---|
| 2177 | + |
---|
| 2178 | + AllocProjectedVertices(shadow); |
---|
| 2179 | + |
---|
| 2180 | + shadow.projectedVertices[1].x = 300; |
---|
1928 | 2181 | |
---|
1929 | 2182 | makeSomething(shadow); |
---|
1930 | 2183 | } |
---|
.. | .. |
---|
2445 | 2698 | } else |
---|
2446 | 2699 | if (source == loopItem || source == loopButton) |
---|
2447 | 2700 | { |
---|
| 2701 | + if (!group.selection.isEmpty()) |
---|
| 2702 | + { |
---|
2448 | 2703 | Composite csg = new GroupLeaf(); |
---|
2449 | 2704 | csg.count = 5; |
---|
2450 | | - group(csg); |
---|
2451 | 2705 | Composite child = new cGroup("Branch"); |
---|
2452 | 2706 | csg.addChild(child); |
---|
2453 | 2707 | child.addChild(csg); |
---|
| 2708 | + group(csg); |
---|
| 2709 | + } |
---|
2454 | 2710 | } else |
---|
2455 | 2711 | if (source == doubleItem) |
---|
2456 | 2712 | { |
---|
| 2713 | + if (!group.selection.isEmpty()) |
---|
| 2714 | + { |
---|
2457 | 2715 | Composite csg = new GroupLeaf("Fork"); |
---|
2458 | 2716 | csg.count = 5; |
---|
2459 | | - group(csg); |
---|
2460 | 2717 | Composite child = new cGroup("Branch A"); |
---|
2461 | 2718 | csg.addChild(child); |
---|
2462 | 2719 | child.addChild(csg); |
---|
2463 | 2720 | child = new cGroup("Branch B"); |
---|
2464 | 2721 | csg.addChild(child); |
---|
2465 | 2722 | child.addChild(csg); |
---|
| 2723 | + group(csg); |
---|
| 2724 | + } |
---|
2466 | 2725 | } else |
---|
2467 | 2726 | if (source == tripleItem) |
---|
2468 | 2727 | { |
---|
| 2728 | + if (!group.selection.isEmpty()) |
---|
| 2729 | + { |
---|
2469 | 2730 | Composite csg = new GroupLeaf("Trident"); |
---|
2470 | 2731 | csg.count = 4; |
---|
2471 | 2732 | group(csg); |
---|
.. | .. |
---|
2478 | 2739 | child = new cGroup(); |
---|
2479 | 2740 | csg.addChild(child); |
---|
2480 | 2741 | child.addChild(csg); |
---|
| 2742 | + } |
---|
2481 | 2743 | } else |
---|
2482 | 2744 | if (source == computeAOItem) |
---|
2483 | 2745 | { |
---|
.. | .. |
---|
2497 | 2759 | if (source == invariantsItem) |
---|
2498 | 2760 | { |
---|
2499 | 2761 | System.out.println("Invariants:"); |
---|
2500 | | - Grafreed.grafreeD.universe.invariants(); |
---|
| 2762 | + Grafreed.grafreed.universe.invariants(); |
---|
2501 | 2763 | } else |
---|
2502 | 2764 | if (source == memoryItem) |
---|
2503 | 2765 | { |
---|
.. | .. |
---|
2528 | 2790 | { |
---|
2529 | 2791 | ToggleFullScreen(); |
---|
2530 | 2792 | } else |
---|
2531 | | - if (source == undoButton) |
---|
| 2793 | + if (source == collapseButton) |
---|
| 2794 | + { |
---|
| 2795 | + this.expandedLayout = radio.layout; |
---|
| 2796 | + CollapseToolbar(); |
---|
| 2797 | + } else |
---|
| 2798 | + if (source == maximize3DButton) |
---|
| 2799 | + { |
---|
| 2800 | + this.expandedLayout = radio.layout; |
---|
| 2801 | + radio.layout = twoButton; |
---|
| 2802 | + Show3DView(); |
---|
| 2803 | + CollapseToolbar(); |
---|
| 2804 | + } else |
---|
| 2805 | + if (source == previousVersionButton) |
---|
2532 | 2806 | { |
---|
2533 | 2807 | // Go to previous version |
---|
2534 | 2808 | //if (!Undo()) |
---|
2535 | 2809 | //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2536 | | - Undo(); |
---|
| 2810 | + PreviousVersion(); |
---|
2537 | 2811 | } else |
---|
2538 | 2812 | if (source == restoreButton) |
---|
2539 | 2813 | { |
---|
2540 | 2814 | // Restore current version |
---|
2541 | 2815 | Restore(); |
---|
| 2816 | + //restoreButton.setEnabled(false); |
---|
2542 | 2817 | } else |
---|
2543 | 2818 | if (source == replaceButton) |
---|
2544 | 2819 | { |
---|
2545 | 2820 | // Overwrite current version |
---|
2546 | 2821 | Replace(); |
---|
| 2822 | + //replaceButton.setEnabled(false); |
---|
2547 | 2823 | } else |
---|
2548 | | - if (source == redoButton) |
---|
| 2824 | + if (source == nextVersionButton) |
---|
2549 | 2825 | { |
---|
2550 | 2826 | // Go to next version |
---|
2551 | | - Redo(); |
---|
| 2827 | + NextVersion(); |
---|
2552 | 2828 | } else |
---|
2553 | | - if (source == saveButton) |
---|
| 2829 | + if (source == saveVersionButton) |
---|
2554 | 2830 | { |
---|
2555 | 2831 | // Save a new version |
---|
2556 | 2832 | if (!Save(true)) |
---|
2557 | 2833 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 2834 | + } else |
---|
| 2835 | + if (source == deleteVersionButton) |
---|
| 2836 | + { |
---|
| 2837 | + // Delete a new version |
---|
| 2838 | + DeleteVersion(); |
---|
2558 | 2839 | } else |
---|
2559 | 2840 | if (source == oneStepButton) |
---|
2560 | 2841 | { |
---|
.. | .. |
---|
2609 | 2890 | } else |
---|
2610 | 2891 | if (source == undoItem) |
---|
2611 | 2892 | { |
---|
2612 | | - Undo(); |
---|
| 2893 | + PreviousVersion(); |
---|
2613 | 2894 | } else |
---|
2614 | 2895 | if (source == redoItem) |
---|
2615 | 2896 | { |
---|
2616 | | - Redo(); |
---|
| 2897 | + NextVersion(); |
---|
2617 | 2898 | } else |
---|
2618 | 2899 | if (source == duplicateItem) |
---|
2619 | 2900 | { |
---|
.. | .. |
---|
3094 | 3375 | } else |
---|
3095 | 3376 | if (source == ungroupItem || source == ungroupButton) |
---|
3096 | 3377 | { |
---|
3097 | | - boolean hasRoot = false; |
---|
| 3378 | + boolean canUngroup = true; |
---|
3098 | 3379 | |
---|
3099 | 3380 | for (int i=0; i<group.selection.size(); i++) |
---|
3100 | 3381 | { |
---|
3101 | | - if (group.selection.get(i) == group) |
---|
| 3382 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3383 | + |
---|
| 3384 | + if (selectedItem.Size() == 0) |
---|
3102 | 3385 | { |
---|
3103 | | - hasRoot = true; |
---|
| 3386 | + // Cannot ungroup leaves |
---|
| 3387 | + canUngroup = false; |
---|
| 3388 | + break; |
---|
| 3389 | + } |
---|
| 3390 | + |
---|
| 3391 | + if (selectedItem == group) |
---|
| 3392 | + { |
---|
| 3393 | + // Cannot ungroup root |
---|
| 3394 | + canUngroup = false; |
---|
3104 | 3395 | break; |
---|
3105 | 3396 | } |
---|
3106 | 3397 | } |
---|
3107 | 3398 | |
---|
3108 | | - if (!hasRoot) |
---|
| 3399 | + if (canUngroup) |
---|
3109 | 3400 | { |
---|
3110 | 3401 | for (int i=0; i<group.selection.size(); i++) |
---|
3111 | 3402 | { |
---|
3112 | | - Ungroup(group.selection.get(i)); |
---|
| 3403 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3404 | + |
---|
| 3405 | + Ungroup(selectedItem); |
---|
3113 | 3406 | } |
---|
3114 | 3407 | |
---|
3115 | 3408 | ClearSelection(false); |
---|
.. | .. |
---|
3472 | 3765 | if (CameraPane.FULLSCREEN) |
---|
3473 | 3766 | fullscreenLayout = radio.layout; |
---|
3474 | 3767 | |
---|
3475 | | - // bug |
---|
3476 | | - //gridPanel.setDividerLocation(1.0); |
---|
3477 | | - //bigPanel.setDividerLocation(0.0); |
---|
3478 | | -// bigThree.remove(scenePanel); |
---|
3479 | | -// bigThree.remove(centralPanel); |
---|
3480 | | -// bigThree.remove(XYZPanel); |
---|
3481 | | -// aWindowConstraints.gridx = 0; |
---|
3482 | | -// aWindowConstraints.gridy = 0; |
---|
3483 | | -// aWindowConstraints.gridwidth = 1; |
---|
3484 | | -// // aConstraints.gridheight = 3; |
---|
3485 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3486 | | -// aWindowConstraints.weightx = 0; |
---|
3487 | | -// aWindowConstraints.weighty = 1; |
---|
3488 | | -// //bigThree.add(jtp, aWindowConstraints); |
---|
3489 | | -// aWindowConstraints.weightx = 1; |
---|
3490 | | -// aWindowConstraints.gridwidth = 3; |
---|
3491 | | -// // aConstraints.gridheight = 3; |
---|
3492 | | -// aWindowConstraints.gridx = 1; |
---|
3493 | | -// aWindowConstraints.fill = GridBagConstraints.BOTH; |
---|
3494 | | -// bigThree.add(centralPanel, aWindowConstraints); |
---|
3495 | | -// aWindowConstraints.weightx = 0; |
---|
3496 | | -// aWindowConstraints.gridx = 4; |
---|
3497 | | -// aWindowConstraints.gridwidth = 1; |
---|
3498 | | -// // aConstraints.gridheight = 3; |
---|
3499 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3500 | | -// //bigThree.add(XYZPanel, aWindowConstraints); |
---|
3501 | | -// scenePanel.setVisible(false); |
---|
3502 | | -// centralPanel.setVisible(true); |
---|
3503 | | -// XYZPanel.setVisible(false); |
---|
3504 | | - bigThree.ClearUI(); |
---|
3505 | | - bigThree.add(centralPanel); |
---|
3506 | | - bigThree.FlushUI(); |
---|
| 3768 | + Show3DView(); |
---|
3507 | 3769 | |
---|
3508 | 3770 | cameraView.requestFocusInWindow(); |
---|
3509 | 3771 | |
---|
.. | .. |
---|
3689 | 3951 | } else |
---|
3690 | 3952 | if (source == rootButton) |
---|
3691 | 3953 | { |
---|
| 3954 | + Replace(); |
---|
3692 | 3955 | Object3D obj; |
---|
3693 | 3956 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3694 | 3957 | { |
---|
.. | .. |
---|
3746 | 4009 | { |
---|
3747 | 4010 | Object3D child = (Object3D)e.nextElement(); |
---|
3748 | 4011 | if(child.editWindow != null) |
---|
3749 | | - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3750 | 4012 | child.pinned = false; |
---|
3751 | 4013 | child.CloseUI(); |
---|
3752 | 4014 | listUI.remove(child); |
---|
| 4015 | +// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3753 | 4016 | |
---|
3754 | 4017 | //child.editWindow = null; // ??????????? |
---|
3755 | 4018 | } |
---|
.. | .. |
---|
3768 | 4031 | obj.CloseUI(); |
---|
3769 | 4032 | } |
---|
3770 | 4033 | listUI.clear(); |
---|
| 4034 | + SetPinStates(group.selection.size() > 0); |
---|
3771 | 4035 | refreshContents(true); |
---|
3772 | 4036 | } else |
---|
3773 | 4037 | if (source == allParamsButton) |
---|
.. | .. |
---|
3824 | 4088 | |
---|
3825 | 4089 | copy = group; |
---|
3826 | 4090 | |
---|
3827 | | - SetUndoStates(); |
---|
3828 | | - |
---|
3829 | 4091 | //Globals.theRenderer.object = group; |
---|
3830 | 4092 | if(!useclient) |
---|
3831 | 4093 | { |
---|
.. | .. |
---|
3853 | 4115 | */ |
---|
3854 | 4116 | radio.layout.doClick(); |
---|
3855 | 4117 | |
---|
| 4118 | + assert(copy instanceof Composite); |
---|
| 4119 | + |
---|
| 4120 | + if (copy.versionlist == null) |
---|
| 4121 | + { |
---|
| 4122 | + copy.versionlist = new Object3D[100]; |
---|
| 4123 | + copy.versionindex = -1; |
---|
| 4124 | + |
---|
| 4125 | + // Cannot work with loops |
---|
| 4126 | + // To fix this issue, first mark all nodes above the root, |
---|
| 4127 | + // and check if any of these nodes are reachable below the root. |
---|
| 4128 | + //Save(true); |
---|
| 4129 | + } |
---|
| 4130 | + |
---|
| 4131 | + SetVersionStates(); |
---|
| 4132 | + |
---|
3856 | 4133 | ClearUnpinned(); |
---|
| 4134 | + |
---|
3857 | 4135 | //Grafreed.Assert(group != null); |
---|
3858 | 4136 | //Grafreed.Assert(group.selection != null); |
---|
3859 | 4137 | SetPinStates(group.selection == null || group.selection.size() > 0); |
---|
.. | .. |
---|
3870 | 4148 | } else if (event.getSource() == editCameraItem) |
---|
3871 | 4149 | { |
---|
3872 | 4150 | cameraView.ProtectCamera(); |
---|
| 4151 | + cameraView.requestFocusInWindow(); |
---|
3873 | 4152 | cameraView.repaint(); |
---|
3874 | 4153 | return; |
---|
3875 | 4154 | } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton) |
---|
3876 | 4155 | { |
---|
3877 | 4156 | cameraView.RevertCamera(); |
---|
| 4157 | + cameraView.requestFocusInWindow(); |
---|
3878 | 4158 | cameraView.repaint(); |
---|
3879 | 4159 | return; |
---|
3880 | 4160 | // } else if (event.getSource() == textureButton) |
---|
.. | .. |
---|
5007 | 5287 | |
---|
5008 | 5288 | freezemodel = false; |
---|
5009 | 5289 | } |
---|
5010 | | - |
---|
5011 | | - boolean flashIt = true; |
---|
5012 | | - |
---|
| 5290 | + |
---|
5013 | 5291 | public void valueChanged(TreeSelectionEvent e) |
---|
5014 | 5292 | //public boolean handleEvent(Event event) |
---|
5015 | 5293 | { |
---|
.. | .. |
---|
5082 | 5360 | { |
---|
5083 | 5361 | editButton.setEnabled(enabled); |
---|
5084 | 5362 | uneditButton.setEnabled(enabled); |
---|
5085 | | - unselectButton.setEnabled(enabled); |
---|
| 5363 | + //unselectButton.setEnabled(enabled); |
---|
5086 | 5364 | flashSelectionButton.setEnabled(enabled); |
---|
| 5365 | + |
---|
| 5366 | + clearPanelButton.setEnabled(!listUI.isEmpty()); |
---|
| 5367 | + |
---|
| 5368 | + boolean allComposites = true; |
---|
| 5369 | + |
---|
| 5370 | + if (group.selection != null) |
---|
| 5371 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 5372 | + { |
---|
| 5373 | + Object next = e.nextElement(); |
---|
| 5374 | + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) |
---|
| 5375 | + { |
---|
| 5376 | + allComposites = false; |
---|
| 5377 | + break; |
---|
| 5378 | + } |
---|
| 5379 | + } |
---|
| 5380 | + |
---|
| 5381 | + rootButton.setEnabled(allComposites); |
---|
5087 | 5382 | } |
---|
5088 | 5383 | |
---|
5089 | 5384 | void refreshContents(boolean cp) |
---|
5090 | 5385 | { |
---|
5091 | | - if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
| 5386 | + //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
5092 | 5387 | if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
5093 | 5388 | { |
---|
5094 | 5389 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
.. | .. |
---|
5098 | 5393 | Object3D child = (Object3D) group.selection.get(i); |
---|
5099 | 5394 | |
---|
5100 | 5395 | objEditor.AddInfo(child, this, true); |
---|
5101 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5396 | +// System.err.println("info : " + child.GetPath()); |
---|
5102 | 5397 | } |
---|
5103 | 5398 | |
---|
5104 | 5399 | objEditor.SetText(); // jan 2014 |
---|
.. | .. |
---|
5924 | 6219 | |
---|
5925 | 6220 | cButton restoreCameraButton; |
---|
5926 | 6221 | |
---|
5927 | | - cButton saveButton; |
---|
5928 | 6222 | cButton oneStepButton; |
---|
5929 | 6223 | |
---|
5930 | 6224 | cButton groupButton; |
---|
.. | .. |
---|
5982 | 6276 | private MenuItem lookAtItem; |
---|
5983 | 6277 | private MenuItem lookFromItem; |
---|
5984 | 6278 | private MenuItem switchViewItem; |
---|
5985 | | - private MenuItem cutItem; |
---|
| 6279 | + private JMenuItem cutItem; |
---|
5986 | 6280 | private MenuItem undoItem; |
---|
5987 | 6281 | private MenuItem redoItem; |
---|
5988 | 6282 | private JMenuItem duplicateItem; |
---|
5989 | | - private MenuItem cloneItem; |
---|
| 6283 | + private JMenuItem cloneItem; |
---|
5990 | 6284 | private MenuItem cloneSupportItem; |
---|
5991 | 6285 | private MenuItem overwriteGeoItem; |
---|
5992 | 6286 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6007 | 6301 | private MenuItem cloneGeometriesItem; |
---|
6008 | 6302 | private MenuItem shareGeometriesItem; |
---|
6009 | 6303 | private MenuItem mergeGeometriesItem; |
---|
6010 | | - private MenuItem copyItem; |
---|
| 6304 | + private JMenuItem copyItem; |
---|
6011 | 6305 | private MenuItem pasteItem; |
---|
6012 | | - private MenuItem pasteIntoItem; |
---|
6013 | | - private MenuItem pasteLinkItem; |
---|
6014 | | - private MenuItem pasteCloneItem; |
---|
6015 | | - private MenuItem pasteExpandItem; |
---|
6016 | | - private MenuItem deleteItem; |
---|
| 6306 | + private JMenuItem pasteIntoItem; |
---|
| 6307 | + private JMenuItem pasteLinkItem; |
---|
| 6308 | + private JMenuItem pasteCloneItem; |
---|
| 6309 | + private JMenuItem pasteExpandItem; |
---|
| 6310 | + private JMenuItem deleteItem; |
---|
6017 | 6311 | private MenuItem clearAllItem; |
---|
6018 | 6312 | private MenuItem genUVItem; |
---|
6019 | 6313 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6068 | 6362 | private MenuItem transformGeometryItem; |
---|
6069 | 6363 | private MenuItem transformChildrenItem; |
---|
6070 | 6364 | private MenuItem hideItem; |
---|
6071 | | - private MenuItem grabItem; |
---|
| 6365 | + private JMenuItem grabItem; |
---|
6072 | 6366 | private MenuItem backItem; |
---|
6073 | 6367 | private MenuItem frontItem; |
---|
6074 | 6368 | private MenuItem cameraItem; |
---|
.. | .. |
---|
6081 | 6375 | private MenuItem switchTransfoItem; |
---|
6082 | 6376 | private MenuItem morphItem; |
---|
6083 | 6377 | private MenuItem linkerItem; |
---|
6084 | | - private MenuItem ungroupItem; |
---|
| 6378 | + private JMenuItem ungroupItem; |
---|
6085 | 6379 | private MenuItem editItem; |
---|
6086 | 6380 | private MenuItem openWindowItem; |
---|
6087 | 6381 | private MenuItem editLeafItem; |
---|