Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
GroupEditor.java
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = 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.SAVEONMAKE = 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"));
....@@ -574,51 +586,66 @@
574586 oe.radioPanel.add(dummyButton);
575587 oe.buttonGroup.add(dummyButton);
576588 */
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
592
+
577593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578594
579595 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580596 //minButton.setToolTipText("Minimize window");
581597 //minButton.addActionListener(this);
582598
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
586605
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588607 fullButton.setToolTipText("Full-screen window");
589608 fullButton.addActionListener(this);
590609
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592619 undoButton.setToolTipText("Undo changes");
593620 undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
594622
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596624 redoButton.setToolTipText("Redo changes");
597625 redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
598627
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600629 saveButton.setToolTipText("Save changes");
601630 saveButton.addActionListener(this);
602631
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604633 liveCB.setToolTipText("Enable animation");
605634 liveCB.addItemListener(this);
606635
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608637 oneStepButton.setToolTipText("Animate one step forward");
609638 oneStepButton.addActionListener(this);
610639
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612641 fastCB.setToolTipText("Fast mode");
613642 fastCB.addItemListener(this);
614643
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);
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
622649
623650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624651 // screenfitpointButton.addActionListener(this);
....@@ -630,15 +657,13 @@
630657 snapobjectButton.setToolTipText("Snap Object");
631658 }
632659
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));
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638661
639662 oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640663 twoButton.setToolTipText("Show center view only");
641664 twoButton.addActionListener(this);
665
+ this.fullscreenLayout = twoButton;
666
+
642667 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643668 fourButton.addActionListener(this);
644669 fourButton.setToolTipText("Show left panel only");
....@@ -653,26 +678,105 @@
653678 sevenButton.addActionListener(this);
654679 //
655680
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657682 rootButton.setToolTipText("Edit selection in new tab");
658683 rootButton.addActionListener(this);
659684
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661686 closeButton.setToolTipText("Close tab");
662687 closeButton.addActionListener(this);
663688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664689 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
690
+
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
722
+
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
668772 editButton.addActionListener(this);
669773
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
672776 uneditButton.addActionListener(this);
673777
674778 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
779
+ allParamsButton.setToolTipText("Show all controle");
676780 allParamsButton.addActionListener(this);
677781
678782 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +787,13 @@
683787 unselectButton.setToolTipText("Unselect");
684788 unselectButton.addActionListener(this);
685789
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
793
+
686794 editCommandsPanel.preferredHeight = 1;
687795
796
+ SetPinStates(false);
688797 // oe.treePanel.add(commandsPanel);
689798 // oe.treePanel.Return();
690799
....@@ -703,27 +812,12 @@
703812
704813 JScrollPane jSP;
705814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707816 ResetModel();
708817
709818 oe.treePanel.add(jSPPanel);
710819 oe.treePanel.Return();
711820
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;
727821 oe.treePanel.add(copyOptionsPanel);
728822 oe.treePanel.Return();
729823
....@@ -754,23 +848,43 @@
754848
755849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756850 {
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
854
+
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
757865 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758866 boxCB.setToolTipText("Display bounding boxes");
759867 boxCB.addItemListener(this);
760868
761869 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
763871 zoomBoxCB.addItemListener(this);
764872
765873 if (true) // Globals.ADVANCED)
766874 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
770882
771883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772884 // localCB.addItemListener(this);
773885
886
+ panel.Return();
887
+
774888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775889 crowdCB.setToolTipText("Used for crowds");
776890 crowdCB.addItemListener(this);
....@@ -787,6 +901,8 @@
787901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788902 // speakerMocapCB.addItemListener(this);
789903
904
+ panel.Return();
905
+
790906 if (false)
791907 {
792908 // handled in scripts
....@@ -801,20 +917,39 @@
801917 //constraints.gridy += 1;
802918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
804921 }
805922
806923 //constraints.gridx += 1;
807924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808925 // debugCB.addItemListener(this);
809926
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
810931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
932
+ oeilCB.setToolTipText("Move camera when tracking");
812933 oeilCB.addItemListener(this);
813934
814935 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
936
+ shadowCB.setToolTipText("When live compute shadows");
816937 shadowCB.addItemListener(this);
817938
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
818953 if (Globals.ADVANCED)
819954 {
820955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -825,10 +960,15 @@
825960 }
826961
827962 cGridBag fill = new cGridBag();
828
-
829963 fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
830968
831969 panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
832972
833973 }
834974
....@@ -836,7 +976,7 @@
836976 {
837977 cRadio radioButton = new cRadio(obj.name);
838978
839
- // Patch to avoid bug with transparency.
979
+ // June 2019. Patch to avoid bug with transparency.
840980 radioButton.hadMaterial = obj.material != null;
841981 if (!radioButton.hadMaterial)
842982 {
....@@ -864,25 +1004,28 @@
8641004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8651005 }
8661006
867
- JCheckBox liveCB;
868
- JCheckBox supportCB;
869
- JCheckBox localCB;
870
- JCheckBox crowdCB;
871
- JCheckBox smoothCB;
872
- JCheckBox fastCB;
873
- JCheckBox slowCB;
874
- JCheckBox boxCB;
875
- JCheckBox zoomBoxCB;
876
- JCheckBox trackCB;
877
- JCheckBox smoothfocusCB;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
8781020 // JCheckBox speakerMocapCB;
879
- JCheckBox speakerCameraCB;
880
- JCheckBox speakerFocusCB;
881
- JCheckBox debugCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
8821024
883
- JCheckBox oeilCB;
884
- JCheckBox shadowCB;
885
- JCheckBox lookAtCB;
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
8861029
8871030 // static int COLOR = 1;
8881031 // static int MATERIAL = 2;
....@@ -890,9 +1033,9 @@
8901033
8911034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8921035
893
- JCheckBox colorCB;
894
- JCheckBox materialCB;
895
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
8961039
8971040 public void itemStateChanged(ItemEvent e)
8981041 {
....@@ -989,6 +1132,14 @@
9891132 {
9901133 Globals.COMPUTESHADOWWHENLIVE ^= true;
9911134 }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
9921143 else if(e.getSource() == lookAtCB)
9931144 {
9941145 cameraView.ToggleLookAt();
....@@ -1005,7 +1156,8 @@
10051156
10061157 /**/
10071158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1008
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
10091161 if ((path == null) || (path.getPathCount() <= 1)) {
10101162 // We can't move the root node or an empty selection
10111163 return;
....@@ -1068,8 +1220,6 @@
10681220 }
10691221 }
10701222
1071
- String string = (String) object;
1072
-
10731223 System.out.println("Transfer = " + object + "; drop : " + target);
10741224 // if( object instanceof java.io.File[])
10751225 // {
....@@ -1077,6 +1227,8 @@
10771227 // objEditor.DropFile((java.io.File[]) object, true);
10781228 // return;
10791229 // }
1230
+
1231
+ String string = object.toString();
10801232
10811233 // File path for Mac and Windows
10821234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1122,23 +1274,33 @@
11221274
11231275 assert target == objEditor.jTree;
11241276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
11251278 try {
1126
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11271280 } catch (Exception e) {
11281281 System.out.println("destinationPath : " + destinationPath);
11291282 return;
11301283 }
11311284
1132
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
11331286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
11341296 loadClipboard(true);
11351297 objEditor.jTree.setSelectionPath(destinationPath);
11361298 pasteInto(false, false);
1137
- } else {
1138
- loadClipboard(false);
1139
- objEditor.jTree.setSelectionPath(destinationPath);
1140
- pasteInto(false, false); // true); // ???
1141
- }
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
11421304 }
11431305 public void dropActionChanged(DropTargetDragEvent dtde)
11441306 // Called if the user has modified the current drop gesture
....@@ -1243,22 +1405,30 @@
12431405 {
12441406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12451407 //heightFieldItem.addActionListener(this);
1246
- gridItem = menu.add(new MenuItem("Grid"));
1247
- gridItem.addActionListener(this);
1248
- rectoidItem = menu.add(new MenuItem("Box"));
1249
- rectoidItem.addActionListener(this);
1250
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1251
- ellipsoidItem.addActionListener(this);
1252
- coneItem = menu.add(new MenuItem("Cone"));
1253
- coneItem.addActionListener(this);
1254
- torusItem = menu.add(new MenuItem("Torus"));
1255
- torusItem.addActionListener(this);
1256
- superItem = menu.add(new MenuItem("Superellipsoid"));
1257
- superItem.addActionListener(this);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
12581426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12591427 kleinItem.addActionListener(this);
1260
- particleItem = menu.add(new MenuItem("Particle system"));
1261
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
12621432 if (Globals.ADVANCED)
12631433 {
12641434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1284,15 +1454,15 @@
12841454 }
12851455 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12861456 bezierItem.addActionListener(this);
1287
- overlayItem = menu.add(new MenuItem("Overlay"));
1288
- overlayItem.addActionListener(this);
1289
- lightItem = menu.add(new MenuItem("Light"));
1290
- lightItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
12911461 menu.add("-");
12921462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12931463 //superLoopItem.addActionListener(this);
1294
- loopItem = menu.add(new MenuItem("Loop"));
1295
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
12961466 doubleItem = menu.add(new MenuItem("Fork"));
12971467 doubleItem.addActionListener(this);
12981468 if (Globals.ADVANCED)
....@@ -1308,6 +1478,9 @@
13081478 animationItem.addItemListener(this);
13091479 animationItem.setState(Globals.ANIMATION);
13101480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
13111484 menu.add("-");
13121485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13131486 parseverticesItem.addActionListener(this);
....@@ -1320,6 +1493,8 @@
13201493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13211494 reduce34MorphItem.addActionListener(this);
13221495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
13231498 menu.add(computeAOItem = new MenuItem("Compute AO"));
13241499 computeAOItem.addActionListener(this);
13251500
....@@ -1328,8 +1503,6 @@
13281503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13291504 mirrorItem.addActionListener(this);
13301505 menu.add("-");
1331
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1332
- memoryItem.addActionListener(this);
13331506 menu.add(analyzeItem = new MenuItem("Analyze"));
13341507 analyzeItem.addActionListener(this);
13351508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1477,6 +1650,20 @@
14771650
14781651 makeSomething(shadow);
14791652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
14801667
14811668 /**
14821669 * applyExample
....@@ -1721,7 +1908,7 @@
17211908 {
17221909 ScreenFit();
17231910 } else
1724
- if (source == switchItem)
1911
+ if (source == switchViewItem)
17251912 {
17261913 cVector v1 = new cVector();
17271914 cVector v2 = new cVector();
....@@ -1730,11 +1917,11 @@
17301917 objEditor.cameraView.renderCamera.setAim(v2, v1);
17311918 objEditor.cameraView.repaint();
17321919 } else
1733
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
17341921 {
17351922 makeSomething(new Box());
17361923 } else
1737
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
17381925 {
17391926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17401927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1813,27 +2000,27 @@
18132000
18142001 makeSomething(obj);
18152002 } else
1816
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
18172004 {
18182005 makeSomething(new Grid());
18192006 } else
1820
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
18212008 {
18222009 makeSomething(new Sphere());
18232010 } else
1824
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
18252012 {
18262013 makeSomething(new Cone());
18272014 } else
1828
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
18292016 {
18302017 makeSomething(new Torus());
18312018 } else
1832
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
18332020 {
18342021 makeSomething(new Superellipsoid());
18352022 } else
1836
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
18372024 {
18382025 makeSomething(new Klein());
18392026 } else
....@@ -1853,7 +2040,7 @@
18532040 {
18542041 makeSomething(new BezierSurface());
18552042 } else
1856
- if (source == overlayItem)
2043
+ if (source == overlayItem || source == overlayButton)
18572044 {
18582045 /*
18592046 Object3D obj = new BezierSurface(5,8);
....@@ -1901,7 +2088,7 @@
19012088 s.setup();
19022089 makeSomething(s);
19032090 } else
1904
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
19052092 {
19062093 makeSomething(new Light());
19072094 } else
....@@ -1951,30 +2138,30 @@
19512138
19522139 group(g);
19532140 } else
1954
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
19552142 {
19562143 Composite csg = new GroupLeaf();
19572144 csg.count = 5;
19582145 group(csg);
1959
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
19602147 csg.addChild(child);
19612148 child.addChild(csg);
19622149 } else
19632150 if (source == doubleItem)
19642151 {
1965
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
19662153 csg.count = 5;
19672154 group(csg);
1968
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
19692156 csg.addChild(child);
19702157 child.addChild(csg);
1971
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
19722159 csg.addChild(child);
19732160 child.addChild(csg);
19742161 } else
19752162 if (source == tripleItem)
19762163 {
1977
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
19782165 csg.count = 4;
19792166 group(csg);
19802167 Composite child = new cGroup();
....@@ -2038,7 +2225,8 @@
20382225 } else
20392226 if (source == undoButton)
20402227 {
2041
- Undo();
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
20422230 } else
20432231 if (source == redoButton)
20442232 {
....@@ -2046,7 +2234,8 @@
20462234 } else
20472235 if (source == saveButton)
20482236 {
2049
- Save();
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
20502239 } else
20512240 if (source == oneStepButton)
20522241 {
....@@ -2055,17 +2244,14 @@
20552244 } else
20562245 if (source == screenfitButton)
20572246 {
2058
- //Reload(lastConverter, lastFilename, true);
20592247 ScreenFit();
20602248 } else
20612249 if (source == screenfitpointButton)
20622250 {
2063
- //Reload(lastConverter, lastFilename, true);
20642251 ScreenFitPoint();
20652252 } else
20662253 if (source == snapobjectButton)
20672254 {
2068
- //Reload(lastConverter, lastFilename, true);
20692255 SnapObject();
20702256 } else
20712257 // if (event.getSource() == recompileButton)
....@@ -2441,9 +2627,9 @@
24412627 {
24422628 ClearSelection(true);
24432629 } else
2444
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
24452631 {
2446
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
24472633 } else
24482634 if (source == hideItem)
24492635 {
....@@ -2461,11 +2647,11 @@
24612647 {
24622648 makeSomething(new Camera());
24632649 } else
2464
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
24652651 {
24662652 group(new Composite());
24672653 } else
2468
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
24692655 {
24702656 RandomNode random = new RandomNode();
24712657 group(random);
....@@ -2567,7 +2753,7 @@
25672753 {
25682754 group(new cLinker());
25692755 } else
2570
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
25712757 {
25722758 group(new TextureNode());
25732759 } else
....@@ -2587,17 +2773,30 @@
25872773 {
25882774 CastShadow(2);
25892775 } else
2590
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
25912777 {
2592
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
25932780 for (int i=0; i<group.selection.size(); i++)
25942781 {
2595
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
25962787 }
25972788
2598
- ClearSelection(false);
2599
-
2600
- refreshContents();
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
26012800 } else
26022801 if (source == genUVItem)
26032802 {
....@@ -2925,6 +3124,10 @@
29253124 if (source == twoButton)
29263125 {
29273126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
29283131 // bug
29293132 //gridPanel.setDividerLocation(1.0);
29303133 //bigPanel.setDividerLocation(0.0);
....@@ -2980,6 +3183,9 @@
29803183 {
29813184 radio.layout = threeButton;
29823185
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
3188
+
29833189 // bigThree.remove(scenePanel);
29843190 // bigThree.remove(centralPanel);
29853191 // bigThree.remove(XYZPanel);
....@@ -3018,6 +3224,9 @@
30183224 {
30193225 radio.layout = fourButton;
30203226
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
3229
+
30213230 // bigThree.remove(scenePanel);
30223231 // bigThree.remove(centralPanel);
30233232 // bigThree.remove(XYZPanel);
....@@ -3054,6 +3263,9 @@
30543263 if (source == sixButton)
30553264 {
30563265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
30573269
30583270 // bigThree.remove(scenePanel);
30593271 // bigThree.remove(centralPanel);
....@@ -3092,6 +3304,9 @@
30923304 if (source == sevenButton)
30933305 {
30943306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
30953310
30963311 // bigThree.remove(scenePanel);
30973312 // bigThree.remove(centralPanel);
....@@ -3159,7 +3374,8 @@
31593374 buttonGroup.remove(ab);
31603375 radioPanel.remove(ab);
31613376
3162
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
31633379 // ab.GetObject().objectUI = null; // ?????????
31643380
31653381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3172,6 +3388,12 @@
31723388 } else
31733389 if (source == editItem || source == editButton)
31743390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
31753397 EditSelection(false);
31763398 } else
31773399 if (source == uneditButton)
....@@ -3181,6 +3403,7 @@
31813403 Object3D child = (Object3D)e.nextElement();
31823404 if(child.editWindow != null)
31833405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
31843407 child.CloseUI();
31853408 listUI.remove(child);
31863409
....@@ -3197,6 +3420,7 @@
31973420 //copy.ClearUI();
31983421 for (Object3D obj : listUI)
31993422 {
3423
+ obj.pinned = false;
32003424 obj.CloseUI();
32013425 }
32023426 listUI.clear();
....@@ -3206,7 +3430,7 @@
32063430 {
32073431 assert(copy == group);
32083432
3209
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32103434
32113435 for (Object3D obj : listUI)
32123436 {
....@@ -3273,6 +3497,7 @@
32733497
32743498 // fix "+" issue
32753499 //group.editWindow = this;
3500
+ group.manipWindow = this;
32763501
32773502 /*
32783503 currentLayout = radio.layout;
....@@ -3280,6 +3505,11 @@
32803505 currentLayout = sevenButton;
32813506 */
32823507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
32833513 keepparent = group.parent;
32843514 // PARENT = NULL or not???
32853515 //group.parent = null; // ROOT
....@@ -3293,7 +3523,7 @@
32933523 cameraView.ProtectCamera();
32943524 cameraView.repaint();
32953525 return;
3296
- } else if (event.getSource() == revertCameraItem)
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32973527 {
32983528 cameraView.RevertCamera();
32993529 cameraView.repaint();
....@@ -4347,10 +4577,6 @@
43474577 // }
43484578 // }
43494579
4350
- static boolean allparams = true;
4351
-
4352
- static Vector<Object3D> listUI = new Vector<Object3D>();
4353
-
43544580 void EditSelection(boolean newWindow)
43554581 {
43564582 // aConstraints.gridy = 0;
....@@ -4358,7 +4584,7 @@
43584584 {
43594585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43604586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4361
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43624588
43634589 Object3D elem = (Object3D)group.selection.elementAt(i);
43644590 if(elem != group || !newWindow)
....@@ -4443,7 +4669,8 @@
44434669 //new Exception().printStackTrace();
44444670
44454671 freezemodel = true;
4446
-
4672
+ ClearUnpinned();
4673
+
44474674 /**/
44484675 //switch (event.id)
44494676 {
....@@ -4476,7 +4703,7 @@
44764703 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44774704 // a camera
44784705 {
4479
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44804707 {
44814708 CameraPane.camerachangeframe = 0; // don't refuse it
44824709 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4485,6 +4712,13 @@
44854712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44864713 }
44874714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
44884722 refreshContents();
44894723 //return true;
44904724 }
....@@ -4494,9 +4728,18 @@
44944728 freezemodel = false;
44954729 }
44964730
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
44974739 void refreshContents(boolean cp)
44984740 {
4499
- if (!Globals.MOUSEDRAGGED)
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45004743 {
45014744 objEditor.ClearInfo(); // .GetMaterial());
45024745
....@@ -4595,7 +4838,8 @@
45954838
45964839 if (cut)
45974840 {
4598
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
45994843 //int indices[] = jList.getSelectedIndices();
46004844 //for (int i = indices.length - 1; i >= 0; i--)
46014845 //jList.remove(indices[i]);
....@@ -4698,6 +4942,10 @@
46984942
46994943 void paste(boolean expand)
47004944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
47014949 // if (GrafreeD.clipboard == null)
47024950 // return;
47034951 boolean first = true;
....@@ -4757,6 +5005,7 @@
47575005 Grafreed.clipboard.get(0).parent = keepparent;
47585006 }
47595007
5008
+ Globals.SAVEONMAKE = keep;
47605009 ResetModel();
47615010 refreshContents();
47625011 }
....@@ -4892,6 +5141,10 @@
48925141
48935142 void group(Object3D csg, boolean grab)
48945143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
48955148 if (//false) // why??
48965149 !group.selection.isEmpty())
48975150 {
....@@ -5005,10 +5258,15 @@
50055258 //node.add(csg);
50065259 //makeSomething(node);
50075260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
50085262 }
50095263
50105264 void Ungroup(Object3D g)
50115265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
50125270 if (g instanceof HiddenObject)
50135271 {
50145272 HiddenObject h = (HiddenObject) g;
....@@ -5025,6 +5283,7 @@
50255283 objEditor.makeSomething(g.get(i), false);
50265284 }
50275285 }
5286
+ Globals.SAVEONMAKE = keep;
50285287 }
50295288
50305289 void ungroup()
....@@ -5313,13 +5572,28 @@
53135572 cButton clearpanelButton;
53145573 cButton unselectButton;
53155574
5316
- cButton minButton;
5317
- cButton maxButton;
5318
- cButton fullButton;
5319
- cButton undoButton;
5320
- cButton redoButton;
5575
+ cButton restoreCameraButton;
5576
+
53215577 cButton saveButton;
53225578 cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
53235597
53245598 cButton screenfitButton;
53255599 cButton screenfitpointButton;
....@@ -5341,11 +5615,11 @@
53415615 //JTree jTree;
53425616 private MenuItem lookAtItem;
53435617 private MenuItem lookFromItem;
5344
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
53455619 private MenuItem cutItem;
53465620 private MenuItem undoItem;
53475621 private MenuItem redoItem;
5348
- private MenuItem duplicateItem;
5622
+ private JMenuItem duplicateItem;
53495623 private MenuItem cloneItem;
53505624 private MenuItem cloneSupportItem;
53515625 private MenuItem overwriteGeoItem;
....@@ -5433,7 +5707,7 @@
54335707 private MenuItem frontItem;
54345708 private MenuItem cameraItem;
54355709 private MenuItem compositeItem;
5436
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
54375711 private MenuItem physicsItem;
54385712 private MenuItem frameselectorItem;
54395713 private MenuItem scriptNodeItem;
....@@ -5507,5 +5781,5 @@
55075781
55085782 Menu cameraMenu;
55095783 MenuItem editCameraItem;
5510
- MenuItem revertCameraItem;
5784
+ MenuItem restoreCameraItem;
55115785 }