Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +98,7 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.REPLACEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
....@@ -150,6 +155,8 @@
150155
151156 void SetupMenu2(GroupEditor oe)
152157 {
158
+ oe.jTree = new cTree();
159
+
153160 Menu menu;
154161 oe.menuBar.add(menu = new Menu("Edit"));
155162 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +167,7 @@
160167 // redoItem = menu.add(new MenuItem("Redo"));
161168 // redoItem.addActionListener(this);
162169 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164171 duplicateItem.addActionListener(this);
165172 cloneItem = menu.add(new MenuItem("Clone"));
166173 cloneItem.addActionListener(this);
....@@ -202,23 +209,23 @@
202209 //zBufferItem.addActionListener(this);
203210 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204211 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
207214
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212227
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"));
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222229 toggleHandleItem.addItemListener(this);
223230 toggleHandleItem.setState(CameraPane.HANDLES);
224231
....@@ -273,7 +280,7 @@
273280 {
274281 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275282 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277284 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278285 oe.cameraMenu.add("-");
279286 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +288,7 @@
281288 editLeafItem.addActionListener(this);
282289 lookAtItem.addActionListener(this);
283290 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
291
+ //switchViewItem.addActionListener(this);
285292 }
286293
287294 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +333,29 @@
326333 }
327334
328335 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
331338 backItem = menu.add(new MenuItem("Back"));
332339 backItem.addActionListener(this);
333340 frontItem = menu.add(new MenuItem("Front"));
334341 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
337347 hideItem = menu.add(new MenuItem("Hidden Group"));
338348 hideItem.addActionListener(this);
349
+ }
339350 ungroupItem = menu.add(new MenuItem("Ungroup"));
340351 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
344359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345360 switchGeoItem.addActionListener(this);
346361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +363,6 @@
348363 morphItem = menu.add(new MenuItem("Morph Group"));
349364 morphItem.addActionListener(this);
350365
351
- if (Globals.ADVANCED)
352
- {
353366 menu.add("-");
354367 physicsItem = menu.add(new MenuItem("Physics"));
355368 physicsItem.addActionListener(this);
....@@ -357,13 +370,11 @@
357370 frameselectorItem.addActionListener(this);
358371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359372 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362373 }
363374
364375 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
367378 billboardItem = menu.add(new MenuItem("Billboard"));
368379 billboardItem.addActionListener(this);
369380 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +385,14 @@
374385 shadowYItem.addActionListener(this);
375386 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
377391 if (Globals.ADVANCED)
378392 {
379393 menu.add("-");
380394 linkerItem = menu.add(new MenuItem("Linker"));
381395 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384396 templateItem = menu.add(new MenuItem("Template"));
385397 templateItem.addActionListener(this);
386398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -532,6 +544,7 @@
532544 buildToolsMenu(menu);
533545 }
534546
547
+
535548 void SetupUI2(ObjEditor oe)
536549 {
537550 // June 2019
....@@ -574,51 +587,79 @@
574587 oe.radioPanel.add(dummyButton);
575588 oe.buttonGroup.add(dummyButton);
576589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
577594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578595
579596 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580597 //minButton.setToolTipText("Minimize window");
581598 //minButton.addActionListener(this);
582599
583
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
586606
587607 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588608 fullButton.setToolTipText("Full-screen window");
589609 fullButton.addActionListener(this);
590610
591
- oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ screenfitButton.setToolTipText("Screen fit");
613
+ screenfitButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
594618
595
- oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
601621 saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
602627
603
- oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604647 liveCB.setToolTipText("Enable animation");
605648 liveCB.addItemListener(this);
606649
607
- oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
608
- fastCB.setToolTipText("Fast mode");
609
- fastCB.addItemListener(this);
610
-
611650 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612651 oneStepButton.setToolTipText("Animate one step forward");
613652 oneStepButton.addActionListener(this);
614653
615
- oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
655
+ fastCB.setToolTipText("Fast mode");
656
+ fastCB.addItemListener(this);
657
+
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
622663
623664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624665 // screenfitpointButton.addActionListener(this);
....@@ -630,15 +671,13 @@
630671 snapobjectButton.setToolTipText("Snap Object");
631672 }
632673
633
- oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Highlight selection");
635
- flashSelectionButton.addActionListener(this);
636
-
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638675
639676 oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640677 twoButton.setToolTipText("Show center view only");
641678 twoButton.addActionListener(this);
679
+ this.fullscreenLayout = twoButton;
680
+
642681 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643682 fourButton.addActionListener(this);
644683 fourButton.setToolTipText("Show left panel only");
....@@ -653,26 +692,105 @@
653692 sevenButton.addActionListener(this);
654693 //
655694
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657696 rootButton.setToolTipText("Edit selection in new tab");
658697 rootButton.addActionListener(this);
659698
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661700 closeButton.setToolTipText("Close tab");
662701 closeButton.addActionListener(this);
663702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664703 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
704
+
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
736
+
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
668786 editButton.addActionListener(this);
669787
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
672790 uneditButton.addActionListener(this);
673791
674792 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
793
+ allParamsButton.setToolTipText("Show all controle");
676794 allParamsButton.addActionListener(this);
677795
678796 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +801,13 @@
683801 unselectButton.setToolTipText("Unselect");
684802 unselectButton.addActionListener(this);
685803
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
807
+
686808 editCommandsPanel.preferredHeight = 1;
687809
810
+ SetPinStates(false);
688811 // oe.treePanel.add(commandsPanel);
689812 // oe.treePanel.Return();
690813
....@@ -703,29 +826,17 @@
703826
704827 JScrollPane jSP;
705828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707830 ResetModel();
708831
709832 oe.treePanel.add(jSPPanel);
710833 oe.treePanel.Return();
711834
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;
727835 oe.treePanel.add(copyOptionsPanel);
728836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
729840
730841 // mainPanel.setDividerLocation(0.5); //1.0);
731842 // mainPanel.setResizeWeight(0.5);
....@@ -754,23 +865,43 @@
754865
755866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756867 {
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
757882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758883 boxCB.setToolTipText("Display bounding boxes");
759884 boxCB.addItemListener(this);
760885
761886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
763888 zoomBoxCB.addItemListener(this);
764889
765890 if (true) // Globals.ADVANCED)
766891 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
770899
771900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772901 // localCB.addItemListener(this);
773902
903
+ panel.Return();
904
+
774905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775906 crowdCB.setToolTipText("Used for crowds");
776907 crowdCB.addItemListener(this);
....@@ -787,6 +918,8 @@
787918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788919 // speakerMocapCB.addItemListener(this);
789920
921
+ panel.Return();
922
+
790923 if (false)
791924 {
792925 // handled in scripts
....@@ -801,24 +934,39 @@
801934 //constraints.gridy += 1;
802935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
804938 }
805939
806940 //constraints.gridx += 1;
807941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808942 // debugCB.addItemListener(this);
809943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
810948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
949
+ oeilCB.setToolTipText("Move camera when tracking");
812950 oeilCB.addItemListener(this);
813951
814952 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
953
+ shadowCB.setToolTipText("When live compute shadows");
816954 shadowCB.addItemListener(this);
817955
818
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
- autosaveCB.setToolTipText("Auto-save on structure change");
820
- autosaveCB.addItemListener(this);
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
821968
969
+ panel.Return();
822970 if (Globals.ADVANCED)
823971 {
824972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -829,10 +977,15 @@
829977 }
830978
831979 cGridBag fill = new cGridBag();
832
-
833980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
834985
835986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
836989
837990 }
838991
....@@ -840,7 +993,7 @@
840993 {
841994 cRadio radioButton = new cRadio(obj.name);
842995
843
- // Patch to avoid bug with transparency.
996
+ // June 2019. Patch to avoid bug with transparency.
844997 radioButton.hadMaterial = obj.material != null;
845998 if (!radioButton.hadMaterial)
846999 {
....@@ -868,15 +1021,17 @@
8681021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8691022 }
8701023
871
- cCheckBox liveCB;
1024
+ cToggleButton liveCB;
8721025 cCheckBox supportCB;
8731026 cCheckBox localCB;
8741027 cCheckBox crowdCB;
8751028 cCheckBox smoothCB;
876
- cCheckBox fastCB;
1029
+ cToggleButton fastCB;
8771030 cCheckBox slowCB;
8781031 cCheckBox boxCB;
8791032 cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
8801035 cCheckBox trackCB;
8811036 cCheckBox smoothfocusCB;
8821037 // JCheckBox speakerMocapCB;
....@@ -886,7 +1041,7 @@
8861041
8871042 cCheckBox oeilCB;
8881043 cCheckBox shadowCB;
889
- cCheckBox autosaveCB;
1044
+ cCheckBox autokeepCB;
8901045 cCheckBox lookAtCB;
8911046
8921047 // static int COLOR = 1;
....@@ -994,9 +1149,13 @@
9941149 {
9951150 Globals.COMPUTESHADOWWHENLIVE ^= true;
9961151 }
997
- else if(e.getSource() == autosaveCB)
1152
+ else if(e.getSource() == freezeCB)
9981153 {
999
- Globals.SAVEONMAKE ^= true;
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
10001159 }
10011160 else if(e.getSource() == lookAtCB)
10021161 {
....@@ -1014,7 +1173,8 @@
10141173
10151174 /**/
10161175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1017
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
10181178 if ((path == null) || (path.getPathCount() <= 1)) {
10191179 // We can't move the root node or an empty selection
10201180 return;
....@@ -1077,8 +1237,6 @@
10771237 }
10781238 }
10791239
1080
- String string = (String) object;
1081
-
10821240 System.out.println("Transfer = " + object + "; drop : " + target);
10831241 // if( object instanceof java.io.File[])
10841242 // {
....@@ -1086,6 +1244,8 @@
10861244 // objEditor.DropFile((java.io.File[]) object, true);
10871245 // return;
10881246 // }
1247
+
1248
+ String string = object.toString();
10891249
10901250 // File path for Mac and Windows
10911251 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1131,23 +1291,33 @@
11311291
11321292 assert target == objEditor.jTree;
11331293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
11341295 try {
1135
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11361297 } catch (Exception e) {
11371298 System.out.println("destinationPath : " + destinationPath);
11381299 return;
11391300 }
11401301
1141
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
11421303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
11431313 loadClipboard(true);
11441314 objEditor.jTree.setSelectionPath(destinationPath);
11451315 pasteInto(false, false);
1146
- } else {
1147
- loadClipboard(false);
1148
- objEditor.jTree.setSelectionPath(destinationPath);
1149
- pasteInto(false, false); // true); // ???
1150
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
11511321 }
11521322 public void dropActionChanged(DropTargetDragEvent dtde)
11531323 // Called if the user has modified the current drop gesture
....@@ -1252,22 +1422,30 @@
12521422 {
12531423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12541424 //heightFieldItem.addActionListener(this);
1255
- gridItem = menu.add(new MenuItem("Grid"));
1256
- gridItem.addActionListener(this);
1257
- rectoidItem = menu.add(new MenuItem("Box"));
1258
- rectoidItem.addActionListener(this);
1259
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1260
- ellipsoidItem.addActionListener(this);
1261
- coneItem = menu.add(new MenuItem("Cone"));
1262
- coneItem.addActionListener(this);
1263
- torusItem = menu.add(new MenuItem("Torus"));
1264
- torusItem.addActionListener(this);
1265
- superItem = menu.add(new MenuItem("Superellipsoid"));
1266
- superItem.addActionListener(this);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
12671443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12681444 kleinItem.addActionListener(this);
1269
- particleItem = menu.add(new MenuItem("Particle system"));
1270
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
12711449 if (Globals.ADVANCED)
12721450 {
12731451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1293,15 +1471,15 @@
12931471 }
12941472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12951473 bezierItem.addActionListener(this);
1296
- overlayItem = menu.add(new MenuItem("Overlay"));
1297
- overlayItem.addActionListener(this);
1298
- lightItem = menu.add(new MenuItem("Light"));
1299
- lightItem.addActionListener(this);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
13001478 menu.add("-");
13011479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13021480 //superLoopItem.addActionListener(this);
1303
- loopItem = menu.add(new MenuItem("Loop"));
1304
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
13051483 doubleItem = menu.add(new MenuItem("Fork"));
13061484 doubleItem.addActionListener(this);
13071485 if (Globals.ADVANCED)
....@@ -1317,6 +1495,9 @@
13171495 animationItem.addItemListener(this);
13181496 animationItem.setState(Globals.ANIMATION);
13191497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
13201501 menu.add("-");
13211502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13221503 parseverticesItem.addActionListener(this);
....@@ -1329,6 +1510,8 @@
13291510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13301511 reduce34MorphItem.addActionListener(this);
13311512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
13321515 menu.add(computeAOItem = new MenuItem("Compute AO"));
13331516 computeAOItem.addActionListener(this);
13341517
....@@ -1337,8 +1520,6 @@
13371520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13381521 mirrorItem.addActionListener(this);
13391522 menu.add("-");
1340
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1341
- memoryItem.addActionListener(this);
13421523 menu.add(analyzeItem = new MenuItem("Analyze"));
13431524 analyzeItem.addActionListener(this);
13441525 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1486,6 +1667,20 @@
14861667
14871668 makeSomething(shadow);
14881669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
14891684
14901685 /**
14911686 * applyExample
....@@ -1730,7 +1925,7 @@
17301925 {
17311926 ScreenFit();
17321927 } else
1733
- if (source == switchItem)
1928
+ if (source == switchViewItem)
17341929 {
17351930 cVector v1 = new cVector();
17361931 cVector v2 = new cVector();
....@@ -1739,11 +1934,11 @@
17391934 objEditor.cameraView.renderCamera.setAim(v2, v1);
17401935 objEditor.cameraView.repaint();
17411936 } else
1742
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
17431938 {
17441939 makeSomething(new Box());
17451940 } else
1746
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
17471942 {
17481943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17491944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1822,27 +2017,27 @@
18222017
18232018 makeSomething(obj);
18242019 } else
1825
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
18262021 {
18272022 makeSomething(new Grid());
18282023 } else
1829
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
18302025 {
18312026 makeSomething(new Sphere());
18322027 } else
1833
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
18342029 {
18352030 makeSomething(new Cone());
18362031 } else
1837
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
18382033 {
18392034 makeSomething(new Torus());
18402035 } else
1841
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
18422037 {
18432038 makeSomething(new Superellipsoid());
18442039 } else
1845
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
18462041 {
18472042 makeSomething(new Klein());
18482043 } else
....@@ -1862,7 +2057,7 @@
18622057 {
18632058 makeSomething(new BezierSurface());
18642059 } else
1865
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
18662061 {
18672062 /*
18682063 Object3D obj = new BezierSurface(5,8);
....@@ -1910,7 +2105,7 @@
19102105 s.setup();
19112106 makeSomething(s);
19122107 } else
1913
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
19142109 {
19152110 makeSomething(new Light());
19162111 } else
....@@ -1960,30 +2155,30 @@
19602155
19612156 group(g);
19622157 } else
1963
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
19642159 {
19652160 Composite csg = new GroupLeaf();
19662161 csg.count = 5;
19672162 group(csg);
1968
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
19692164 csg.addChild(child);
19702165 child.addChild(csg);
19712166 } else
19722167 if (source == doubleItem)
19732168 {
1974
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
19752170 csg.count = 5;
19762171 group(csg);
1977
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
19782173 csg.addChild(child);
19792174 child.addChild(csg);
1980
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
19812176 csg.addChild(child);
19822177 child.addChild(csg);
19832178 } else
19842179 if (source == tripleItem)
19852180 {
1986
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
19872182 csg.count = 4;
19882183 group(csg);
19892184 Composite child = new cGroup();
....@@ -2047,15 +2242,31 @@
20472242 } else
20482243 if (source == undoButton)
20492244 {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20502248 Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
20512259 } else
20522260 if (source == redoButton)
20532261 {
2262
+ // Go to next version
20542263 Redo();
20552264 } else
20562265 if (source == saveButton)
20572266 {
2058
- Save();
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
20592270 } else
20602271 if (source == oneStepButton)
20612272 {
....@@ -2064,17 +2275,14 @@
20642275 } else
20652276 if (source == screenfitButton)
20662277 {
2067
- //Reload(lastConverter, lastFilename, true);
20682278 ScreenFit();
20692279 } else
20702280 if (source == screenfitpointButton)
20712281 {
2072
- //Reload(lastConverter, lastFilename, true);
20732282 ScreenFitPoint();
20742283 } else
20752284 if (source == snapobjectButton)
20762285 {
2077
- //Reload(lastConverter, lastFilename, true);
20782286 SnapObject();
20792287 } else
20802288 // if (event.getSource() == recompileButton)
....@@ -2450,9 +2658,9 @@
24502658 {
24512659 ClearSelection(true);
24522660 } else
2453
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
24542662 {
2455
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
24562664 } else
24572665 if (source == hideItem)
24582666 {
....@@ -2470,11 +2678,11 @@
24702678 {
24712679 makeSomething(new Camera());
24722680 } else
2473
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
24742682 {
24752683 group(new Composite());
24762684 } else
2477
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
24782686 {
24792687 RandomNode random = new RandomNode();
24802688 group(random);
....@@ -2576,7 +2784,7 @@
25762784 {
25772785 group(new cLinker());
25782786 } else
2579
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
25802788 {
25812789 group(new TextureNode());
25822790 } else
....@@ -2596,17 +2804,30 @@
25962804 {
25972805 CastShadow(2);
25982806 } else
2599
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
26002808 {
2601
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
26022811 for (int i=0; i<group.selection.size(); i++)
26032812 {
2604
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
26052818 }
26062819
2607
- ClearSelection(false);
2608
-
2609
- refreshContents();
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
26102831 } else
26112832 if (source == genUVItem)
26122833 {
....@@ -2934,6 +3155,10 @@
29343155 if (source == twoButton)
29353156 {
29363157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
29373162 // bug
29383163 //gridPanel.setDividerLocation(1.0);
29393164 //bigPanel.setDividerLocation(0.0);
....@@ -2989,6 +3214,9 @@
29893214 {
29903215 radio.layout = threeButton;
29913216
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
3219
+
29923220 // bigThree.remove(scenePanel);
29933221 // bigThree.remove(centralPanel);
29943222 // bigThree.remove(XYZPanel);
....@@ -3027,6 +3255,9 @@
30273255 {
30283256 radio.layout = fourButton;
30293257
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
3260
+
30303261 // bigThree.remove(scenePanel);
30313262 // bigThree.remove(centralPanel);
30323263 // bigThree.remove(XYZPanel);
....@@ -3063,6 +3294,9 @@
30633294 if (source == sixButton)
30643295 {
30653296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
30663300
30673301 // bigThree.remove(scenePanel);
30683302 // bigThree.remove(centralPanel);
....@@ -3101,6 +3335,9 @@
31013335 if (source == sevenButton)
31023336 {
31033337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
31043341
31053342 // bigThree.remove(scenePanel);
31063343 // bigThree.remove(centralPanel);
....@@ -3182,6 +3419,12 @@
31823419 } else
31833420 if (source == editItem || source == editButton)
31843421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
31853428 EditSelection(false);
31863429 } else
31873430 if (source == uneditButton)
....@@ -3191,6 +3434,7 @@
31913434 Object3D child = (Object3D)e.nextElement();
31923435 if(child.editWindow != null)
31933436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
31943438 child.CloseUI();
31953439 listUI.remove(child);
31963440
....@@ -3207,6 +3451,7 @@
32073451 //copy.ClearUI();
32083452 for (Object3D obj : listUI)
32093453 {
3454
+ obj.pinned = false;
32103455 obj.CloseUI();
32113456 }
32123457 listUI.clear();
....@@ -3216,7 +3461,7 @@
32163461 {
32173462 assert(copy == group);
32183463
3219
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32203465
32213466 for (Object3D obj : listUI)
32223467 {
....@@ -3265,6 +3510,9 @@
32653510 }
32663511
32673512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
32683516 //Globals.theRenderer.object = group;
32693517 if(!useclient)
32703518 {
....@@ -3291,6 +3539,11 @@
32913539 currentLayout = sevenButton;
32923540 */
32933541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
32943547 keepparent = group.parent;
32953548 // PARENT = NULL or not???
32963549 //group.parent = null; // ROOT
....@@ -3304,7 +3557,7 @@
33043557 cameraView.ProtectCamera();
33053558 cameraView.repaint();
33063559 return;
3307
- } else if (event.getSource() == revertCameraItem)
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33083561 {
33093562 cameraView.RevertCamera();
33103563 cameraView.repaint();
....@@ -4358,10 +4611,6 @@
43584611 // }
43594612 // }
43604613
4361
- static boolean allparams = true;
4362
-
4363
- static Vector<Object3D> listUI = new Vector<Object3D>();
4364
-
43654614 void EditSelection(boolean newWindow)
43664615 {
43674616 // aConstraints.gridy = 0;
....@@ -4369,7 +4618,7 @@
43694618 {
43704619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43714620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4372
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43734622
43744623 Object3D elem = (Object3D)group.selection.elementAt(i);
43754624 if(elem != group || !newWindow)
....@@ -4454,7 +4703,8 @@
44544703 //new Exception().printStackTrace();
44554704
44564705 freezemodel = true;
4457
-
4706
+ ClearUnpinned();
4707
+
44584708 /**/
44594709 //switch (event.id)
44604710 {
....@@ -4487,7 +4737,7 @@
44874737 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44884738 // a camera
44894739 {
4490
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44914741 {
44924742 CameraPane.camerachangeframe = 0; // don't refuse it
44934743 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4496,6 +4746,13 @@
44964746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44974747 }
44984748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
44994756 refreshContents();
45004757 //return true;
45014758 }
....@@ -4505,9 +4762,18 @@
45054762 freezemodel = false;
45064763 }
45074764
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
45084773 void refreshContents(boolean cp)
45094774 {
4510
- if (!Globals.MOUSEDRAGGED)
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45114777 {
45124778 objEditor.ClearInfo(); // .GetMaterial());
45134779
....@@ -4606,8 +4872,8 @@
46064872
46074873 if (cut)
46084874 {
4609
- if (Globals.SAVEONMAKE)
4610
- Save();
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
46114877 //int indices[] = jList.getSelectedIndices();
46124878 //for (int i = indices.length - 1; i >= 0; i--)
46134879 //jList.remove(indices[i]);
....@@ -4710,6 +4976,10 @@
47104976
47114977 void paste(boolean expand)
47124978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
47134983 // if (GrafreeD.clipboard == null)
47144984 // return;
47154985 boolean first = true;
....@@ -4769,6 +5039,7 @@
47695039 Grafreed.clipboard.get(0).parent = keepparent;
47705040 }
47715041
5042
+ Globals.REPLACEONMAKE = keep;
47725043 ResetModel();
47735044 refreshContents();
47745045 }
....@@ -4904,6 +5175,10 @@
49045175
49055176 void group(Object3D csg, boolean grab)
49065177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
49075182 if (//false) // why??
49085183 !group.selection.isEmpty())
49095184 {
....@@ -5017,10 +5292,15 @@
50175292 //node.add(csg);
50185293 //makeSomething(node);
50195294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
50205296 }
50215297
50225298 void Ungroup(Object3D g)
50235299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
50245304 if (g instanceof HiddenObject)
50255305 {
50265306 HiddenObject h = (HiddenObject) g;
....@@ -5037,6 +5317,7 @@
50375317 objEditor.makeSomething(g.get(i), false);
50385318 }
50395319 }
5320
+ Globals.REPLACEONMAKE = keep;
50405321 }
50415322
50425323 void ungroup()
....@@ -5325,13 +5606,28 @@
53255606 cButton clearpanelButton;
53265607 cButton unselectButton;
53275608
5328
- cButton minButton;
5329
- cButton maxButton;
5330
- cButton fullButton;
5331
- cButton undoButton;
5332
- cButton redoButton;
5609
+ cButton restoreCameraButton;
5610
+
53335611 cButton saveButton;
53345612 cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
53355631
53365632 cButton screenfitButton;
53375633 cButton screenfitpointButton;
....@@ -5353,11 +5649,11 @@
53535649 //JTree jTree;
53545650 private MenuItem lookAtItem;
53555651 private MenuItem lookFromItem;
5356
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
53575653 private MenuItem cutItem;
53585654 private MenuItem undoItem;
53595655 private MenuItem redoItem;
5360
- private MenuItem duplicateItem;
5656
+ private JMenuItem duplicateItem;
53615657 private MenuItem cloneItem;
53625658 private MenuItem cloneSupportItem;
53635659 private MenuItem overwriteGeoItem;
....@@ -5445,7 +5741,7 @@
54455741 private MenuItem frontItem;
54465742 private MenuItem cameraItem;
54475743 private MenuItem compositeItem;
5448
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
54495745 private MenuItem physicsItem;
54505746 private MenuItem frameselectorItem;
54515747 private MenuItem scriptNodeItem;
....@@ -5519,5 +5815,5 @@
55195815
55205816 Menu cameraMenu;
55215817 MenuItem editCameraItem;
5522
- MenuItem revertCameraItem;
5818
+ MenuItem restoreCameraItem;
55235819 }