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,32 +917,72 @@
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);
932
+ oeilCB.setToolTipText("Move camera when tracking");
811933 oeilCB.addItemListener(this);
812934
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
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();
953
+ if (Globals.ADVANCED)
954
+ {
813955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
814956 lookAtCB.setToolTipText("Look-at target");
815957 lookAtCB.addItemListener(this);
958
+ }
816959
817960 }
818961
819962 cGridBag fill = new cGridBag();
820
-
821963 fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
822968
823969 panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
824972
825973 }
826974
827975 void EditObject(Object3D obj)
828976 {
829977 cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
830986 radioButton.SetObject(obj);
831987 radioButton.layout = sevenButton;
832988 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -848,23 +1004,28 @@
8481004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8491005 }
8501006
851
- JCheckBox liveCB;
852
- JCheckBox supportCB;
853
- JCheckBox localCB;
854
- JCheckBox crowdCB;
855
- JCheckBox smoothCB;
856
- JCheckBox fastCB;
857
- JCheckBox slowCB;
858
- JCheckBox boxCB;
859
- JCheckBox zoomBoxCB;
860
- JCheckBox trackCB;
861
- JCheckBox smoothfocusCB;
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;
8621020 // JCheckBox speakerMocapCB;
863
- JCheckBox speakerCameraCB;
864
- JCheckBox speakerFocusCB;
865
- JCheckBox debugCB;
866
- JCheckBox oeilCB;
867
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
8681029
8691030 // static int COLOR = 1;
8701031 // static int MATERIAL = 2;
....@@ -872,9 +1033,9 @@
8721033
8731034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8741035
875
- JCheckBox colorCB;
876
- JCheckBox materialCB;
877
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
8781039
8791040 public void itemStateChanged(ItemEvent e)
8801041 {
....@@ -967,6 +1128,18 @@
9671128 {
9681129 cameraView.ToggleOeil();
9691130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
9701143 else if(e.getSource() == lookAtCB)
9711144 {
9721145 cameraView.ToggleLookAt();
....@@ -983,7 +1156,8 @@
9831156
9841157 /**/
9851158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
986
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
9871161 if ((path == null) || (path.getPathCount() <= 1)) {
9881162 // We can't move the root node or an empty selection
9891163 return;
....@@ -1046,8 +1220,6 @@
10461220 }
10471221 }
10481222
1049
- String string = (String) object;
1050
-
10511223 System.out.println("Transfer = " + object + "; drop : " + target);
10521224 // if( object instanceof java.io.File[])
10531225 // {
....@@ -1055,6 +1227,8 @@
10551227 // objEditor.DropFile((java.io.File[]) object, true);
10561228 // return;
10571229 // }
1230
+
1231
+ String string = object.toString();
10581232
10591233 // File path for Mac and Windows
10601234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1100,23 +1274,33 @@
11001274
11011275 assert target == objEditor.jTree;
11021276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
11031278 try {
1104
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11051280 } catch (Exception e) {
11061281 System.out.println("destinationPath : " + destinationPath);
11071282 return;
11081283 }
11091284
1110
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
11111286 {
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
+// {
11121296 loadClipboard(true);
11131297 objEditor.jTree.setSelectionPath(destinationPath);
11141298 pasteInto(false, false);
1115
- } else {
1116
- loadClipboard(false);
1117
- objEditor.jTree.setSelectionPath(destinationPath);
1118
- pasteInto(false, false); // true); // ???
1119
- }
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
11201304 }
11211305 public void dropActionChanged(DropTargetDragEvent dtde)
11221306 // Called if the user has modified the current drop gesture
....@@ -1221,22 +1405,30 @@
12211405 {
12221406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12231407 //heightFieldItem.addActionListener(this);
1224
- gridItem = menu.add(new MenuItem("Grid"));
1225
- gridItem.addActionListener(this);
1226
- rectoidItem = menu.add(new MenuItem("Box"));
1227
- rectoidItem.addActionListener(this);
1228
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1229
- ellipsoidItem.addActionListener(this);
1230
- coneItem = menu.add(new MenuItem("Cone"));
1231
- coneItem.addActionListener(this);
1232
- torusItem = menu.add(new MenuItem("Torus"));
1233
- torusItem.addActionListener(this);
1234
- superItem = menu.add(new MenuItem("Superellipsoid"));
1235
- superItem.addActionListener(this);
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
+ {
12361426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12371427 kleinItem.addActionListener(this);
1238
- particleItem = menu.add(new MenuItem("Particle system"));
1239
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
12401432 if (Globals.ADVANCED)
12411433 {
12421434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1262,15 +1454,15 @@
12621454 }
12631455 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12641456 bezierItem.addActionListener(this);
1265
- overlayItem = menu.add(new MenuItem("Overlay"));
1266
- overlayItem.addActionListener(this);
1267
- lightItem = menu.add(new MenuItem("Light"));
1268
- lightItem.addActionListener(this);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
12691461 menu.add("-");
12701462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12711463 //superLoopItem.addActionListener(this);
1272
- loopItem = menu.add(new MenuItem("Loop"));
1273
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
12741466 doubleItem = menu.add(new MenuItem("Fork"));
12751467 doubleItem.addActionListener(this);
12761468 if (Globals.ADVANCED)
....@@ -1286,6 +1478,9 @@
12861478 animationItem.addItemListener(this);
12871479 animationItem.setState(Globals.ANIMATION);
12881480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
12891484 menu.add("-");
12901485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12911486 parseverticesItem.addActionListener(this);
....@@ -1298,6 +1493,8 @@
12981493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12991494 reduce34MorphItem.addActionListener(this);
13001495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
13011498 menu.add(computeAOItem = new MenuItem("Compute AO"));
13021499 computeAOItem.addActionListener(this);
13031500
....@@ -1306,8 +1503,6 @@
13061503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13071504 mirrorItem.addActionListener(this);
13081505 menu.add("-");
1309
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1310
- memoryItem.addActionListener(this);
13111506 menu.add(analyzeItem = new MenuItem("Analyze"));
13121507 analyzeItem.addActionListener(this);
13131508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1455,6 +1650,20 @@
14551650
14561651 makeSomething(shadow);
14571652 }
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
+ }
14581667
14591668 /**
14601669 * applyExample
....@@ -1699,7 +1908,7 @@
16991908 {
17001909 ScreenFit();
17011910 } else
1702
- if (source == switchItem)
1911
+ if (source == switchViewItem)
17031912 {
17041913 cVector v1 = new cVector();
17051914 cVector v2 = new cVector();
....@@ -1708,11 +1917,11 @@
17081917 objEditor.cameraView.renderCamera.setAim(v2, v1);
17091918 objEditor.cameraView.repaint();
17101919 } else
1711
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
17121921 {
17131922 makeSomething(new Box());
17141923 } else
1715
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
17161925 {
17171926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17181927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1791,27 +2000,27 @@
17912000
17922001 makeSomething(obj);
17932002 } else
1794
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
17952004 {
17962005 makeSomething(new Grid());
17972006 } else
1798
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
17992008 {
18002009 makeSomething(new Sphere());
18012010 } else
1802
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
18032012 {
18042013 makeSomething(new Cone());
18052014 } else
1806
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
18072016 {
18082017 makeSomething(new Torus());
18092018 } else
1810
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
18112020 {
18122021 makeSomething(new Superellipsoid());
18132022 } else
1814
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
18152024 {
18162025 makeSomething(new Klein());
18172026 } else
....@@ -1831,7 +2040,7 @@
18312040 {
18322041 makeSomething(new BezierSurface());
18332042 } else
1834
- if (source == overlayItem)
2043
+ if (source == overlayItem || source == overlayButton)
18352044 {
18362045 /*
18372046 Object3D obj = new BezierSurface(5,8);
....@@ -1879,7 +2088,7 @@
18792088 s.setup();
18802089 makeSomething(s);
18812090 } else
1882
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
18832092 {
18842093 makeSomething(new Light());
18852094 } else
....@@ -1929,30 +2138,30 @@
19292138
19302139 group(g);
19312140 } else
1932
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
19332142 {
19342143 Composite csg = new GroupLeaf();
19352144 csg.count = 5;
19362145 group(csg);
1937
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
19382147 csg.addChild(child);
19392148 child.addChild(csg);
19402149 } else
19412150 if (source == doubleItem)
19422151 {
1943
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
19442153 csg.count = 5;
19452154 group(csg);
1946
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
19472156 csg.addChild(child);
19482157 child.addChild(csg);
1949
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
19502159 csg.addChild(child);
19512160 child.addChild(csg);
19522161 } else
19532162 if (source == tripleItem)
19542163 {
1955
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
19562165 csg.count = 4;
19572166 group(csg);
19582167 Composite child = new cGroup();
....@@ -2016,7 +2225,8 @@
20162225 } else
20172226 if (source == undoButton)
20182227 {
2019
- Undo();
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
20202230 } else
20212231 if (source == redoButton)
20222232 {
....@@ -2024,7 +2234,8 @@
20242234 } else
20252235 if (source == saveButton)
20262236 {
2027
- Save();
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
20282239 } else
20292240 if (source == oneStepButton)
20302241 {
....@@ -2033,17 +2244,14 @@
20332244 } else
20342245 if (source == screenfitButton)
20352246 {
2036
- //Reload(lastConverter, lastFilename, true);
20372247 ScreenFit();
20382248 } else
20392249 if (source == screenfitpointButton)
20402250 {
2041
- //Reload(lastConverter, lastFilename, true);
20422251 ScreenFitPoint();
20432252 } else
20442253 if (source == snapobjectButton)
20452254 {
2046
- //Reload(lastConverter, lastFilename, true);
20472255 SnapObject();
20482256 } else
20492257 // if (event.getSource() == recompileButton)
....@@ -2419,9 +2627,9 @@
24192627 {
24202628 ClearSelection(true);
24212629 } else
2422
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
24232631 {
2424
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
24252633 } else
24262634 if (source == hideItem)
24272635 {
....@@ -2439,11 +2647,11 @@
24392647 {
24402648 makeSomething(new Camera());
24412649 } else
2442
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
24432651 {
24442652 group(new Composite());
24452653 } else
2446
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
24472655 {
24482656 RandomNode random = new RandomNode();
24492657 group(random);
....@@ -2545,7 +2753,7 @@
25452753 {
25462754 group(new cLinker());
25472755 } else
2548
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
25492757 {
25502758 group(new TextureNode());
25512759 } else
....@@ -2565,17 +2773,30 @@
25652773 {
25662774 CastShadow(2);
25672775 } else
2568
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
25692777 {
2570
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
25712780 for (int i=0; i<group.selection.size(); i++)
25722781 {
2573
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
25742787 }
25752788
2576
- ClearSelection(false);
2577
-
2578
- 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
+ }
25792800 } else
25802801 if (source == genUVItem)
25812802 {
....@@ -2903,6 +3124,10 @@
29033124 if (source == twoButton)
29043125 {
29053126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
29063131 // bug
29073132 //gridPanel.setDividerLocation(1.0);
29083133 //bigPanel.setDividerLocation(0.0);
....@@ -2958,6 +3183,9 @@
29583183 {
29593184 radio.layout = threeButton;
29603185
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
3188
+
29613189 // bigThree.remove(scenePanel);
29623190 // bigThree.remove(centralPanel);
29633191 // bigThree.remove(XYZPanel);
....@@ -2996,6 +3224,9 @@
29963224 {
29973225 radio.layout = fourButton;
29983226
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
3229
+
29993230 // bigThree.remove(scenePanel);
30003231 // bigThree.remove(centralPanel);
30013232 // bigThree.remove(XYZPanel);
....@@ -3032,6 +3263,9 @@
30323263 if (source == sixButton)
30333264 {
30343265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
30353269
30363270 // bigThree.remove(scenePanel);
30373271 // bigThree.remove(centralPanel);
....@@ -3070,6 +3304,9 @@
30703304 if (source == sevenButton)
30713305 {
30723306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
30733310
30743311 // bigThree.remove(scenePanel);
30753312 // bigThree.remove(centralPanel);
....@@ -3126,12 +3363,19 @@
31263363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31273364 {
31283365 ab = (cRadio)e.nextElement();
3129
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31303367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
31313374 buttonGroup.remove(ab);
31323375 radioPanel.remove(ab);
31333376
3134
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
31353379 // ab.GetObject().objectUI = null; // ?????????
31363380
31373381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3144,6 +3388,12 @@
31443388 } else
31453389 if (source == editItem || source == editButton)
31463390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
31473397 EditSelection(false);
31483398 } else
31493399 if (source == uneditButton)
....@@ -3153,6 +3403,7 @@
31533403 Object3D child = (Object3D)e.nextElement();
31543404 if(child.editWindow != null)
31553405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
31563407 child.CloseUI();
31573408 listUI.remove(child);
31583409
....@@ -3169,6 +3420,7 @@
31693420 //copy.ClearUI();
31703421 for (Object3D obj : listUI)
31713422 {
3423
+ obj.pinned = false;
31723424 obj.CloseUI();
31733425 }
31743426 listUI.clear();
....@@ -3178,7 +3430,7 @@
31783430 {
31793431 assert(copy == group);
31803432
3181
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31823434
31833435 for (Object3D obj : listUI)
31843436 {
....@@ -3245,6 +3497,7 @@
32453497
32463498 // fix "+" issue
32473499 //group.editWindow = this;
3500
+ group.manipWindow = this;
32483501
32493502 /*
32503503 currentLayout = radio.layout;
....@@ -3252,6 +3505,11 @@
32523505 currentLayout = sevenButton;
32533506 */
32543507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
32553513 keepparent = group.parent;
32563514 // PARENT = NULL or not???
32573515 //group.parent = null; // ROOT
....@@ -3265,7 +3523,7 @@
32653523 cameraView.ProtectCamera();
32663524 cameraView.repaint();
32673525 return;
3268
- } else if (event.getSource() == revertCameraItem)
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32693527 {
32703528 cameraView.RevertCamera();
32713529 cameraView.repaint();
....@@ -4319,10 +4577,6 @@
43194577 // }
43204578 // }
43214579
4322
- static boolean allparams = true;
4323
-
4324
- static Vector<Object3D> listUI = new Vector<Object3D>();
4325
-
43264580 void EditSelection(boolean newWindow)
43274581 {
43284582 // aConstraints.gridy = 0;
....@@ -4330,7 +4584,7 @@
43304584 {
43314585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43324586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4333
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43344588
43354589 Object3D elem = (Object3D)group.selection.elementAt(i);
43364590 if(elem != group || !newWindow)
....@@ -4415,7 +4669,8 @@
44154669 //new Exception().printStackTrace();
44164670
44174671 freezemodel = true;
4418
-
4672
+ ClearUnpinned();
4673
+
44194674 /**/
44204675 //switch (event.id)
44214676 {
....@@ -4448,7 +4703,7 @@
44484703 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44494704 // a camera
44504705 {
4451
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44524707 {
44534708 CameraPane.camerachangeframe = 0; // don't refuse it
44544709 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4457,6 +4712,13 @@
44574712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44584713 }
44594714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
44604722 refreshContents();
44614723 //return true;
44624724 }
....@@ -4466,9 +4728,18 @@
44664728 freezemodel = false;
44674729 }
44684730
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
44694739 void refreshContents(boolean cp)
44704740 {
4471
- if (!Globals.MOUSEDRAGGED)
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44724743 {
44734744 objEditor.ClearInfo(); // .GetMaterial());
44744745
....@@ -4567,7 +4838,8 @@
45674838
45684839 if (cut)
45694840 {
4570
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
45714843 //int indices[] = jList.getSelectedIndices();
45724844 //for (int i = indices.length - 1; i >= 0; i--)
45734845 //jList.remove(indices[i]);
....@@ -4670,6 +4942,10 @@
46704942
46714943 void paste(boolean expand)
46724944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
46734949 // if (GrafreeD.clipboard == null)
46744950 // return;
46754951 boolean first = true;
....@@ -4729,6 +5005,7 @@
47295005 Grafreed.clipboard.get(0).parent = keepparent;
47305006 }
47315007
5008
+ Globals.SAVEONMAKE = keep;
47325009 ResetModel();
47335010 refreshContents();
47345011 }
....@@ -4864,6 +5141,10 @@
48645141
48655142 void group(Object3D csg, boolean grab)
48665143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
48675148 if (//false) // why??
48685149 !group.selection.isEmpty())
48695150 {
....@@ -4977,10 +5258,15 @@
49775258 //node.add(csg);
49785259 //makeSomething(node);
49795260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
49805262 }
49815263
49825264 void Ungroup(Object3D g)
49835265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
49845270 if (g instanceof HiddenObject)
49855271 {
49865272 HiddenObject h = (HiddenObject) g;
....@@ -4997,6 +5283,7 @@
49975283 objEditor.makeSomething(g.get(i), false);
49985284 }
49995285 }
5286
+ Globals.SAVEONMAKE = keep;
50005287 }
50015288
50025289 void ungroup()
....@@ -5285,13 +5572,28 @@
52855572 cButton clearpanelButton;
52865573 cButton unselectButton;
52875574
5288
- cButton minButton;
5289
- cButton maxButton;
5290
- cButton fullButton;
5291
- cButton undoButton;
5292
- cButton redoButton;
5575
+ cButton restoreCameraButton;
5576
+
52935577 cButton saveButton;
52945578 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;
52955597
52965598 cButton screenfitButton;
52975599 cButton screenfitpointButton;
....@@ -5313,11 +5615,11 @@
53135615 //JTree jTree;
53145616 private MenuItem lookAtItem;
53155617 private MenuItem lookFromItem;
5316
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
53175619 private MenuItem cutItem;
53185620 private MenuItem undoItem;
53195621 private MenuItem redoItem;
5320
- private MenuItem duplicateItem;
5622
+ private JMenuItem duplicateItem;
53215623 private MenuItem cloneItem;
53225624 private MenuItem cloneSupportItem;
53235625 private MenuItem overwriteGeoItem;
....@@ -5405,7 +5707,7 @@
54055707 private MenuItem frontItem;
54065708 private MenuItem cameraItem;
54075709 private MenuItem compositeItem;
5408
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
54095711 private MenuItem physicsItem;
54105712 private MenuItem frameselectorItem;
54115713 private MenuItem scriptNodeItem;
....@@ -5479,5 +5781,5 @@
54795781
54805782 Menu cameraMenu;
54815783 MenuItem editCameraItem;
5482
- MenuItem revertCameraItem;
5784
+ MenuItem restoreCameraItem;
54835785 }