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)
....@@ -204,23 +209,23 @@
204209 //zBufferItem.addActionListener(this);
205210 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206211 //normalLensItem.addActionListener(this);
207
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
208
- revertCameraItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
209214
210
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
- toggleFullScreenItem.addItemListener(this);
212
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
- 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);
214227
215
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
- toggleTextureItem.addItemListener(this);
217
- toggleTextureItem.setState(CameraPane.textureon);
218
-
219
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
- toggleSwitchItem.addItemListener(this);
221
- toggleSwitchItem.setState(CameraPane.SWITCH);
222
-
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224229 toggleHandleItem.addItemListener(this);
225230 toggleHandleItem.setState(CameraPane.HANDLES);
226231
....@@ -275,7 +280,7 @@
275280 {
276281 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277282 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279284 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280285 oe.cameraMenu.add("-");
281286 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -283,7 +288,7 @@
283288 editLeafItem.addActionListener(this);
284289 lookAtItem.addActionListener(this);
285290 //lookFromItem.addActinoListener(this);
286
- //switchItem.addActionListener(this);
291
+ //switchViewItem.addActionListener(this);
287292 }
288293
289294 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -328,14 +333,14 @@
328333 }
329334
330335 oe.menuBar.add(menu = new Menu("Group"));
331
- grabItem = menu.add(new MenuItem("Grab"));
332
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
333338 backItem = menu.add(new MenuItem("Back"));
334339 backItem.addActionListener(this);
335340 frontItem = menu.add(new MenuItem("Front"));
336341 frontItem.addActionListener(this);
337
- compositeItem = menu.add(new MenuItem("Composite"));
338
- compositeItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
339344
340345 if (Globals.ADVANCED)
341346 {
....@@ -345,10 +350,10 @@
345350 ungroupItem = menu.add(new MenuItem("Ungroup"));
346351 ungroupItem.addActionListener(this);
347352
348
- menu.add("-");
349
-
350
- randomItem = menu.add(new MenuItem("Switch node"));
351
- randomItem.addActionListener(this);
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
352357 if (Globals.ADVANCED)
353358 {
354359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
....@@ -365,13 +370,11 @@
365370 frameselectorItem.addActionListener(this);
366371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
367372 scriptNodeItem.addActionListener(this);
368
- cameraItem = menu.add(new MenuItem("Camera"));
369
- cameraItem.addActionListener(this);
370373 }
371374
372375 oe.menuBar.add(menu = new Menu("Object"));
373
- textureItem = menu.add(new MenuItem("Texture"));
374
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
375378 billboardItem = menu.add(new MenuItem("Billboard"));
376379 billboardItem.addActionListener(this);
377380 csgItem = menu.add(new MenuItem("CSG"));
....@@ -382,13 +385,14 @@
382385 shadowYItem.addActionListener(this);
383386 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
384387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
385391 if (Globals.ADVANCED)
386392 {
387393 menu.add("-");
388394 linkerItem = menu.add(new MenuItem("Linker"));
389395 linkerItem.addActionListener(this);
390
- attributeItem = menu.add(new MenuItem("Attribute"));
391
- attributeItem.addActionListener(this);
392396 templateItem = menu.add(new MenuItem("Template"));
393397 templateItem.addActionListener(this);
394398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -582,53 +586,66 @@
582586 oe.radioPanel.add(dummyButton);
583587 oe.buttonGroup.add(dummyButton);
584588 */
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
592
+
585593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
586594
587595 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588596 //minButton.setToolTipText("Minimize window");
589597 //minButton.addActionListener(this);
590598
591
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- maxButton.setToolTipText("Maximize window");
593
- 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
+ }
594605
595606 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596607 fullButton.setToolTipText("Full-screen window");
597608 fullButton.addActionListener(this);
598609
599
- oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !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);
600619 undoButton.setToolTipText("Undo changes");
601620 undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
602622
603
- oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
604624 redoButton.setToolTipText("Redo changes");
605625 redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
606627
607
- oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608629 saveButton.setToolTipText("Save changes");
609630 saveButton.addActionListener(this);
610631
611
- oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
612633 liveCB.setToolTipText("Enable animation");
613634 liveCB.addItemListener(this);
614635
615
- oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616637 oneStepButton.setToolTipText("Animate one step forward");
617638 oneStepButton.addActionListener(this);
618639
619
- oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
620641 fastCB.setToolTipText("Fast mode");
621642 fastCB.addItemListener(this);
622643
623
- oe.toolboxPanel.Return();
644
+ //oe.toolboxPanel.Return();
624645
625
- oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
626
- trackCB.setToolTipText("Enable tracking");
627
- trackCB.addItemListener(this);
628
-
629
- oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
- screenfitButton.setToolTipText("Screen fit");
631
- screenfitButton.addActionListener(this);
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
632649
633650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
634651 // screenfitpointButton.addActionListener(this);
....@@ -640,10 +657,6 @@
640657 snapobjectButton.setToolTipText("Snap Object");
641658 }
642659
643
- oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
- flashSelectionButton.setToolTipText("Highlight selection");
645
- flashSelectionButton.addActionListener(this);
646
-
647660 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
648661
649662 oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -688,8 +701,6 @@
688701 sphereButton.setToolTipText("Create sphere");
689702 sphereButton.addActionListener(this);
690703
691
- oe.toolboxPanel.Return();
692
-
693704 oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694705 coneButton.setToolTipText("Create cone");
695706 coneButton.addActionListener(this);
....@@ -713,6 +724,28 @@
713724 particlesButton.setToolTipText("Create particle system");
714725 particlesButton.addActionListener(this);
715726
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
+
716749 oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
717750 overlayButton.setToolTipText("Create overlay");
718751 overlayButton.addActionListener(this);
....@@ -721,17 +754,29 @@
721754 lightButton.setToolTipText("Create light");
722755 lightButton.addActionListener(this);
723756
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
+
724769 // EDIT panel
725
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
- editButton.setToolTipText("Edit selection");
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
727772 editButton.addActionListener(this);
728773
729
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
- uneditButton.setToolTipText("Unedit selection");
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
731776 uneditButton.addActionListener(this);
732777
733778 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
734
- allParamsButton.setToolTipText("Edit all params");
779
+ allParamsButton.setToolTipText("Show all controle");
735780 allParamsButton.addActionListener(this);
736781
737782 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -742,8 +787,13 @@
742787 unselectButton.setToolTipText("Unselect");
743788 unselectButton.addActionListener(this);
744789
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
793
+
745794 editCommandsPanel.preferredHeight = 1;
746795
796
+ SetPinStates(false);
747797 // oe.treePanel.add(commandsPanel);
748798 // oe.treePanel.Return();
749799
....@@ -768,21 +818,6 @@
768818 oe.treePanel.add(jSPPanel);
769819 oe.treePanel.Return();
770820
771
- cGridBag copyOptionsPanel = new cGridBag();
772
-
773
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
774
- colorCB.setToolTipText("Copy color when dropped");
775
- colorCB.addItemListener(this);
776
-
777
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
778
- materialCB.setToolTipText("Copy material when dropped");
779
- materialCB.addItemListener(this);
780
-
781
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
782
- textureCB.setToolTipText("Copy texture when dropped");
783
- textureCB.addItemListener(this);
784
-
785
- copyOptionsPanel.preferredHeight = 1;
786821 oe.treePanel.add(copyOptionsPanel);
787822 oe.treePanel.Return();
788823
....@@ -813,23 +848,43 @@
813848
814849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
815850 {
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
+
816865 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
817866 boxCB.setToolTipText("Display bounding boxes");
818867 boxCB.addItemListener(this);
819868
820869 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
821
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
822871 zoomBoxCB.addItemListener(this);
823872
824873 if (true) // Globals.ADVANCED)
825874 {
826
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
827
- supportCB.setToolTipText("Enable rigging");
828
- 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);
829882
830883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
831884 // localCB.addItemListener(this);
832885
886
+ panel.Return();
887
+
833888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
834889 crowdCB.setToolTipText("Used for crowds");
835890 crowdCB.addItemListener(this);
....@@ -846,6 +901,8 @@
846901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
847902 // speakerMocapCB.addItemListener(this);
848903
904
+ panel.Return();
905
+
849906 if (false)
850907 {
851908 // handled in scripts
....@@ -860,24 +917,39 @@
860917 //constraints.gridy += 1;
861918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
862919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
863921 }
864922
865923 //constraints.gridx += 1;
866924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
867925 // debugCB.addItemListener(this);
868926
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
869931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
- oeilCB.setToolTipText("Move camera when tracking target");
932
+ oeilCB.setToolTipText("Move camera when tracking");
871933 oeilCB.addItemListener(this);
872934
873935 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
- shadowCB.setToolTipText("Compute shadows when live");
936
+ shadowCB.setToolTipText("When live compute shadows");
875937 shadowCB.addItemListener(this);
876938
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
+
877948 panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
- autosaveCB.setToolTipText("Auto-save on structure change");
949
+ autosaveCB.setToolTipText("On structure change");
879950 autosaveCB.addItemListener(this);
880951
952
+ panel.Return();
881953 if (Globals.ADVANCED)
882954 {
883955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -888,10 +960,15 @@
888960 }
889961
890962 cGridBag fill = new cGridBag();
891
-
892963 fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
893968
894969 panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
895972
896973 }
897974
....@@ -899,7 +976,7 @@
899976 {
900977 cRadio radioButton = new cRadio(obj.name);
901978
902
- // Patch to avoid bug with transparency.
979
+ // June 2019. Patch to avoid bug with transparency.
903980 radioButton.hadMaterial = obj.material != null;
904981 if (!radioButton.hadMaterial)
905982 {
....@@ -936,7 +1013,9 @@
9361013 cCheckBox slowCB;
9371014 cCheckBox boxCB;
9381015 cCheckBox zoomBoxCB;
939
- cToggleButton trackCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
9401019 cCheckBox smoothfocusCB;
9411020 // JCheckBox speakerMocapCB;
9421021 cCheckBox speakerCameraCB;
....@@ -1053,6 +1132,10 @@
10531132 {
10541133 Globals.COMPUTESHADOWWHENLIVE ^= true;
10551134 }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
10561139 else if(e.getSource() == autosaveCB)
10571140 {
10581141 Globals.SAVEONMAKE ^= true;
....@@ -1137,8 +1220,6 @@
11371220 }
11381221 }
11391222
1140
- String string = (String) object;
1141
-
11421223 System.out.println("Transfer = " + object + "; drop : " + target);
11431224 // if( object instanceof java.io.File[])
11441225 // {
....@@ -1146,6 +1227,8 @@
11461227 // objEditor.DropFile((java.io.File[]) object, true);
11471228 // return;
11481229 // }
1230
+
1231
+ String string = object.toString();
11491232
11501233 // File path for Mac and Windows
11511234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1191,13 +1274,23 @@
11911274
11921275 assert target == objEditor.jTree;
11931276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
11941278 try {
1195
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11961280 } catch (Exception e) {
11971281 System.out.println("destinationPath : " + destinationPath);
11981282 return;
11991283 }
12001284
1285
+ for (int i=group.selection.size(); --i>=0;)
1286
+ {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
12011294 // june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
12021295 // {
12031296 loadClipboard(true);
....@@ -1312,22 +1405,30 @@
13121405 {
13131406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
13141407 //heightFieldItem.addActionListener(this);
1315
- gridItem = menu.add(new MenuItem("Grid"));
1316
- gridItem.addActionListener(this);
1317
- rectoidItem = menu.add(new MenuItem("Box"));
1318
- rectoidItem.addActionListener(this);
1319
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1320
- ellipsoidItem.addActionListener(this);
1321
- coneItem = menu.add(new MenuItem("Cone"));
1322
- coneItem.addActionListener(this);
1323
- torusItem = menu.add(new MenuItem("Torus"));
1324
- torusItem.addActionListener(this);
1325
- superItem = menu.add(new MenuItem("Superellipsoid"));
1326
- 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
+ {
13271426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
13281427 kleinItem.addActionListener(this);
1329
- particleItem = menu.add(new MenuItem("Particle system"));
1330
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
13311432 if (Globals.ADVANCED)
13321433 {
13331434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1353,15 +1454,15 @@
13531454 }
13541455 bezierItem = menu.add(new MenuItem("Bezier Patch"));
13551456 bezierItem.addActionListener(this);
1356
- overlayItem = menu.add(new MenuItem("Overlay"));
1357
- overlayItem.addActionListener(this);
1358
- lightItem = menu.add(new MenuItem("Light"));
1359
- 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);
13601461 menu.add("-");
13611462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13621463 //superLoopItem.addActionListener(this);
1363
- loopItem = menu.add(new MenuItem("Loop"));
1364
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
13651466 doubleItem = menu.add(new MenuItem("Fork"));
13661467 doubleItem.addActionListener(this);
13671468 if (Globals.ADVANCED)
....@@ -1377,6 +1478,9 @@
13771478 animationItem.addItemListener(this);
13781479 animationItem.setState(Globals.ANIMATION);
13791480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
13801484 menu.add("-");
13811485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13821486 parseverticesItem.addActionListener(this);
....@@ -1389,6 +1493,8 @@
13891493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13901494 reduce34MorphItem.addActionListener(this);
13911495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
13921498 menu.add(computeAOItem = new MenuItem("Compute AO"));
13931499 computeAOItem.addActionListener(this);
13941500
....@@ -1397,8 +1503,6 @@
13971503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13981504 mirrorItem.addActionListener(this);
13991505 menu.add("-");
1400
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1401
- memoryItem.addActionListener(this);
14021506 menu.add(analyzeItem = new MenuItem("Analyze"));
14031507 analyzeItem.addActionListener(this);
14041508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1546,6 +1650,20 @@
15461650
15471651 makeSomething(shadow);
15481652 }
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
+ }
15491667
15501668 /**
15511669 * applyExample
....@@ -1790,7 +1908,7 @@
17901908 {
17911909 ScreenFit();
17921910 } else
1793
- if (source == switchItem)
1911
+ if (source == switchViewItem)
17941912 {
17951913 cVector v1 = new cVector();
17961914 cVector v2 = new cVector();
....@@ -2020,30 +2138,30 @@
20202138
20212139 group(g);
20222140 } else
2023
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
20242142 {
20252143 Composite csg = new GroupLeaf();
20262144 csg.count = 5;
20272145 group(csg);
2028
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
20292147 csg.addChild(child);
20302148 child.addChild(csg);
20312149 } else
20322150 if (source == doubleItem)
20332151 {
2034
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
20352153 csg.count = 5;
20362154 group(csg);
2037
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
20382156 csg.addChild(child);
20392157 child.addChild(csg);
2040
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
20412159 csg.addChild(child);
20422160 child.addChild(csg);
20432161 } else
20442162 if (source == tripleItem)
20452163 {
2046
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
20472165 csg.count = 4;
20482166 group(csg);
20492167 Composite child = new cGroup();
....@@ -2107,7 +2225,8 @@
21072225 } else
21082226 if (source == undoButton)
21092227 {
2110
- Undo();
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
21112230 } else
21122231 if (source == redoButton)
21132232 {
....@@ -2115,7 +2234,8 @@
21152234 } else
21162235 if (source == saveButton)
21172236 {
2118
- Save();
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
21192239 } else
21202240 if (source == oneStepButton)
21212241 {
....@@ -2124,17 +2244,14 @@
21242244 } else
21252245 if (source == screenfitButton)
21262246 {
2127
- //Reload(lastConverter, lastFilename, true);
21282247 ScreenFit();
21292248 } else
21302249 if (source == screenfitpointButton)
21312250 {
2132
- //Reload(lastConverter, lastFilename, true);
21332251 ScreenFitPoint();
21342252 } else
21352253 if (source == snapobjectButton)
21362254 {
2137
- //Reload(lastConverter, lastFilename, true);
21382255 SnapObject();
21392256 } else
21402257 // if (event.getSource() == recompileButton)
....@@ -2510,9 +2627,9 @@
25102627 {
25112628 ClearSelection(true);
25122629 } else
2513
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
25142631 {
2515
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
25162633 } else
25172634 if (source == hideItem)
25182635 {
....@@ -2530,11 +2647,11 @@
25302647 {
25312648 makeSomething(new Camera());
25322649 } else
2533
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
25342651 {
25352652 group(new Composite());
25362653 } else
2537
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
25382655 {
25392656 RandomNode random = new RandomNode();
25402657 group(random);
....@@ -2636,7 +2753,7 @@
26362753 {
26372754 group(new cLinker());
26382755 } else
2639
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
26402757 {
26412758 group(new TextureNode());
26422759 } else
....@@ -2658,15 +2775,28 @@
26582775 } else
26592776 if (source == ungroupItem || source == ungroupButton)
26602777 {
2661
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
26622780 for (int i=0; i<group.selection.size(); i++)
26632781 {
2664
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
26652787 }
26662788
2667
- ClearSelection(false);
2668
-
2669
- 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
+ }
26702800 } else
26712801 if (source == genUVItem)
26722802 {
....@@ -3258,6 +3388,12 @@
32583388 } else
32593389 if (source == editItem || source == editButton)
32603390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
32613397 EditSelection(false);
32623398 } else
32633399 if (source == uneditButton)
....@@ -3267,6 +3403,7 @@
32673403 Object3D child = (Object3D)e.nextElement();
32683404 if(child.editWindow != null)
32693405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
32703407 child.CloseUI();
32713408 listUI.remove(child);
32723409
....@@ -3283,6 +3420,7 @@
32833420 //copy.ClearUI();
32843421 for (Object3D obj : listUI)
32853422 {
3423
+ obj.pinned = false;
32863424 obj.CloseUI();
32873425 }
32883426 listUI.clear();
....@@ -3292,7 +3430,7 @@
32923430 {
32933431 assert(copy == group);
32943432
3295
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32963434
32973435 for (Object3D obj : listUI)
32983436 {
....@@ -3367,6 +3505,11 @@
33673505 currentLayout = sevenButton;
33683506 */
33693507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
33703513 keepparent = group.parent;
33713514 // PARENT = NULL or not???
33723515 //group.parent = null; // ROOT
....@@ -3380,7 +3523,7 @@
33803523 cameraView.ProtectCamera();
33813524 cameraView.repaint();
33823525 return;
3383
- } else if (event.getSource() == revertCameraItem)
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33843527 {
33853528 cameraView.RevertCamera();
33863529 cameraView.repaint();
....@@ -4434,10 +4577,6 @@
44344577 // }
44354578 // }
44364579
4437
- static boolean allparams = true;
4438
-
4439
- static Vector<Object3D> listUI = new Vector<Object3D>();
4440
-
44414580 void EditSelection(boolean newWindow)
44424581 {
44434582 // aConstraints.gridy = 0;
....@@ -4530,7 +4669,8 @@
45304669 //new Exception().printStackTrace();
45314670
45324671 freezemodel = true;
4533
-
4672
+ ClearUnpinned();
4673
+
45344674 /**/
45354675 //switch (event.id)
45364676 {
....@@ -4563,7 +4703,7 @@
45634703 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
45644704 // a camera
45654705 {
4566
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
45674707 {
45684708 CameraPane.camerachangeframe = 0; // don't refuse it
45694709 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4572,6 +4712,13 @@
45724712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
45734713 }
45744714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
45754722 refreshContents();
45764723 //return true;
45774724 }
....@@ -4581,9 +4728,18 @@
45814728 freezemodel = false;
45824729 }
45834730
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
45844739 void refreshContents(boolean cp)
45854740 {
4586
- if (!Globals.MOUSEDRAGGED)
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45874743 {
45884744 objEditor.ClearInfo(); // .GetMaterial());
45894745
....@@ -4682,8 +4838,8 @@
46824838
46834839 if (cut)
46844840 {
4685
- if (Globals.SAVEONMAKE)
4686
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
46874843 //int indices[] = jList.getSelectedIndices();
46884844 //for (int i = indices.length - 1; i >= 0; i--)
46894845 //jList.remove(indices[i]);
....@@ -4786,6 +4942,10 @@
47864942
47874943 void paste(boolean expand)
47884944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
47894949 // if (GrafreeD.clipboard == null)
47904950 // return;
47914951 boolean first = true;
....@@ -4845,6 +5005,7 @@
48455005 Grafreed.clipboard.get(0).parent = keepparent;
48465006 }
48475007
5008
+ Globals.SAVEONMAKE = keep;
48485009 ResetModel();
48495010 refreshContents();
48505011 }
....@@ -4980,6 +5141,10 @@
49805141
49815142 void group(Object3D csg, boolean grab)
49825143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
49835148 if (//false) // why??
49845149 !group.selection.isEmpty())
49855150 {
....@@ -5093,10 +5258,15 @@
50935258 //node.add(csg);
50945259 //makeSomething(node);
50955260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
50965262 }
50975263
50985264 void Ungroup(Object3D g)
50995265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
51005270 if (g instanceof HiddenObject)
51015271 {
51025272 HiddenObject h = (HiddenObject) g;
....@@ -5113,6 +5283,7 @@
51135283 objEditor.makeSomething(g.get(i), false);
51145284 }
51155285 }
5286
+ Globals.SAVEONMAKE = keep;
51165287 }
51175288
51185289 void ungroup()
....@@ -5401,17 +5572,17 @@
54015572 cButton clearpanelButton;
54025573 cButton unselectButton;
54035574
5404
- cButton minButton;
5405
- cButton maxButton;
5406
- cButton fullButton;
5407
- cButton undoButton;
5408
- cButton redoButton;
5575
+ cButton restoreCameraButton;
5576
+
54095577 cButton saveButton;
54105578 cButton oneStepButton;
54115579
54125580 cButton groupButton;
54135581 cButton ungroupButton;
54145582 cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
54155586
54165587 cButton gridButton;
54175588 cButton boxButton;
....@@ -5444,7 +5615,7 @@
54445615 //JTree jTree;
54455616 private MenuItem lookAtItem;
54465617 private MenuItem lookFromItem;
5447
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
54485619 private MenuItem cutItem;
54495620 private MenuItem undoItem;
54505621 private MenuItem redoItem;
....@@ -5536,7 +5707,7 @@
55365707 private MenuItem frontItem;
55375708 private MenuItem cameraItem;
55385709 private MenuItem compositeItem;
5539
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
55405711 private MenuItem physicsItem;
55415712 private MenuItem frameselectorItem;
55425713 private MenuItem scriptNodeItem;
....@@ -5610,5 +5781,5 @@
56105781
56115782 Menu cameraMenu;
56125783 MenuItem editCameraItem;
5613
- MenuItem revertCameraItem;
5784
+ MenuItem restoreCameraItem;
56145785 }