.. | .. |
---|
60 | 60 | this.copy = this.group = group; |
---|
61 | 61 | //selectees = this.group.selectees; |
---|
62 | 62 | |
---|
| 63 | + if (copy.versions == null) |
---|
| 64 | + { |
---|
| 65 | + copy.versions = new byte[100][]; |
---|
| 66 | + copy.versionindex = -1; |
---|
| 67 | + } |
---|
| 68 | + |
---|
63 | 69 | if(ui) |
---|
64 | 70 | SetupUI(objEditor); |
---|
65 | 71 | } |
---|
.. | .. |
---|
74 | 80 | this.copy = this.group = copy; |
---|
75 | 81 | //selectees = this.group.selectees; |
---|
76 | 82 | |
---|
| 83 | + if (copy.versions == null) |
---|
| 84 | + { |
---|
| 85 | + copy.versions = new byte[100][]; |
---|
| 86 | + copy.versionindex = -1; |
---|
| 87 | + } |
---|
| 88 | + |
---|
77 | 89 | SetupMenu2(this); //objEditor); |
---|
78 | 90 | SetupUI2(objEditor); |
---|
79 | 91 | objEditor.SetupUI(true); |
---|
.. | .. |
---|
84 | 96 | |
---|
85 | 97 | void CloneSelection(boolean supports) |
---|
86 | 98 | { |
---|
| 99 | + if (Globals.REPLACEONMAKE) |
---|
| 100 | + Save(); |
---|
| 101 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 102 | + Globals.REPLACEONMAKE = false; |
---|
87 | 103 | // Object3D keep = GrafreeD.clipboard; |
---|
88 | 104 | //Object3D obj; |
---|
89 | 105 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
94 | 110 | |
---|
95 | 111 | makeSomething(clone, i==group.selection.size()-1); |
---|
96 | 112 | } |
---|
| 113 | + Globals.REPLACEONMAKE = keep; |
---|
97 | 114 | } |
---|
98 | 115 | |
---|
99 | 116 | void CloneClipboard(boolean supports) |
---|
.. | .. |
---|
150 | 167 | |
---|
151 | 168 | void SetupMenu2(GroupEditor oe) |
---|
152 | 169 | { |
---|
| 170 | + oe.jTree = new cTree(); |
---|
| 171 | + |
---|
153 | 172 | Menu menu; |
---|
154 | 173 | oe.menuBar.add(menu = new Menu("Edit")); |
---|
155 | 174 | //editItem = menu.add(new MenuItem("Edit")); |
---|
.. | .. |
---|
160 | 179 | // redoItem = menu.add(new MenuItem("Redo")); |
---|
161 | 180 | // redoItem.addActionListener(this); |
---|
162 | 181 | // menu.add("-"); |
---|
163 | | - duplicateItem = menu.add(new MenuItem("Duplicate")); |
---|
| 182 | + duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
164 | 183 | duplicateItem.addActionListener(this); |
---|
165 | 184 | cloneItem = menu.add(new MenuItem("Clone")); |
---|
166 | 185 | cloneItem.addActionListener(this); |
---|
.. | .. |
---|
202 | 221 | //zBufferItem.addActionListener(this); |
---|
203 | 222 | //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); |
---|
204 | 223 | //normalLensItem.addActionListener(this); |
---|
205 | | - cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint")); |
---|
206 | | - revertCameraItem.addActionListener(this); |
---|
| 224 | + cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint")); |
---|
| 225 | + restoreCameraItem.addActionListener(this); |
---|
207 | 226 | |
---|
208 | | - cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
209 | | - toggleFullScreenItem.addItemListener(this); |
---|
210 | | - toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
211 | | - cameraMenu.add("-"); |
---|
| 227 | +// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); |
---|
| 228 | +// toggleFullScreenItem.addItemListener(this); |
---|
| 229 | +// toggleFullScreenItem.setState(CameraPane.FULLSCREEN); |
---|
| 230 | +// cameraMenu.add("-"); |
---|
| 231 | +// |
---|
| 232 | +// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
| 233 | +// toggleTextureItem.addItemListener(this); |
---|
| 234 | +// toggleTextureItem.setState(CameraPane.textureon); |
---|
| 235 | +// |
---|
| 236 | +// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch")); |
---|
| 237 | +// toggleSwitchItem.addItemListener(this); |
---|
| 238 | +// toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
212 | 239 | |
---|
213 | | - cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture")); |
---|
214 | | - toggleTextureItem.addItemListener(this); |
---|
215 | | - toggleTextureItem.setState(CameraPane.textureon); |
---|
216 | | - |
---|
217 | | - cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch")); |
---|
218 | | - toggleSwitchItem.addItemListener(this); |
---|
219 | | - toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
220 | | - |
---|
221 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
| 240 | + cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles")); |
---|
222 | 241 | toggleHandleItem.addItemListener(this); |
---|
223 | 242 | toggleHandleItem.setState(CameraPane.HANDLES); |
---|
224 | 243 | |
---|
.. | .. |
---|
273 | 292 | { |
---|
274 | 293 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
275 | 294 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
276 | | - //cameraMenu.add(switchItem = new MenuItem("Reverse View")); |
---|
| 295 | + //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
277 | 296 | editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
278 | 297 | oe.cameraMenu.add("-"); |
---|
279 | 298 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
.. | .. |
---|
281 | 300 | editLeafItem.addActionListener(this); |
---|
282 | 301 | lookAtItem.addActionListener(this); |
---|
283 | 302 | //lookFromItem.addActinoListener(this); |
---|
284 | | - //switchItem.addActionListener(this); |
---|
| 303 | + //switchViewItem.addActionListener(this); |
---|
285 | 304 | } |
---|
286 | 305 | |
---|
287 | 306 | oe.menuBar.add(menu = new Menu("Setting")); |
---|
.. | .. |
---|
326 | 345 | } |
---|
327 | 346 | |
---|
328 | 347 | oe.menuBar.add(menu = new Menu("Group")); |
---|
329 | | - grabItem = menu.add(new MenuItem("Grab")); |
---|
330 | | - grabItem.addActionListener(this); |
---|
| 348 | +// grabItem = menu.add(new MenuItem("Grab")); |
---|
| 349 | +// grabItem.addActionListener(this); |
---|
331 | 350 | backItem = menu.add(new MenuItem("Back")); |
---|
332 | 351 | backItem.addActionListener(this); |
---|
333 | 352 | frontItem = menu.add(new MenuItem("Front")); |
---|
334 | 353 | frontItem.addActionListener(this); |
---|
335 | | - compositeItem = menu.add(new MenuItem("Composite")); |
---|
336 | | - compositeItem.addActionListener(this); |
---|
| 354 | +// compositeItem = menu.add(new MenuItem("Composite")); |
---|
| 355 | +// compositeItem.addActionListener(this); |
---|
| 356 | + |
---|
| 357 | + if (Globals.ADVANCED) |
---|
| 358 | + { |
---|
337 | 359 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
338 | 360 | hideItem.addActionListener(this); |
---|
| 361 | + } |
---|
339 | 362 | ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
340 | 363 | ungroupItem.addActionListener(this); |
---|
341 | | - menu.add("-"); |
---|
342 | | - randomItem = menu.add(new MenuItem("Switch node")); |
---|
343 | | - randomItem.addActionListener(this); |
---|
| 364 | + |
---|
| 365 | +// menu.add("-"); |
---|
| 366 | +// |
---|
| 367 | +// switchItem = menu.add(new MenuItem("Switch node")); |
---|
| 368 | +// switchItem.addActionListener(this); |
---|
| 369 | + if (Globals.ADVANCED) |
---|
| 370 | + { |
---|
344 | 371 | switchGeoItem = menu.add(new MenuItem("Switch Geometry")); |
---|
345 | 372 | switchGeoItem.addActionListener(this); |
---|
346 | 373 | switchTransfoItem = menu.add(new MenuItem("Switch Transform")); |
---|
.. | .. |
---|
348 | 375 | morphItem = menu.add(new MenuItem("Morph Group")); |
---|
349 | 376 | morphItem.addActionListener(this); |
---|
350 | 377 | |
---|
351 | | - if (Globals.ADVANCED) |
---|
352 | | - { |
---|
353 | 378 | menu.add("-"); |
---|
354 | 379 | physicsItem = menu.add(new MenuItem("Physics")); |
---|
355 | 380 | physicsItem.addActionListener(this); |
---|
.. | .. |
---|
357 | 382 | frameselectorItem.addActionListener(this); |
---|
358 | 383 | scriptNodeItem = menu.add(new MenuItem("Script Node")); |
---|
359 | 384 | scriptNodeItem.addActionListener(this); |
---|
360 | | - cameraItem = menu.add(new MenuItem("Camera")); |
---|
361 | | - cameraItem.addActionListener(this); |
---|
362 | 385 | } |
---|
363 | 386 | |
---|
364 | 387 | oe.menuBar.add(menu = new Menu("Object")); |
---|
365 | | - textureItem = menu.add(new MenuItem("Texture")); |
---|
366 | | - textureItem.addActionListener(this); |
---|
| 388 | +// textureItem = menu.add(new MenuItem("Texture")); |
---|
| 389 | +// textureItem.addActionListener(this); |
---|
367 | 390 | billboardItem = menu.add(new MenuItem("Billboard")); |
---|
368 | 391 | billboardItem.addActionListener(this); |
---|
369 | 392 | csgItem = menu.add(new MenuItem("CSG")); |
---|
.. | .. |
---|
374 | 397 | shadowYItem.addActionListener(this); |
---|
375 | 398 | shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
376 | 399 | shadowZItem.addActionListener(this); |
---|
| 400 | + attributeItem = menu.add(new MenuItem("Attribute")); |
---|
| 401 | + attributeItem.addActionListener(this); |
---|
| 402 | + |
---|
377 | 403 | if (Globals.ADVANCED) |
---|
378 | 404 | { |
---|
379 | 405 | menu.add("-"); |
---|
380 | 406 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
381 | 407 | linkerItem.addActionListener(this); |
---|
382 | | - attributeItem = menu.add(new MenuItem("Attribute")); |
---|
383 | | - attributeItem.addActionListener(this); |
---|
384 | 408 | templateItem = menu.add(new MenuItem("Template")); |
---|
385 | 409 | templateItem.addActionListener(this); |
---|
386 | 410 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
.. | .. |
---|
532 | 556 | buildToolsMenu(menu); |
---|
533 | 557 | } |
---|
534 | 558 | |
---|
| 559 | + |
---|
535 | 560 | void SetupUI2(ObjEditor oe) |
---|
536 | 561 | { |
---|
537 | 562 | // June 2019 |
---|
.. | .. |
---|
574 | 599 | oe.radioPanel.add(dummyButton); |
---|
575 | 600 | oe.buttonGroup.add(dummyButton); |
---|
576 | 601 | */ |
---|
| 602 | + cGridBag copyOptionsPanel = new cGridBag(); |
---|
| 603 | + |
---|
| 604 | + copyOptionsPanel.preferredHeight = 1; |
---|
| 605 | + |
---|
577 | 606 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
578 | 607 | |
---|
579 | 608 | //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
580 | 609 | //minButton.setToolTipText("Minimize window"); |
---|
581 | 610 | //minButton.addActionListener(this); |
---|
582 | 611 | |
---|
583 | | - oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
584 | | - maxButton.setToolTipText("Maximize window"); |
---|
585 | | - maxButton.addActionListener(this); |
---|
| 612 | + if (Globals.ADVANCED) |
---|
| 613 | + { |
---|
| 614 | + oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 615 | + maxButton.setToolTipText("Maximize window"); |
---|
| 616 | + maxButton.addActionListener(this); |
---|
| 617 | + } |
---|
586 | 618 | |
---|
587 | | - oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 619 | + oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
588 | 620 | fullButton.setToolTipText("Full-screen window"); |
---|
589 | 621 | fullButton.addActionListener(this); |
---|
590 | 622 | |
---|
591 | | - oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
592 | | - undoButton.setToolTipText("Undo changes"); |
---|
593 | | - undoButton.addActionListener(this); |
---|
| 623 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 624 | + screenfitButton.setToolTipText("Screen fit"); |
---|
| 625 | + screenfitButton.addActionListener(this); |
---|
| 626 | + |
---|
| 627 | + oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 628 | + restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
| 629 | + restoreCameraButton.addActionListener(this); |
---|
594 | 630 | |
---|
595 | | - oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
596 | | - redoButton.setToolTipText("Redo changes"); |
---|
597 | | - redoButton.addActionListener(this); |
---|
598 | | - |
---|
599 | | - oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
600 | | - saveButton.setToolTipText("Save changes"); |
---|
| 631 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 632 | + saveButton.setToolTipText("New version"); |
---|
601 | 633 | saveButton.addActionListener(this); |
---|
| 634 | + |
---|
| 635 | + copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 636 | + undoButton.setToolTipText("Previous version"); |
---|
| 637 | + undoButton.addActionListener(this); |
---|
| 638 | + undoButton.setEnabled(false); |
---|
602 | 639 | |
---|
603 | | - oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 640 | + cGridBag updown = new cGridBag().setVertical(true); |
---|
| 641 | + updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 642 | + restoreButton.setToolTipText("Restore current"); |
---|
| 643 | + restoreButton.addActionListener(this); |
---|
| 644 | + restoreButton.setEnabled(false); |
---|
| 645 | + |
---|
| 646 | + updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 647 | + replaceButton.setToolTipText("Replace current"); |
---|
| 648 | + replaceButton.addActionListener(this); |
---|
| 649 | + replaceButton.setEnabled(false); |
---|
| 650 | + |
---|
| 651 | + copyOptionsPanel.add(updown); |
---|
| 652 | + |
---|
| 653 | + copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 654 | + redoButton.setToolTipText("Next version"); |
---|
| 655 | + redoButton.addActionListener(this); |
---|
| 656 | + redoButton.setEnabled(false); |
---|
| 657 | + |
---|
| 658 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
604 | 659 | liveCB.setToolTipText("Enable animation"); |
---|
605 | 660 | liveCB.addItemListener(this); |
---|
606 | 661 | |
---|
607 | | - oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 662 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
608 | 663 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
609 | 664 | oneStepButton.addActionListener(this); |
---|
610 | 665 | |
---|
611 | | - oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints); |
---|
| 666 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
612 | 667 | fastCB.setToolTipText("Fast mode"); |
---|
613 | 668 | fastCB.addItemListener(this); |
---|
614 | 669 | |
---|
615 | | - oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints); |
---|
616 | | - trackCB.setToolTipText("Enable tracking"); |
---|
617 | | - trackCB.addItemListener(this); |
---|
618 | | - |
---|
619 | | - oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
620 | | - screenfitButton.setToolTipText("Screen fit"); |
---|
621 | | - screenfitButton.addActionListener(this); |
---|
| 670 | + //oe.toolboxPanel.Return(); |
---|
| 671 | + |
---|
| 672 | +// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); |
---|
| 673 | +// trackCB.setToolTipText("Enable tracking"); |
---|
| 674 | +// trackCB.addItemListener(this); |
---|
622 | 675 | |
---|
623 | 676 | // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints); |
---|
624 | 677 | // screenfitpointButton.addActionListener(this); |
---|
.. | .. |
---|
630 | 683 | snapobjectButton.setToolTipText("Snap Object"); |
---|
631 | 684 | } |
---|
632 | 685 | |
---|
633 | | - oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
634 | | - flashSelectionButton.setToolTipText("Show selection"); |
---|
635 | | - flashSelectionButton.addActionListener(this); |
---|
636 | | - |
---|
637 | | - oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
| 686 | + //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
638 | 687 | |
---|
639 | 688 | oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
640 | 689 | twoButton.setToolTipText("Show center view only"); |
---|
641 | 690 | twoButton.addActionListener(this); |
---|
| 691 | + this.fullscreenLayout = twoButton; |
---|
| 692 | + |
---|
642 | 693 | oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
643 | 694 | fourButton.addActionListener(this); |
---|
644 | 695 | fourButton.setToolTipText("Show left panel only"); |
---|
.. | .. |
---|
653 | 704 | sevenButton.addActionListener(this); |
---|
654 | 705 | // |
---|
655 | 706 | |
---|
656 | | - oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 707 | + oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
657 | 708 | rootButton.setToolTipText("Edit selection in new tab"); |
---|
658 | 709 | rootButton.addActionListener(this); |
---|
659 | 710 | |
---|
660 | | - oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 711 | + oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
661 | 712 | closeButton.setToolTipText("Close tab"); |
---|
662 | 713 | closeButton.addActionListener(this); |
---|
663 | 714 | //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); |
---|
664 | 715 | //clearButton.addActionListener(this); |
---|
665 | | - |
---|
666 | | - editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
667 | | - editButton.setToolTipText("Edit selection"); |
---|
| 716 | + |
---|
| 717 | + // INSERT |
---|
| 718 | + oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 719 | + gridButton.setToolTipText("Create grid"); |
---|
| 720 | + gridButton.addActionListener(this); |
---|
| 721 | + |
---|
| 722 | + oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 723 | + boxButton.setToolTipText("Create box"); |
---|
| 724 | + boxButton.addActionListener(this); |
---|
| 725 | + |
---|
| 726 | + oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 727 | + sphereButton.setToolTipText("Create sphere"); |
---|
| 728 | + sphereButton.addActionListener(this); |
---|
| 729 | + |
---|
| 730 | + oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 731 | + coneButton.setToolTipText("Create cone"); |
---|
| 732 | + coneButton.addActionListener(this); |
---|
| 733 | + |
---|
| 734 | + oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 735 | + torusButton.setToolTipText("Create torus"); |
---|
| 736 | + torusButton.addActionListener(this); |
---|
| 737 | + |
---|
| 738 | + oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 739 | + superButton.setToolTipText("Create superellipsoid"); |
---|
| 740 | + superButton.addActionListener(this); |
---|
| 741 | + |
---|
| 742 | + if (Globals.ADVANCED) |
---|
| 743 | + { |
---|
| 744 | + oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 745 | + kleinButton.setToolTipText("Create Klein bottle"); |
---|
| 746 | + kleinButton.addActionListener(this); |
---|
| 747 | + } |
---|
| 748 | + |
---|
| 749 | + oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 750 | + particlesButton.setToolTipText("Create particle system"); |
---|
| 751 | + particlesButton.addActionListener(this); |
---|
| 752 | + |
---|
| 753 | + oe.toolboxPanel.Return(); |
---|
| 754 | + |
---|
| 755 | + oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 756 | + groupButton.setToolTipText("Create group"); |
---|
| 757 | + groupButton.addActionListener(this); |
---|
| 758 | + |
---|
| 759 | + oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 760 | + compositeButton.setToolTipText("Create composite"); |
---|
| 761 | + compositeButton.addActionListener(this); |
---|
| 762 | + |
---|
| 763 | + oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 764 | + switchButton.setToolTipText("Create item switcher"); |
---|
| 765 | + switchButton.addActionListener(this); |
---|
| 766 | + |
---|
| 767 | + oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 768 | + loopButton.setToolTipText("Create loop"); |
---|
| 769 | + loopButton.addActionListener(this); |
---|
| 770 | + |
---|
| 771 | + oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 772 | + textureButton.setToolTipText("Create texture"); |
---|
| 773 | + textureButton.addActionListener(this); |
---|
| 774 | + |
---|
| 775 | + oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 776 | + overlayButton.setToolTipText("Create overlay"); |
---|
| 777 | + overlayButton.addActionListener(this); |
---|
| 778 | + |
---|
| 779 | + oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 780 | + lightButton.setToolTipText("Create light"); |
---|
| 781 | + lightButton.addActionListener(this); |
---|
| 782 | + |
---|
| 783 | + for (int i=6; --i>=0;) |
---|
| 784 | + { |
---|
| 785 | + oe.toolboxPanel.Return(); |
---|
| 786 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 787 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 788 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 789 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 790 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 791 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 792 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 793 | + } |
---|
| 794 | + |
---|
| 795 | + // EDIT panel |
---|
| 796 | + editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 797 | + editButton.setToolTipText("Pin selection controls"); |
---|
668 | 798 | editButton.addActionListener(this); |
---|
669 | 799 | |
---|
670 | | - editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
671 | | - uneditButton.setToolTipText("Unedit selection"); |
---|
| 800 | + editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 801 | + uneditButton.setToolTipText("Remove selection controls"); |
---|
672 | 802 | uneditButton.addActionListener(this); |
---|
673 | 803 | |
---|
674 | 804 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
675 | | - allParamsButton.setToolTipText("Edit all params"); |
---|
| 805 | + allParamsButton.setToolTipText("Show all controle"); |
---|
676 | 806 | allParamsButton.addActionListener(this); |
---|
677 | 807 | |
---|
678 | 808 | editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
683 | 813 | unselectButton.setToolTipText("Unselect"); |
---|
684 | 814 | unselectButton.addActionListener(this); |
---|
685 | 815 | |
---|
| 816 | + editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 817 | + flashSelectionButton.setToolTipText("Highlight selection"); |
---|
| 818 | + flashSelectionButton.addActionListener(this); |
---|
| 819 | + |
---|
686 | 820 | editCommandsPanel.preferredHeight = 1; |
---|
687 | 821 | |
---|
| 822 | + SetPinStates(false); |
---|
688 | 823 | // oe.treePanel.add(commandsPanel); |
---|
689 | 824 | // oe.treePanel.Return(); |
---|
690 | 825 | |
---|
.. | .. |
---|
703 | 838 | |
---|
704 | 839 | JScrollPane jSP; |
---|
705 | 840 | //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); |
---|
706 | | - jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints); |
---|
| 841 | + jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints); |
---|
707 | 842 | ResetModel(); |
---|
708 | 843 | |
---|
709 | 844 | oe.treePanel.add(jSPPanel); |
---|
710 | 845 | oe.treePanel.Return(); |
---|
711 | 846 | |
---|
712 | | - cGridBag copyOptionsPanel = new cGridBag(); |
---|
713 | | - |
---|
714 | | - copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints); |
---|
715 | | - colorCB.setToolTipText("Copy color when dropped"); |
---|
716 | | - colorCB.addItemListener(this); |
---|
717 | | - |
---|
718 | | - copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints); |
---|
719 | | - materialCB.setToolTipText("Copy material when dropped"); |
---|
720 | | - materialCB.addItemListener(this); |
---|
721 | | - |
---|
722 | | - copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints); |
---|
723 | | - textureCB.setToolTipText("Copy texture when dropped"); |
---|
724 | | - textureCB.addItemListener(this); |
---|
725 | | - |
---|
726 | | - copyOptionsPanel.preferredHeight = 1; |
---|
727 | 847 | oe.treePanel.add(copyOptionsPanel); |
---|
728 | 848 | oe.treePanel.Return(); |
---|
| 849 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 850 | + versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 851 | + sliderPane.preferredHeight = 1; |
---|
729 | 852 | |
---|
730 | 853 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
731 | 854 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
754 | 877 | |
---|
755 | 878 | void AddOptions(cGridBag panel) //, GridBagConstraints constraints) |
---|
756 | 879 | { |
---|
| 880 | + panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints); |
---|
| 881 | + colorCB.setToolTipText("Copy color when dropped"); |
---|
| 882 | + colorCB.addItemListener(this); |
---|
| 883 | + |
---|
| 884 | + panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints); |
---|
| 885 | + materialCB.setToolTipText("Copy material when dropped"); |
---|
| 886 | + materialCB.addItemListener(this); |
---|
| 887 | + |
---|
| 888 | + panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints); |
---|
| 889 | + textureCB.setToolTipText("Copy texture when dropped"); |
---|
| 890 | + textureCB.addItemListener(this); |
---|
| 891 | + |
---|
| 892 | + panel.Return(); |
---|
| 893 | + |
---|
757 | 894 | panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints); |
---|
758 | 895 | boxCB.setToolTipText("Display bounding boxes"); |
---|
759 | 896 | boxCB.addItemListener(this); |
---|
760 | 897 | |
---|
761 | 898 | panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints); |
---|
762 | | - zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel"); |
---|
| 899 | + zoomBoxCB.setToolTipText("Display only for wheel"); |
---|
763 | 900 | zoomBoxCB.addItemListener(this); |
---|
764 | 901 | |
---|
765 | 902 | if (true) // Globals.ADVANCED) |
---|
766 | 903 | { |
---|
767 | | - panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
768 | | - supportCB.setToolTipText("Enable rigging"); |
---|
769 | | - supportCB.addItemListener(this); |
---|
| 904 | +// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
| 905 | +// supportCB.setToolTipText("Enable rigging"); |
---|
| 906 | +// supportCB.addItemListener(this); |
---|
| 907 | + |
---|
| 908 | + panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints); |
---|
| 909 | + freezeCB.setToolTipText("Fast moving camera"); |
---|
| 910 | + freezeCB.addItemListener(this); |
---|
770 | 911 | |
---|
771 | 912 | // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); |
---|
772 | 913 | // localCB.addItemListener(this); |
---|
773 | 914 | |
---|
| 915 | + panel.Return(); |
---|
| 916 | + |
---|
774 | 917 | panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints); |
---|
775 | 918 | crowdCB.setToolTipText("Used for crowds"); |
---|
776 | 919 | crowdCB.addItemListener(this); |
---|
.. | .. |
---|
787 | 930 | // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints); |
---|
788 | 931 | // speakerMocapCB.addItemListener(this); |
---|
789 | 932 | |
---|
| 933 | + panel.Return(); |
---|
| 934 | + |
---|
790 | 935 | if (false) |
---|
791 | 936 | { |
---|
792 | 937 | // handled in scripts |
---|
.. | .. |
---|
801 | 946 | //constraints.gridy += 1; |
---|
802 | 947 | panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints); |
---|
803 | 948 | smoothfocusCB.addItemListener(this); |
---|
| 949 | + panel.Return(); |
---|
804 | 950 | } |
---|
805 | 951 | |
---|
806 | 952 | //constraints.gridx += 1; |
---|
807 | 953 | //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints); |
---|
808 | 954 | // debugCB.addItemListener(this); |
---|
809 | 955 | |
---|
| 956 | + panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints); |
---|
| 957 | + trackCB.setToolTipText("Enable tracking target"); |
---|
| 958 | + trackCB.addItemListener(this); |
---|
| 959 | + |
---|
810 | 960 | panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints); |
---|
| 961 | + oeilCB.setToolTipText("Move camera when tracking"); |
---|
811 | 962 | oeilCB.addItemListener(this); |
---|
812 | 963 | |
---|
| 964 | + panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints); |
---|
| 965 | + shadowCB.setToolTipText("When live compute shadows"); |
---|
| 966 | + shadowCB.addItemListener(this); |
---|
| 967 | + |
---|
| 968 | + panel.Return(); |
---|
| 969 | + panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints); |
---|
| 970 | + toggleTextureCB.setToolTipText("Load textures"); |
---|
| 971 | + toggleTextureCB.addItemListener(this); |
---|
| 972 | + |
---|
| 973 | + panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints); |
---|
| 974 | + toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
| 975 | + toggleSwitchCB.addItemListener(this); |
---|
| 976 | + |
---|
| 977 | + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); |
---|
| 978 | + autokeepCB.setToolTipText("On structure change"); |
---|
| 979 | + autokeepCB.addItemListener(this); |
---|
| 980 | + |
---|
| 981 | + panel.Return(); |
---|
| 982 | + if (Globals.ADVANCED) |
---|
| 983 | + { |
---|
813 | 984 | panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints); |
---|
814 | 985 | lookAtCB.setToolTipText("Look-at target"); |
---|
815 | 986 | lookAtCB.addItemListener(this); |
---|
| 987 | + } |
---|
816 | 988 | |
---|
817 | 989 | } |
---|
818 | 990 | |
---|
819 | 991 | cGridBag fill = new cGridBag(); |
---|
820 | | - |
---|
821 | 992 | fill.preferredHeight = 200; |
---|
| 993 | + cGridBag fill2 = new cGridBag(); |
---|
| 994 | + fill2.preferredHeight = 200; |
---|
| 995 | + cGridBag fill3 = new cGridBag(); |
---|
| 996 | + fill3.preferredHeight = 200; |
---|
822 | 997 | |
---|
823 | 998 | panel.add(fill); |
---|
| 999 | + panel.add(fill2); |
---|
| 1000 | + panel.add(fill3); |
---|
824 | 1001 | |
---|
825 | 1002 | } |
---|
826 | 1003 | |
---|
827 | 1004 | void EditObject(Object3D obj) |
---|
828 | 1005 | { |
---|
829 | 1006 | cRadio radioButton = new cRadio(obj.name); |
---|
| 1007 | + |
---|
| 1008 | + // June 2019. Patch to avoid bug with transparency. |
---|
| 1009 | + radioButton.hadMaterial = obj.material != null; |
---|
| 1010 | + if (!radioButton.hadMaterial) |
---|
| 1011 | + { |
---|
| 1012 | + obj.material = new cMaterial(); |
---|
| 1013 | + } |
---|
| 1014 | + |
---|
830 | 1015 | radioButton.SetObject(obj); |
---|
831 | 1016 | radioButton.layout = sevenButton; |
---|
832 | 1017 | radioButton.SetCamera(cameraView.renderCamera, false); |
---|
.. | .. |
---|
848 | 1033 | /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this); |
---|
849 | 1034 | } |
---|
850 | 1035 | |
---|
851 | | - JCheckBox liveCB; |
---|
852 | | - JCheckBox supportCB; |
---|
853 | | - JCheckBox localCB; |
---|
854 | | - JCheckBox crowdCB; |
---|
855 | | - JCheckBox smoothCB; |
---|
856 | | - JCheckBox fastCB; |
---|
857 | | - JCheckBox slowCB; |
---|
858 | | - JCheckBox boxCB; |
---|
859 | | - JCheckBox zoomBoxCB; |
---|
860 | | - JCheckBox trackCB; |
---|
861 | | - JCheckBox smoothfocusCB; |
---|
| 1036 | + cToggleButton liveCB; |
---|
| 1037 | + cCheckBox supportCB; |
---|
| 1038 | + cCheckBox localCB; |
---|
| 1039 | + cCheckBox crowdCB; |
---|
| 1040 | + cCheckBox smoothCB; |
---|
| 1041 | + cToggleButton fastCB; |
---|
| 1042 | + cCheckBox slowCB; |
---|
| 1043 | + cCheckBox boxCB; |
---|
| 1044 | + cCheckBox zoomBoxCB; |
---|
| 1045 | + cCheckBox freezeCB; |
---|
| 1046 | + //cToggleButton trackCB; |
---|
| 1047 | + cCheckBox trackCB; |
---|
| 1048 | + cCheckBox smoothfocusCB; |
---|
862 | 1049 | // JCheckBox speakerMocapCB; |
---|
863 | | - JCheckBox speakerCameraCB; |
---|
864 | | - JCheckBox speakerFocusCB; |
---|
865 | | - JCheckBox debugCB; |
---|
866 | | - JCheckBox oeilCB; |
---|
867 | | - JCheckBox lookAtCB; |
---|
| 1050 | + cCheckBox speakerCameraCB; |
---|
| 1051 | + cCheckBox speakerFocusCB; |
---|
| 1052 | + cCheckBox debugCB; |
---|
| 1053 | + |
---|
| 1054 | + cCheckBox oeilCB; |
---|
| 1055 | + cCheckBox shadowCB; |
---|
| 1056 | + cCheckBox autokeepCB; |
---|
| 1057 | + cCheckBox lookAtCB; |
---|
868 | 1058 | |
---|
869 | 1059 | // static int COLOR = 1; |
---|
870 | 1060 | // static int MATERIAL = 2; |
---|
.. | .. |
---|
872 | 1062 | |
---|
873 | 1063 | int dropAttributes = Object3D.COLOR | Object3D.MATERIAL; |
---|
874 | 1064 | |
---|
875 | | - JCheckBox colorCB; |
---|
876 | | - JCheckBox materialCB; |
---|
877 | | - JCheckBox textureCB; |
---|
| 1065 | + cCheckBox colorCB; |
---|
| 1066 | + cCheckBox materialCB; |
---|
| 1067 | + cCheckBox textureCB; |
---|
878 | 1068 | |
---|
879 | 1069 | public void itemStateChanged(ItemEvent e) |
---|
880 | 1070 | { |
---|
.. | .. |
---|
967 | 1157 | { |
---|
968 | 1158 | cameraView.ToggleOeil(); |
---|
969 | 1159 | } |
---|
| 1160 | + else if(e.getSource() == shadowCB) |
---|
| 1161 | + { |
---|
| 1162 | + Globals.COMPUTESHADOWWHENLIVE ^= true; |
---|
| 1163 | + } |
---|
| 1164 | + else if(e.getSource() == freezeCB) |
---|
| 1165 | + { |
---|
| 1166 | + Globals.FREEZEONMOVE ^= true; |
---|
| 1167 | + } |
---|
| 1168 | + else if(e.getSource() == autokeepCB) |
---|
| 1169 | + { |
---|
| 1170 | + Globals.REPLACEONMAKE ^= true; |
---|
| 1171 | + } |
---|
970 | 1172 | else if(e.getSource() == lookAtCB) |
---|
971 | 1173 | { |
---|
972 | 1174 | cameraView.ToggleLookAt(); |
---|
.. | .. |
---|
983 | 1185 | |
---|
984 | 1186 | /**/ |
---|
985 | 1187 | //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this); |
---|
986 | | - TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent()); |
---|
| 1188 | + //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent()); |
---|
| 1189 | + TreePath path = objEditor.jTree.getSelectionPath(); |
---|
987 | 1190 | if ((path == null) || (path.getPathCount() <= 1)) { |
---|
988 | 1191 | // We can't move the root node or an empty selection |
---|
989 | 1192 | return; |
---|
.. | .. |
---|
1046 | 1249 | } |
---|
1047 | 1250 | } |
---|
1048 | 1251 | |
---|
1049 | | - String string = (String) object; |
---|
1050 | | - |
---|
1051 | 1252 | System.out.println("Transfer = " + object + "; drop : " + target); |
---|
1052 | 1253 | // if( object instanceof java.io.File[]) |
---|
1053 | 1254 | // { |
---|
.. | .. |
---|
1055 | 1256 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
1056 | 1257 | // return; |
---|
1057 | 1258 | // } |
---|
| 1259 | + |
---|
| 1260 | + String string = object.toString(); |
---|
1058 | 1261 | |
---|
1059 | 1262 | // File path for Mac and Windows |
---|
1060 | 1263 | if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
.. | .. |
---|
1100 | 1303 | |
---|
1101 | 1304 | assert target == objEditor.jTree; |
---|
1102 | 1305 | TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y); |
---|
| 1306 | + Object3D destinationLeaf; |
---|
1103 | 1307 | try { |
---|
1104 | | - Object3D dummy = (Composite) destinationPath.getLastPathComponent(); |
---|
| 1308 | + destinationLeaf = (Composite) destinationPath.getLastPathComponent(); |
---|
1105 | 1309 | } catch (Exception e) { |
---|
1106 | 1310 | System.out.println("destinationPath : " + destinationPath); |
---|
1107 | 1311 | return; |
---|
1108 | 1312 | } |
---|
1109 | 1313 | |
---|
1110 | | - if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK) |
---|
| 1314 | + for (int i=group.selection.size(); --i>=0;) |
---|
1111 | 1315 | { |
---|
| 1316 | + Object3D child = (Object3D)group.selection.elementAt(i); |
---|
| 1317 | + |
---|
| 1318 | + // Cannot move into itself |
---|
| 1319 | + if (child == destinationLeaf) |
---|
| 1320 | + return; |
---|
| 1321 | + } |
---|
| 1322 | + |
---|
| 1323 | +// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK) |
---|
| 1324 | +// { |
---|
1112 | 1325 | loadClipboard(true); |
---|
1113 | 1326 | objEditor.jTree.setSelectionPath(destinationPath); |
---|
1114 | 1327 | pasteInto(false, false); |
---|
1115 | | - } else { |
---|
1116 | | - loadClipboard(false); |
---|
1117 | | - objEditor.jTree.setSelectionPath(destinationPath); |
---|
1118 | | - pasteInto(false, false); // true); // ??? |
---|
1119 | | - } |
---|
| 1328 | +// } else { |
---|
| 1329 | +// loadClipboard(false); |
---|
| 1330 | +// objEditor.jTree.setSelectionPath(destinationPath); |
---|
| 1331 | +// pasteInto(false, false); // true); // ??? |
---|
| 1332 | +// } |
---|
1120 | 1333 | } |
---|
1121 | 1334 | public void dropActionChanged(DropTargetDragEvent dtde) |
---|
1122 | 1335 | // Called if the user has modified the current drop gesture |
---|
.. | .. |
---|
1221 | 1434 | { |
---|
1222 | 1435 | //heightFieldItem = menu.add(new MenuItem("Height Field")); |
---|
1223 | 1436 | //heightFieldItem.addActionListener(this); |
---|
1224 | | - gridItem = menu.add(new MenuItem("Grid")); |
---|
1225 | | - gridItem.addActionListener(this); |
---|
1226 | | - rectoidItem = menu.add(new MenuItem("Box")); |
---|
1227 | | - rectoidItem.addActionListener(this); |
---|
1228 | | - ellipsoidItem = menu.add(new MenuItem("Sphere")); |
---|
1229 | | - ellipsoidItem.addActionListener(this); |
---|
1230 | | - coneItem = menu.add(new MenuItem("Cone")); |
---|
1231 | | - coneItem.addActionListener(this); |
---|
1232 | | - torusItem = menu.add(new MenuItem("Torus")); |
---|
1233 | | - torusItem.addActionListener(this); |
---|
1234 | | - superItem = menu.add(new MenuItem("Superellipsoid")); |
---|
1235 | | - superItem.addActionListener(this); |
---|
| 1437 | +// gridItem = menu.add(new MenuItem("Grid")); |
---|
| 1438 | +// gridItem.addActionListener(this); |
---|
| 1439 | +// rectoidItem = menu.add(new MenuItem("Box")); |
---|
| 1440 | +// rectoidItem.addActionListener(this); |
---|
| 1441 | +// ellipsoidItem = menu.add(new MenuItem("Sphere")); |
---|
| 1442 | +// ellipsoidItem.addActionListener(this); |
---|
| 1443 | +// coneItem = menu.add(new MenuItem("Cone")); |
---|
| 1444 | +// coneItem.addActionListener(this); |
---|
| 1445 | +// torusItem = menu.add(new MenuItem("Torus")); |
---|
| 1446 | +// torusItem.addActionListener(this); |
---|
| 1447 | +// superItem = menu.add(new MenuItem("Superellipsoid")); |
---|
| 1448 | +// superItem.addActionListener(this); |
---|
| 1449 | + |
---|
| 1450 | + cameraItem = menu.add(new MenuItem("Camera")); |
---|
| 1451 | + cameraItem.addActionListener(this); |
---|
| 1452 | + |
---|
| 1453 | + if (!Globals.ADVANCED) |
---|
| 1454 | + { |
---|
1236 | 1455 | kleinItem = menu.add(new MenuItem("Klein Bottle")); |
---|
1237 | 1456 | kleinItem.addActionListener(this); |
---|
1238 | | - particleItem = menu.add(new MenuItem("Particle system")); |
---|
1239 | | - particleItem.addActionListener(this); |
---|
| 1457 | + } |
---|
| 1458 | + |
---|
| 1459 | +// particleItem = menu.add(new MenuItem("Particle system")); |
---|
| 1460 | +// particleItem.addActionListener(this); |
---|
1240 | 1461 | if (Globals.ADVANCED) |
---|
1241 | 1462 | { |
---|
1242 | 1463 | ragdollItem = menu.add(new MenuItem("Rag Walk")); |
---|
.. | .. |
---|
1262 | 1483 | } |
---|
1263 | 1484 | bezierItem = menu.add(new MenuItem("Bezier Patch")); |
---|
1264 | 1485 | bezierItem.addActionListener(this); |
---|
1265 | | - overlayItem = menu.add(new MenuItem("Overlay")); |
---|
1266 | | - overlayItem.addActionListener(this); |
---|
1267 | | - lightItem = menu.add(new MenuItem("Light")); |
---|
1268 | | - lightItem.addActionListener(this); |
---|
| 1486 | +// overlayItem = menu.add(new MenuItem("Overlay")); |
---|
| 1487 | +// overlayItem.addActionListener(this); |
---|
| 1488 | +// lightItem = menu.add(new MenuItem("Light")); |
---|
| 1489 | +// lightItem.addActionListener(this); |
---|
1269 | 1490 | menu.add("-"); |
---|
1270 | 1491 | //superLoopItem = menu.add(new MenuItem("Super Loop")); |
---|
1271 | 1492 | //superLoopItem.addActionListener(this); |
---|
1272 | | - loopItem = menu.add(new MenuItem("Loop")); |
---|
1273 | | - loopItem.addActionListener(this); |
---|
| 1493 | +// loopItem = menu.add(new MenuItem("Loop")); |
---|
| 1494 | +// loopItem.addActionListener(this); |
---|
1274 | 1495 | doubleItem = menu.add(new MenuItem("Fork")); |
---|
1275 | 1496 | doubleItem.addActionListener(this); |
---|
1276 | 1497 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
1286 | 1507 | animationItem.addItemListener(this); |
---|
1287 | 1508 | animationItem.setState(Globals.ANIMATION); |
---|
1288 | 1509 | |
---|
| 1510 | + menu.add(archiveItem = new MenuItem("Archive3D...")); |
---|
| 1511 | + archiveItem.addActionListener(this); |
---|
| 1512 | + |
---|
1289 | 1513 | menu.add("-"); |
---|
1290 | 1514 | parseverticesItem = menu.add(new MenuItem("Multiplicity")); |
---|
1291 | 1515 | parseverticesItem.addActionListener(this); |
---|
.. | .. |
---|
1298 | 1522 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1299 | 1523 | reduce34MorphItem.addActionListener(this); |
---|
1300 | 1524 | menu.add("-"); |
---|
| 1525 | + menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
| 1526 | + memoryItem.addActionListener(this); |
---|
1301 | 1527 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1302 | 1528 | computeAOItem.addActionListener(this); |
---|
1303 | 1529 | |
---|
.. | .. |
---|
1306 | 1532 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
1307 | 1533 | mirrorItem.addActionListener(this); |
---|
1308 | 1534 | menu.add("-"); |
---|
1309 | | - menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
1310 | | - memoryItem.addActionListener(this); |
---|
1311 | 1535 | menu.add(analyzeItem = new MenuItem("Analyze")); |
---|
1312 | 1536 | analyzeItem.addActionListener(this); |
---|
1313 | 1537 | menu.add(dumpItem = new MenuItem("Print")); |
---|
.. | .. |
---|
1455 | 1679 | |
---|
1456 | 1680 | makeSomething(shadow); |
---|
1457 | 1681 | } |
---|
| 1682 | + |
---|
| 1683 | + private void ClearUnpinned() |
---|
| 1684 | + { |
---|
| 1685 | + //for (Object3D obj : listUI) |
---|
| 1686 | + for (int i=listUI.size(); --i>=0;) |
---|
| 1687 | + { |
---|
| 1688 | + Object3D obj = listUI.elementAt(i); |
---|
| 1689 | + if (!obj.pinned) |
---|
| 1690 | + { |
---|
| 1691 | + obj.CloseUI(); |
---|
| 1692 | + listUI.remove(i); |
---|
| 1693 | + } |
---|
| 1694 | + } |
---|
| 1695 | + } |
---|
1458 | 1696 | |
---|
1459 | 1697 | /** |
---|
1460 | 1698 | * applyExample |
---|
.. | .. |
---|
1699 | 1937 | { |
---|
1700 | 1938 | ScreenFit(); |
---|
1701 | 1939 | } else |
---|
1702 | | - if (source == switchItem) |
---|
| 1940 | + if (source == switchViewItem) |
---|
1703 | 1941 | { |
---|
1704 | 1942 | cVector v1 = new cVector(); |
---|
1705 | 1943 | cVector v2 = new cVector(); |
---|
.. | .. |
---|
1708 | 1946 | objEditor.cameraView.renderCamera.setAim(v2, v1); |
---|
1709 | 1947 | objEditor.cameraView.repaint(); |
---|
1710 | 1948 | } else |
---|
1711 | | - if (source == rectoidItem) |
---|
| 1949 | + if (source == rectoidItem || source == boxButton) |
---|
1712 | 1950 | { |
---|
1713 | 1951 | makeSomething(new Box()); |
---|
1714 | 1952 | } else |
---|
1715 | | - if (source == particleItem) |
---|
| 1953 | + if (source == particleItem || source == particlesButton) |
---|
1716 | 1954 | { |
---|
1717 | 1955 | ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType); |
---|
1718 | 1956 | ParticleController particleController = new ParticleController(particleGeom); |
---|
.. | .. |
---|
1791 | 2029 | |
---|
1792 | 2030 | makeSomething(obj); |
---|
1793 | 2031 | } else |
---|
1794 | | - if (source == gridItem) |
---|
| 2032 | + if (source == gridItem || source == gridButton) |
---|
1795 | 2033 | { |
---|
1796 | 2034 | makeSomething(new Grid()); |
---|
1797 | 2035 | } else |
---|
1798 | | - if (source == ellipsoidItem) |
---|
| 2036 | + if (source == ellipsoidItem || source == sphereButton) |
---|
1799 | 2037 | { |
---|
1800 | 2038 | makeSomething(new Sphere()); |
---|
1801 | 2039 | } else |
---|
1802 | | - if (source == coneItem) |
---|
| 2040 | + if (source == coneItem || source == coneButton) |
---|
1803 | 2041 | { |
---|
1804 | 2042 | makeSomething(new Cone()); |
---|
1805 | 2043 | } else |
---|
1806 | | - if (source == torusItem) |
---|
| 2044 | + if (source == torusItem || source == torusButton) |
---|
1807 | 2045 | { |
---|
1808 | 2046 | makeSomething(new Torus()); |
---|
1809 | 2047 | } else |
---|
1810 | | - if (source == superItem) |
---|
| 2048 | + if (source == superItem || source == superButton) |
---|
1811 | 2049 | { |
---|
1812 | 2050 | makeSomething(new Superellipsoid()); |
---|
1813 | 2051 | } else |
---|
1814 | | - if (source == kleinItem) |
---|
| 2052 | + if (source == kleinItem || source == kleinButton) |
---|
1815 | 2053 | { |
---|
1816 | 2054 | makeSomething(new Klein()); |
---|
1817 | 2055 | } else |
---|
.. | .. |
---|
1831 | 2069 | { |
---|
1832 | 2070 | makeSomething(new BezierSurface()); |
---|
1833 | 2071 | } else |
---|
1834 | | - if (source == overlayItem) |
---|
| 2072 | + if (source == overlayItem || source == overlayButton) |
---|
1835 | 2073 | { |
---|
1836 | 2074 | /* |
---|
1837 | 2075 | Object3D obj = new BezierSurface(5,8); |
---|
.. | .. |
---|
1879 | 2117 | s.setup(); |
---|
1880 | 2118 | makeSomething(s); |
---|
1881 | 2119 | } else |
---|
1882 | | - if (source == lightItem) |
---|
| 2120 | + if (source == lightItem || source == lightButton) |
---|
1883 | 2121 | { |
---|
1884 | 2122 | makeSomething(new Light()); |
---|
1885 | 2123 | } else |
---|
.. | .. |
---|
1929 | 2167 | |
---|
1930 | 2168 | group(g); |
---|
1931 | 2169 | } else |
---|
1932 | | - if (source == loopItem) |
---|
| 2170 | + if (source == loopItem || source == loopButton) |
---|
1933 | 2171 | { |
---|
1934 | 2172 | Composite csg = new GroupLeaf(); |
---|
1935 | 2173 | csg.count = 5; |
---|
1936 | 2174 | group(csg); |
---|
1937 | | - Composite child = new cGroup(); |
---|
| 2175 | + Composite child = new cGroup("Branch"); |
---|
1938 | 2176 | csg.addChild(child); |
---|
1939 | 2177 | child.addChild(csg); |
---|
1940 | 2178 | } else |
---|
1941 | 2179 | if (source == doubleItem) |
---|
1942 | 2180 | { |
---|
1943 | | - Composite csg = new GroupLeaf(); |
---|
| 2181 | + Composite csg = new GroupLeaf("Fork"); |
---|
1944 | 2182 | csg.count = 5; |
---|
1945 | 2183 | group(csg); |
---|
1946 | | - Composite child = new cGroup(); |
---|
| 2184 | + Composite child = new cGroup("Branch A"); |
---|
1947 | 2185 | csg.addChild(child); |
---|
1948 | 2186 | child.addChild(csg); |
---|
1949 | | - child = new cGroup(); |
---|
| 2187 | + child = new cGroup("Branch B"); |
---|
1950 | 2188 | csg.addChild(child); |
---|
1951 | 2189 | child.addChild(csg); |
---|
1952 | 2190 | } else |
---|
1953 | 2191 | if (source == tripleItem) |
---|
1954 | 2192 | { |
---|
1955 | | - Composite csg = new GroupLeaf(); |
---|
| 2193 | + Composite csg = new GroupLeaf("Trident"); |
---|
1956 | 2194 | csg.count = 4; |
---|
1957 | 2195 | group(csg); |
---|
1958 | 2196 | Composite child = new cGroup(); |
---|
.. | .. |
---|
2016 | 2254 | } else |
---|
2017 | 2255 | if (source == undoButton) |
---|
2018 | 2256 | { |
---|
| 2257 | + // Go to previous version |
---|
| 2258 | + //if (!Undo()) |
---|
| 2259 | + //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2019 | 2260 | Undo(); |
---|
| 2261 | + } else |
---|
| 2262 | + if (source == restoreButton) |
---|
| 2263 | + { |
---|
| 2264 | + // Restore current version |
---|
| 2265 | + Restore(); |
---|
| 2266 | + } else |
---|
| 2267 | + if (source == replaceButton) |
---|
| 2268 | + { |
---|
| 2269 | + // Overwrite current version |
---|
| 2270 | + Replace(); |
---|
2020 | 2271 | } else |
---|
2021 | 2272 | if (source == redoButton) |
---|
2022 | 2273 | { |
---|
| 2274 | + // Go to next version |
---|
2023 | 2275 | Redo(); |
---|
2024 | 2276 | } else |
---|
2025 | 2277 | if (source == saveButton) |
---|
2026 | 2278 | { |
---|
2027 | | - Save(); |
---|
| 2279 | + // Save a new version |
---|
| 2280 | + if (!Save(true)) |
---|
| 2281 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2028 | 2282 | } else |
---|
2029 | 2283 | if (source == oneStepButton) |
---|
2030 | 2284 | { |
---|
.. | .. |
---|
2033 | 2287 | } else |
---|
2034 | 2288 | if (source == screenfitButton) |
---|
2035 | 2289 | { |
---|
2036 | | - //Reload(lastConverter, lastFilename, true); |
---|
2037 | 2290 | ScreenFit(); |
---|
2038 | 2291 | } else |
---|
2039 | 2292 | if (source == screenfitpointButton) |
---|
2040 | 2293 | { |
---|
2041 | | - //Reload(lastConverter, lastFilename, true); |
---|
2042 | 2294 | ScreenFitPoint(); |
---|
2043 | 2295 | } else |
---|
2044 | 2296 | if (source == snapobjectButton) |
---|
2045 | 2297 | { |
---|
2046 | | - //Reload(lastConverter, lastFilename, true); |
---|
2047 | 2298 | SnapObject(); |
---|
2048 | 2299 | } else |
---|
2049 | 2300 | // if (event.getSource() == recompileButton) |
---|
.. | .. |
---|
2419 | 2670 | { |
---|
2420 | 2671 | ClearSelection(true); |
---|
2421 | 2672 | } else |
---|
2422 | | - if (source == grabItem) |
---|
| 2673 | + if (source == grabItem || source == groupButton) |
---|
2423 | 2674 | { |
---|
2424 | | - group(new cGroup(), true); |
---|
| 2675 | + group(new cGroup(), false); // true); |
---|
2425 | 2676 | } else |
---|
2426 | 2677 | if (source == hideItem) |
---|
2427 | 2678 | { |
---|
.. | .. |
---|
2439 | 2690 | { |
---|
2440 | 2691 | makeSomething(new Camera()); |
---|
2441 | 2692 | } else |
---|
2442 | | - if (source == compositeItem) |
---|
| 2693 | + if (source == compositeItem || source == compositeButton) |
---|
2443 | 2694 | { |
---|
2444 | 2695 | group(new Composite()); |
---|
2445 | 2696 | } else |
---|
2446 | | - if (source == randomItem) |
---|
| 2697 | + if (source == switchItem || source == switchButton) |
---|
2447 | 2698 | { |
---|
2448 | 2699 | RandomNode random = new RandomNode(); |
---|
2449 | 2700 | group(random); |
---|
.. | .. |
---|
2545 | 2796 | { |
---|
2546 | 2797 | group(new cLinker()); |
---|
2547 | 2798 | } else |
---|
2548 | | - if (source == textureItem) |
---|
| 2799 | + if (source == textureItem || source == textureButton) |
---|
2549 | 2800 | { |
---|
2550 | 2801 | group(new TextureNode()); |
---|
2551 | 2802 | } else |
---|
.. | .. |
---|
2565 | 2816 | { |
---|
2566 | 2817 | CastShadow(2); |
---|
2567 | 2818 | } else |
---|
2568 | | - if (source == ungroupItem) |
---|
| 2819 | + if (source == ungroupItem || source == ungroupButton) |
---|
2569 | 2820 | { |
---|
2570 | | - //ungroup(); |
---|
| 2821 | + boolean hasRoot = false; |
---|
| 2822 | + |
---|
2571 | 2823 | for (int i=0; i<group.selection.size(); i++) |
---|
2572 | 2824 | { |
---|
2573 | | - Ungroup(group.selection.get(i)); |
---|
| 2825 | + if (group.selection.get(i) == group) |
---|
| 2826 | + { |
---|
| 2827 | + hasRoot = true; |
---|
| 2828 | + break; |
---|
| 2829 | + } |
---|
2574 | 2830 | } |
---|
2575 | 2831 | |
---|
2576 | | - ClearSelection(false); |
---|
2577 | | - |
---|
2578 | | - refreshContents(); |
---|
| 2832 | + if (!hasRoot) |
---|
| 2833 | + { |
---|
| 2834 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 2835 | + { |
---|
| 2836 | + Ungroup(group.selection.get(i)); |
---|
| 2837 | + } |
---|
| 2838 | + |
---|
| 2839 | + ClearSelection(false); |
---|
| 2840 | + |
---|
| 2841 | + refreshContents(); |
---|
| 2842 | + } |
---|
2579 | 2843 | } else |
---|
2580 | 2844 | if (source == genUVItem) |
---|
2581 | 2845 | { |
---|
.. | .. |
---|
2903 | 3167 | if (source == twoButton) |
---|
2904 | 3168 | { |
---|
2905 | 3169 | radio.layout = twoButton; |
---|
| 3170 | + |
---|
| 3171 | + if (CameraPane.FULLSCREEN) |
---|
| 3172 | + fullscreenLayout = radio.layout; |
---|
| 3173 | + |
---|
2906 | 3174 | // bug |
---|
2907 | 3175 | //gridPanel.setDividerLocation(1.0); |
---|
2908 | 3176 | //bigPanel.setDividerLocation(0.0); |
---|
.. | .. |
---|
2958 | 3226 | { |
---|
2959 | 3227 | radio.layout = threeButton; |
---|
2960 | 3228 | |
---|
| 3229 | + if (CameraPane.FULLSCREEN) |
---|
| 3230 | + fullscreenLayout = radio.layout; |
---|
| 3231 | + |
---|
2961 | 3232 | // bigThree.remove(scenePanel); |
---|
2962 | 3233 | // bigThree.remove(centralPanel); |
---|
2963 | 3234 | // bigThree.remove(XYZPanel); |
---|
.. | .. |
---|
2996 | 3267 | { |
---|
2997 | 3268 | radio.layout = fourButton; |
---|
2998 | 3269 | |
---|
| 3270 | + if (CameraPane.FULLSCREEN) |
---|
| 3271 | + fullscreenLayout = radio.layout; |
---|
| 3272 | + |
---|
2999 | 3273 | // bigThree.remove(scenePanel); |
---|
3000 | 3274 | // bigThree.remove(centralPanel); |
---|
3001 | 3275 | // bigThree.remove(XYZPanel); |
---|
.. | .. |
---|
3032 | 3306 | if (source == sixButton) |
---|
3033 | 3307 | { |
---|
3034 | 3308 | radio.layout = sixButton; |
---|
| 3309 | + |
---|
| 3310 | + if (CameraPane.FULLSCREEN) |
---|
| 3311 | + fullscreenLayout = radio.layout; |
---|
3035 | 3312 | |
---|
3036 | 3313 | // bigThree.remove(scenePanel); |
---|
3037 | 3314 | // bigThree.remove(centralPanel); |
---|
.. | .. |
---|
3070 | 3347 | if (source == sevenButton) |
---|
3071 | 3348 | { |
---|
3072 | 3349 | radio.layout = sevenButton; |
---|
| 3350 | + |
---|
| 3351 | + if (CameraPane.FULLSCREEN) |
---|
| 3352 | + fullscreenLayout = radio.layout; |
---|
3073 | 3353 | |
---|
3074 | 3354 | // bigThree.remove(scenePanel); |
---|
3075 | 3355 | // bigThree.remove(centralPanel); |
---|
.. | .. |
---|
3126 | 3406 | for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
3127 | 3407 | { |
---|
3128 | 3408 | ab = (cRadio)e.nextElement(); |
---|
3129 | | - if(ab.getModel().isSelected() && ab.GetObject() != client) |
---|
| 3409 | + if (ab.getModel().isSelected() && ab.GetObject() != client) |
---|
3130 | 3410 | { |
---|
| 3411 | + // Patch to avoid bug with transparency. |
---|
| 3412 | + if (!ab.hadMaterial) |
---|
| 3413 | + { |
---|
| 3414 | + ab.object.material = null; |
---|
| 3415 | + } |
---|
| 3416 | + |
---|
3131 | 3417 | buttonGroup.remove(ab); |
---|
3132 | 3418 | radioPanel.remove(ab); |
---|
3133 | 3419 | |
---|
3134 | | - ab.GetObject().editWindow = null; |
---|
| 3420 | + //ab.GetObject().editWindow = null; |
---|
| 3421 | + ab.GetObject().manipWindow = null; |
---|
3135 | 3422 | // ab.GetObject().objectUI = null; // ????????? |
---|
3136 | 3423 | |
---|
3137 | 3424 | ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick(); |
---|
.. | .. |
---|
3144 | 3431 | } else |
---|
3145 | 3432 | if (source == editItem || source == editButton) |
---|
3146 | 3433 | { |
---|
| 3434 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 3435 | + { |
---|
| 3436 | + Object3D child = (Object3D)e.nextElement(); |
---|
| 3437 | + child.pinned = true; |
---|
| 3438 | + } |
---|
| 3439 | + |
---|
3147 | 3440 | EditSelection(false); |
---|
3148 | 3441 | } else |
---|
3149 | 3442 | if (source == uneditButton) |
---|
.. | .. |
---|
3153 | 3446 | Object3D child = (Object3D)e.nextElement(); |
---|
3154 | 3447 | if(child.editWindow != null) |
---|
3155 | 3448 | objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
| 3449 | + child.pinned = false; |
---|
3156 | 3450 | child.CloseUI(); |
---|
3157 | 3451 | listUI.remove(child); |
---|
3158 | 3452 | |
---|
.. | .. |
---|
3169 | 3463 | //copy.ClearUI(); |
---|
3170 | 3464 | for (Object3D obj : listUI) |
---|
3171 | 3465 | { |
---|
| 3466 | + obj.pinned = false; |
---|
3172 | 3467 | obj.CloseUI(); |
---|
3173 | 3468 | } |
---|
3174 | 3469 | listUI.clear(); |
---|
.. | .. |
---|
3178 | 3473 | { |
---|
3179 | 3474 | assert(copy == group); |
---|
3180 | 3475 | |
---|
3181 | | - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
| 3476 | + //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3182 | 3477 | |
---|
3183 | 3478 | for (Object3D obj : listUI) |
---|
3184 | 3479 | { |
---|
.. | .. |
---|
3227 | 3522 | } |
---|
3228 | 3523 | |
---|
3229 | 3524 | copy = group; |
---|
| 3525 | + |
---|
| 3526 | + SetUndoStates(); |
---|
| 3527 | + |
---|
3230 | 3528 | //Globals.theRenderer.object = group; |
---|
3231 | 3529 | if(!useclient) |
---|
3232 | 3530 | { |
---|
.. | .. |
---|
3245 | 3543 | |
---|
3246 | 3544 | // fix "+" issue |
---|
3247 | 3545 | //group.editWindow = this; |
---|
| 3546 | + group.manipWindow = this; |
---|
3248 | 3547 | |
---|
3249 | 3548 | /* |
---|
3250 | 3549 | currentLayout = radio.layout; |
---|
.. | .. |
---|
3252 | 3551 | currentLayout = sevenButton; |
---|
3253 | 3552 | */ |
---|
3254 | 3553 | radio.layout.doClick(); |
---|
| 3554 | + |
---|
| 3555 | + ClearUnpinned(); |
---|
| 3556 | + Grafreed.Assert(group != null); |
---|
| 3557 | + Grafreed.Assert(group.selection != null); |
---|
| 3558 | + SetPinStates(group.selection.size() > 0); |
---|
| 3559 | + if (group.selection.size() == 1) |
---|
| 3560 | + EditSelection(false); |
---|
3255 | 3561 | keepparent = group.parent; |
---|
3256 | 3562 | // PARENT = NULL or not??? |
---|
3257 | 3563 | //group.parent = null; // ROOT |
---|
.. | .. |
---|
3265 | 3571 | cameraView.ProtectCamera(); |
---|
3266 | 3572 | cameraView.repaint(); |
---|
3267 | 3573 | return; |
---|
3268 | | - } else if (event.getSource() == revertCameraItem) |
---|
| 3574 | + } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton) |
---|
3269 | 3575 | { |
---|
3270 | 3576 | cameraView.RevertCamera(); |
---|
3271 | 3577 | cameraView.repaint(); |
---|
.. | .. |
---|
4319 | 4625 | // } |
---|
4320 | 4626 | // } |
---|
4321 | 4627 | |
---|
4322 | | - static boolean allparams = true; |
---|
4323 | | - |
---|
4324 | | - static Vector<Object3D> listUI = new Vector<Object3D>(); |
---|
4325 | | - |
---|
4326 | 4628 | void EditSelection(boolean newWindow) |
---|
4327 | 4629 | { |
---|
4328 | 4630 | // aConstraints.gridy = 0; |
---|
.. | .. |
---|
4330 | 4632 | { |
---|
4331 | 4633 | //System.out.println("edit : " + objectPanel.indexOfTab("Material")); |
---|
4332 | 4634 | //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false); |
---|
4333 | | - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
| 4635 | + //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
4334 | 4636 | |
---|
4335 | 4637 | Object3D elem = (Object3D)group.selection.elementAt(i); |
---|
4336 | 4638 | if(elem != group || !newWindow) |
---|
.. | .. |
---|
4415 | 4717 | //new Exception().printStackTrace(); |
---|
4416 | 4718 | |
---|
4417 | 4719 | freezemodel = true; |
---|
4418 | | - |
---|
| 4720 | + ClearUnpinned(); |
---|
| 4721 | + |
---|
4419 | 4722 | /**/ |
---|
4420 | 4723 | //switch (event.id) |
---|
4421 | 4724 | { |
---|
.. | .. |
---|
4448 | 4751 | if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) |
---|
4449 | 4752 | // a camera |
---|
4450 | 4753 | { |
---|
4451 | | - if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) |
---|
| 4754 | + if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace |
---|
4452 | 4755 | { |
---|
4453 | 4756 | CameraPane.camerachangeframe = 0; // don't refuse it |
---|
4454 | 4757 | Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); |
---|
.. | .. |
---|
4457 | 4760 | // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera; |
---|
4458 | 4761 | } |
---|
4459 | 4762 | |
---|
| 4763 | + if (tps != null && tps.length == 1) |
---|
| 4764 | + { |
---|
| 4765 | + EditSelection(false); |
---|
| 4766 | + } |
---|
| 4767 | + |
---|
| 4768 | + SetPinStates(tps != null && tps.length > 0); |
---|
| 4769 | + |
---|
4460 | 4770 | refreshContents(); |
---|
4461 | 4771 | //return true; |
---|
4462 | 4772 | } |
---|
.. | .. |
---|
4466 | 4776 | freezemodel = false; |
---|
4467 | 4777 | } |
---|
4468 | 4778 | |
---|
| 4779 | + void SetPinStates(boolean enabled) |
---|
| 4780 | + { |
---|
| 4781 | + editButton.setEnabled(enabled); |
---|
| 4782 | + uneditButton.setEnabled(enabled); |
---|
| 4783 | + unselectButton.setEnabled(enabled); |
---|
| 4784 | + flashSelectionButton.setEnabled(enabled); |
---|
| 4785 | + } |
---|
| 4786 | + |
---|
4469 | 4787 | void refreshContents(boolean cp) |
---|
4470 | 4788 | { |
---|
4471 | | - if (!Globals.MOUSEDRAGGED) |
---|
| 4789 | + if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info")) |
---|
| 4790 | + if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
4472 | 4791 | { |
---|
4473 | 4792 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
4474 | 4793 | |
---|
.. | .. |
---|
4567 | 4886 | |
---|
4568 | 4887 | if (cut) |
---|
4569 | 4888 | { |
---|
4570 | | - Save(); |
---|
| 4889 | +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. |
---|
| 4890 | +// Save(); |
---|
4571 | 4891 | //int indices[] = jList.getSelectedIndices(); |
---|
4572 | 4892 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
4573 | 4893 | //jList.remove(indices[i]); |
---|
.. | .. |
---|
4670 | 4990 | |
---|
4671 | 4991 | void paste(boolean expand) |
---|
4672 | 4992 | { |
---|
| 4993 | + if (Globals.REPLACEONMAKE) |
---|
| 4994 | + Save(); |
---|
| 4995 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 4996 | + Globals.REPLACEONMAKE = false; |
---|
4673 | 4997 | // if (GrafreeD.clipboard == null) |
---|
4674 | 4998 | // return; |
---|
4675 | 4999 | boolean first = true; |
---|
.. | .. |
---|
4729 | 5053 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
4730 | 5054 | } |
---|
4731 | 5055 | |
---|
| 5056 | + Globals.REPLACEONMAKE = keep; |
---|
4732 | 5057 | ResetModel(); |
---|
4733 | 5058 | refreshContents(); |
---|
4734 | 5059 | } |
---|
.. | .. |
---|
4864 | 5189 | |
---|
4865 | 5190 | void group(Object3D csg, boolean grab) |
---|
4866 | 5191 | { |
---|
| 5192 | + if (Globals.REPLACEONMAKE) |
---|
| 5193 | + Save(); |
---|
| 5194 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5195 | + Globals.REPLACEONMAKE = false; |
---|
4867 | 5196 | if (//false) // why?? |
---|
4868 | 5197 | !group.selection.isEmpty()) |
---|
4869 | 5198 | { |
---|
.. | .. |
---|
4977 | 5306 | //node.add(csg); |
---|
4978 | 5307 | //makeSomething(node); |
---|
4979 | 5308 | makeSomething(csg); |
---|
| 5309 | + Globals.REPLACEONMAKE = keep; |
---|
4980 | 5310 | } |
---|
4981 | 5311 | |
---|
4982 | 5312 | void Ungroup(Object3D g) |
---|
4983 | 5313 | { |
---|
| 5314 | + if (Globals.REPLACEONMAKE) |
---|
| 5315 | + Save(); |
---|
| 5316 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5317 | + Globals.REPLACEONMAKE = false; |
---|
4984 | 5318 | if (g instanceof HiddenObject) |
---|
4985 | 5319 | { |
---|
4986 | 5320 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
4997 | 5331 | objEditor.makeSomething(g.get(i), false); |
---|
4998 | 5332 | } |
---|
4999 | 5333 | } |
---|
| 5334 | + Globals.REPLACEONMAKE = keep; |
---|
5000 | 5335 | } |
---|
5001 | 5336 | |
---|
5002 | 5337 | void ungroup() |
---|
.. | .. |
---|
5285 | 5620 | cButton clearpanelButton; |
---|
5286 | 5621 | cButton unselectButton; |
---|
5287 | 5622 | |
---|
5288 | | - cButton minButton; |
---|
5289 | | - cButton maxButton; |
---|
5290 | | - cButton fullButton; |
---|
5291 | | - cButton undoButton; |
---|
5292 | | - cButton redoButton; |
---|
| 5623 | + cButton restoreCameraButton; |
---|
| 5624 | + |
---|
5293 | 5625 | cButton saveButton; |
---|
5294 | 5626 | cButton oneStepButton; |
---|
| 5627 | + |
---|
| 5628 | + cButton groupButton; |
---|
| 5629 | + cButton ungroupButton; |
---|
| 5630 | + cButton compositeButton; |
---|
| 5631 | + cButton switchButton; |
---|
| 5632 | + cButton loopButton; |
---|
| 5633 | + cButton textureButton; |
---|
| 5634 | + |
---|
| 5635 | + cButton gridButton; |
---|
| 5636 | + cButton boxButton; |
---|
| 5637 | + cButton sphereButton; |
---|
| 5638 | + cButton coneButton; |
---|
| 5639 | + cButton torusButton; |
---|
| 5640 | + cButton superButton; |
---|
| 5641 | + cButton kleinButton; |
---|
| 5642 | + cButton particlesButton; |
---|
| 5643 | + cButton overlayButton; |
---|
| 5644 | + cButton lightButton; |
---|
5295 | 5645 | |
---|
5296 | 5646 | cButton screenfitButton; |
---|
5297 | 5647 | cButton screenfitpointButton; |
---|
.. | .. |
---|
5313 | 5663 | //JTree jTree; |
---|
5314 | 5664 | private MenuItem lookAtItem; |
---|
5315 | 5665 | private MenuItem lookFromItem; |
---|
5316 | | - private MenuItem switchItem; |
---|
| 5666 | + private MenuItem switchViewItem; |
---|
5317 | 5667 | private MenuItem cutItem; |
---|
5318 | 5668 | private MenuItem undoItem; |
---|
5319 | 5669 | private MenuItem redoItem; |
---|
5320 | | - private MenuItem duplicateItem; |
---|
| 5670 | + private JMenuItem duplicateItem; |
---|
5321 | 5671 | private MenuItem cloneItem; |
---|
5322 | 5672 | private MenuItem cloneSupportItem; |
---|
5323 | 5673 | private MenuItem overwriteGeoItem; |
---|
.. | .. |
---|
5405 | 5755 | private MenuItem frontItem; |
---|
5406 | 5756 | private MenuItem cameraItem; |
---|
5407 | 5757 | private MenuItem compositeItem; |
---|
5408 | | - private MenuItem randomItem; |
---|
| 5758 | + private MenuItem switchItem; |
---|
5409 | 5759 | private MenuItem physicsItem; |
---|
5410 | 5760 | private MenuItem frameselectorItem; |
---|
5411 | 5761 | private MenuItem scriptNodeItem; |
---|
.. | .. |
---|
5479 | 5829 | |
---|
5480 | 5830 | Menu cameraMenu; |
---|
5481 | 5831 | MenuItem editCameraItem; |
---|
5482 | | - MenuItem revertCameraItem; |
---|
| 5832 | + MenuItem restoreCameraItem; |
---|
5483 | 5833 | } |
---|