Normand Briere
2019-06-30 cfd7a643cb5a445016ddb15595158ecc59b184fd
GroupEditor.java
....@@ -204,23 +204,23 @@
204204 //zBufferItem.addActionListener(this);
205205 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206206 //normalLensItem.addActionListener(this);
207
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
208
- revertCameraItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
209209
210
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
- toggleFullScreenItem.addItemListener(this);
212
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
- cameraMenu.add("-");
210
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
+// toggleFullScreenItem.addItemListener(this);
212
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
+// cameraMenu.add("-");
214
+//
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);
214222
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"));
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224224 toggleHandleItem.addItemListener(this);
225225 toggleHandleItem.setState(CameraPane.HANDLES);
226226
....@@ -275,7 +275,7 @@
275275 {
276276 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277277 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279279 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280280 oe.cameraMenu.add("-");
281281 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -283,7 +283,7 @@
283283 editLeafItem.addActionListener(this);
284284 lookAtItem.addActionListener(this);
285285 //lookFromItem.addActinoListener(this);
286
- //switchItem.addActionListener(this);
286
+ //switchViewItem.addActionListener(this);
287287 }
288288
289289 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -328,14 +328,14 @@
328328 }
329329
330330 oe.menuBar.add(menu = new Menu("Group"));
331
- grabItem = menu.add(new MenuItem("Grab"));
332
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
333333 backItem = menu.add(new MenuItem("Back"));
334334 backItem.addActionListener(this);
335335 frontItem = menu.add(new MenuItem("Front"));
336336 frontItem.addActionListener(this);
337
- compositeItem = menu.add(new MenuItem("Composite"));
338
- compositeItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339339
340340 if (Globals.ADVANCED)
341341 {
....@@ -345,10 +345,10 @@
345345 ungroupItem = menu.add(new MenuItem("Ungroup"));
346346 ungroupItem.addActionListener(this);
347347
348
- menu.add("-");
349
-
350
- randomItem = menu.add(new MenuItem("Switch node"));
351
- randomItem.addActionListener(this);
348
+// menu.add("-");
349
+//
350
+// switchItem = menu.add(new MenuItem("Switch node"));
351
+// switchItem.addActionListener(this);
352352 if (Globals.ADVANCED)
353353 {
354354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
....@@ -365,13 +365,11 @@
365365 frameselectorItem.addActionListener(this);
366366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
367367 scriptNodeItem.addActionListener(this);
368
- cameraItem = menu.add(new MenuItem("Camera"));
369
- cameraItem.addActionListener(this);
370368 }
371369
372370 oe.menuBar.add(menu = new Menu("Object"));
373
- textureItem = menu.add(new MenuItem("Texture"));
374
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
375373 billboardItem = menu.add(new MenuItem("Billboard"));
376374 billboardItem.addActionListener(this);
377375 csgItem = menu.add(new MenuItem("CSG"));
....@@ -582,53 +580,66 @@
582580 oe.radioPanel.add(dummyButton);
583581 oe.buttonGroup.add(dummyButton);
584582 */
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 1;
586
+
585587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
586588
587589 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588590 //minButton.setToolTipText("Minimize window");
589591 //minButton.addActionListener(this);
590592
591
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- maxButton.setToolTipText("Maximize window");
593
- maxButton.addActionListener(this);
593
+ if (Globals.ADVANCED)
594
+ {
595
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ maxButton.setToolTipText("Maximize window");
597
+ maxButton.addActionListener(this);
598
+ }
594599
595600 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596601 fullButton.setToolTipText("Full-screen window");
597602 fullButton.addActionListener(this);
598603
599
- oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
604
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605
+ restoreCameraButton.setToolTipText("Restore viewpoint");
606
+ restoreCameraButton.addActionListener(this);
607
+
608
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600609 undoButton.setToolTipText("Undo changes");
601610 undoButton.addActionListener(this);
611
+ undoButton.setEnabled(false);
602612
603
- oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
613
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
604614 redoButton.setToolTipText("Redo changes");
605615 redoButton.addActionListener(this);
616
+ redoButton.setEnabled(false);
606617
607
- oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608619 saveButton.setToolTipText("Save changes");
609620 saveButton.addActionListener(this);
610621
611
- oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
622
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
612623 liveCB.setToolTipText("Enable animation");
613624 liveCB.addItemListener(this);
614625
615
- oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616627 oneStepButton.setToolTipText("Animate one step forward");
617628 oneStepButton.addActionListener(this);
618629
619
- oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
630
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
620631 fastCB.setToolTipText("Fast mode");
621632 fastCB.addItemListener(this);
622633
623
- oe.toolboxPanel.Return();
634
+ //oe.toolboxPanel.Return();
624635
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);
636
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630637 screenfitButton.setToolTipText("Screen fit");
631638 screenfitButton.addActionListener(this);
639
+
640
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
641
+// trackCB.setToolTipText("Enable tracking");
642
+// trackCB.addItemListener(this);
632643
633644 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
634645 // screenfitpointButton.addActionListener(this);
....@@ -640,10 +651,6 @@
640651 snapobjectButton.setToolTipText("Snap Object");
641652 }
642653
643
- oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
- flashSelectionButton.setToolTipText("Highlight selection");
645
- flashSelectionButton.addActionListener(this);
646
-
647654 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
648655
649656 oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -688,8 +695,6 @@
688695 sphereButton.setToolTipText("Create sphere");
689696 sphereButton.addActionListener(this);
690697
691
- oe.toolboxPanel.Return();
692
-
693698 oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694699 coneButton.setToolTipText("Create cone");
695700 coneButton.addActionListener(this);
....@@ -713,6 +718,28 @@
713718 particlesButton.setToolTipText("Create particle system");
714719 particlesButton.addActionListener(this);
715720
721
+ oe.toolboxPanel.Return();
722
+
723
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ groupButton.setToolTipText("Create group");
725
+ groupButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ compositeButton.setToolTipText("Create composite");
729
+ compositeButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ switchButton.setToolTipText("Create item switcher");
733
+ switchButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ loopButton.setToolTipText("Create loop");
737
+ loopButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ textureButton.setToolTipText("Create texture");
741
+ textureButton.addActionListener(this);
742
+
716743 oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
717744 overlayButton.setToolTipText("Create overlay");
718745 overlayButton.addActionListener(this);
....@@ -721,17 +748,29 @@
721748 lightButton.setToolTipText("Create light");
722749 lightButton.addActionListener(this);
723750
751
+ for (int i=6; --i>=0;)
752
+ {
753
+ oe.toolboxPanel.Return();
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ oe.toolboxPanel.add(new cGridBag());
759
+ oe.toolboxPanel.add(new cGridBag());
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ }
762
+
724763 // EDIT panel
725
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
- editButton.setToolTipText("Edit selection");
764
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ editButton.setToolTipText("Pin selection controls");
727766 editButton.addActionListener(this);
728767
729
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
- uneditButton.setToolTipText("Unedit selection");
768
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ uneditButton.setToolTipText("Remove selection controls");
731770 uneditButton.addActionListener(this);
732771
733772 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
734
- allParamsButton.setToolTipText("Edit all params");
773
+ allParamsButton.setToolTipText("Show all controle");
735774 allParamsButton.addActionListener(this);
736775
737776 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -742,8 +781,13 @@
742781 unselectButton.setToolTipText("Unselect");
743782 unselectButton.addActionListener(this);
744783
784
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ flashSelectionButton.setToolTipText("Highlight selection");
786
+ flashSelectionButton.addActionListener(this);
787
+
745788 editCommandsPanel.preferredHeight = 1;
746789
790
+ SetPinStates(false);
747791 // oe.treePanel.add(commandsPanel);
748792 // oe.treePanel.Return();
749793
....@@ -768,21 +812,6 @@
768812 oe.treePanel.add(jSPPanel);
769813 oe.treePanel.Return();
770814
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;
786815 oe.treePanel.add(copyOptionsPanel);
787816 oe.treePanel.Return();
788817
....@@ -813,23 +842,43 @@
813842
814843 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
815844 {
845
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
846
+ colorCB.setToolTipText("Copy color when dropped");
847
+ colorCB.addItemListener(this);
848
+
849
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
850
+ materialCB.setToolTipText("Copy material when dropped");
851
+ materialCB.addItemListener(this);
852
+
853
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
854
+ textureCB.setToolTipText("Copy texture when dropped");
855
+ textureCB.addItemListener(this);
856
+
857
+ panel.Return();
858
+
816859 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
817860 boxCB.setToolTipText("Display bounding boxes");
818861 boxCB.addItemListener(this);
819862
820863 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
821
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
864
+ zoomBoxCB.setToolTipText("Display only for wheel");
822865 zoomBoxCB.addItemListener(this);
823866
824867 if (true) // Globals.ADVANCED)
825868 {
826
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
827
- supportCB.setToolTipText("Enable rigging");
828
- supportCB.addItemListener(this);
869
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
870
+// supportCB.setToolTipText("Enable rigging");
871
+// supportCB.addItemListener(this);
872
+
873
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
874
+ freezeCB.setToolTipText("Fast moving camera");
875
+ freezeCB.addItemListener(this);
829876
830877 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
831878 // localCB.addItemListener(this);
832879
880
+ panel.Return();
881
+
833882 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
834883 crowdCB.setToolTipText("Used for crowds");
835884 crowdCB.addItemListener(this);
....@@ -846,6 +895,8 @@
846895 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
847896 // speakerMocapCB.addItemListener(this);
848897
898
+ panel.Return();
899
+
849900 if (false)
850901 {
851902 // handled in scripts
....@@ -860,24 +911,39 @@
860911 //constraints.gridy += 1;
861912 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
862913 smoothfocusCB.addItemListener(this);
914
+ panel.Return();
863915 }
864916
865917 //constraints.gridx += 1;
866918 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
867919 // debugCB.addItemListener(this);
868920
921
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
922
+ trackCB.setToolTipText("Enable tracking target");
923
+ trackCB.addItemListener(this);
924
+
869925 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
- oeilCB.setToolTipText("Move camera when tracking target");
926
+ oeilCB.setToolTipText("Move camera when tracking");
871927 oeilCB.addItemListener(this);
872928
873929 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
- shadowCB.setToolTipText("Compute shadows when live");
930
+ shadowCB.setToolTipText("When live compute shadows");
875931 shadowCB.addItemListener(this);
876932
933
+ panel.Return();
934
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
935
+ toggleTextureCB.setToolTipText("Load textures");
936
+ toggleTextureCB.addItemListener(this);
937
+
938
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
939
+ toggleSwitchCB.setToolTipText("Choose a single item");
940
+ toggleSwitchCB.addItemListener(this);
941
+
877942 panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
- autosaveCB.setToolTipText("Auto-save on structure change");
943
+ autosaveCB.setToolTipText("On structure change");
879944 autosaveCB.addItemListener(this);
880945
946
+ panel.Return();
881947 if (Globals.ADVANCED)
882948 {
883949 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -888,10 +954,15 @@
888954 }
889955
890956 cGridBag fill = new cGridBag();
891
-
892957 fill.preferredHeight = 200;
958
+ cGridBag fill2 = new cGridBag();
959
+ fill2.preferredHeight = 200;
960
+ cGridBag fill3 = new cGridBag();
961
+ fill3.preferredHeight = 200;
893962
894963 panel.add(fill);
964
+ panel.add(fill2);
965
+ panel.add(fill3);
895966
896967 }
897968
....@@ -936,7 +1007,9 @@
9361007 cCheckBox slowCB;
9371008 cCheckBox boxCB;
9381009 cCheckBox zoomBoxCB;
939
- cToggleButton trackCB;
1010
+ cCheckBox freezeCB;
1011
+ //cToggleButton trackCB;
1012
+ cCheckBox trackCB;
9401013 cCheckBox smoothfocusCB;
9411014 // JCheckBox speakerMocapCB;
9421015 cCheckBox speakerCameraCB;
....@@ -1052,6 +1125,10 @@
10521125 else if(e.getSource() == shadowCB)
10531126 {
10541127 Globals.COMPUTESHADOWWHENLIVE ^= true;
1128
+ }
1129
+ else if(e.getSource() == freezeCB)
1130
+ {
1131
+ Globals.FREEZEONMOVE ^= true;
10551132 }
10561133 else if(e.getSource() == autosaveCB)
10571134 {
....@@ -1191,13 +1268,23 @@
11911268
11921269 assert target == objEditor.jTree;
11931270 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1271
+ Object3D destinationLeaf;
11941272 try {
1195
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1273
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11961274 } catch (Exception e) {
11971275 System.out.println("destinationPath : " + destinationPath);
11981276 return;
11991277 }
12001278
1279
+ for (int i=group.selection.size(); --i>=0;)
1280
+ {
1281
+ Object3D child = (Object3D)group.selection.elementAt(i);
1282
+
1283
+ // Cannot move into itself
1284
+ if (child == destinationLeaf)
1285
+ return;
1286
+ }
1287
+
12011288 // june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
12021289 // {
12031290 loadClipboard(true);
....@@ -1312,22 +1399,30 @@
13121399 {
13131400 //heightFieldItem = menu.add(new MenuItem("Height Field"));
13141401 //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);
1402
+// gridItem = menu.add(new MenuItem("Grid"));
1403
+// gridItem.addActionListener(this);
1404
+// rectoidItem = menu.add(new MenuItem("Box"));
1405
+// rectoidItem.addActionListener(this);
1406
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1407
+// ellipsoidItem.addActionListener(this);
1408
+// coneItem = menu.add(new MenuItem("Cone"));
1409
+// coneItem.addActionListener(this);
1410
+// torusItem = menu.add(new MenuItem("Torus"));
1411
+// torusItem.addActionListener(this);
1412
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1413
+// superItem.addActionListener(this);
1414
+
1415
+ cameraItem = menu.add(new MenuItem("Camera"));
1416
+ cameraItem.addActionListener(this);
1417
+
1418
+ if (!Globals.ADVANCED)
1419
+ {
13271420 kleinItem = menu.add(new MenuItem("Klein Bottle"));
13281421 kleinItem.addActionListener(this);
1329
- particleItem = menu.add(new MenuItem("Particle system"));
1330
- particleItem.addActionListener(this);
1422
+ }
1423
+
1424
+// particleItem = menu.add(new MenuItem("Particle system"));
1425
+// particleItem.addActionListener(this);
13311426 if (Globals.ADVANCED)
13321427 {
13331428 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1353,15 +1448,15 @@
13531448 }
13541449 bezierItem = menu.add(new MenuItem("Bezier Patch"));
13551450 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);
1451
+// overlayItem = menu.add(new MenuItem("Overlay"));
1452
+// overlayItem.addActionListener(this);
1453
+// lightItem = menu.add(new MenuItem("Light"));
1454
+// lightItem.addActionListener(this);
13601455 menu.add("-");
13611456 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13621457 //superLoopItem.addActionListener(this);
1363
- loopItem = menu.add(new MenuItem("Loop"));
1364
- loopItem.addActionListener(this);
1458
+// loopItem = menu.add(new MenuItem("Loop"));
1459
+// loopItem.addActionListener(this);
13651460 doubleItem = menu.add(new MenuItem("Fork"));
13661461 doubleItem.addActionListener(this);
13671462 if (Globals.ADVANCED)
....@@ -1546,6 +1641,20 @@
15461641
15471642 makeSomething(shadow);
15481643 }
1644
+
1645
+ private void ClearUnpinned()
1646
+ {
1647
+ //for (Object3D obj : listUI)
1648
+ for (int i=listUI.size(); --i>=0;)
1649
+ {
1650
+ Object3D obj = listUI.elementAt(i);
1651
+ if (!obj.pinned)
1652
+ {
1653
+ obj.CloseUI();
1654
+ listUI.remove(i);
1655
+ }
1656
+ }
1657
+ }
15491658
15501659 /**
15511660 * applyExample
....@@ -1790,7 +1899,7 @@
17901899 {
17911900 ScreenFit();
17921901 } else
1793
- if (source == switchItem)
1902
+ if (source == switchViewItem)
17941903 {
17951904 cVector v1 = new cVector();
17961905 cVector v2 = new cVector();
....@@ -2020,30 +2129,30 @@
20202129
20212130 group(g);
20222131 } else
2023
- if (source == loopItem)
2132
+ if (source == loopItem || source == loopButton)
20242133 {
20252134 Composite csg = new GroupLeaf();
20262135 csg.count = 5;
20272136 group(csg);
2028
- Composite child = new cGroup();
2137
+ Composite child = new cGroup("Branch");
20292138 csg.addChild(child);
20302139 child.addChild(csg);
20312140 } else
20322141 if (source == doubleItem)
20332142 {
2034
- Composite csg = new GroupLeaf();
2143
+ Composite csg = new GroupLeaf("Fork");
20352144 csg.count = 5;
20362145 group(csg);
2037
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch A");
20382147 csg.addChild(child);
20392148 child.addChild(csg);
2040
- child = new cGroup();
2149
+ child = new cGroup("Branch B");
20412150 csg.addChild(child);
20422151 child.addChild(csg);
20432152 } else
20442153 if (source == tripleItem)
20452154 {
2046
- Composite csg = new GroupLeaf();
2155
+ Composite csg = new GroupLeaf("Trident");
20472156 csg.count = 4;
20482157 group(csg);
20492158 Composite child = new cGroup();
....@@ -2510,9 +2619,9 @@
25102619 {
25112620 ClearSelection(true);
25122621 } else
2513
- if (source == grabItem)
2622
+ if (source == grabItem || source == groupButton)
25142623 {
2515
- group(new cGroup(), true);
2624
+ group(new cGroup(), false); // true);
25162625 } else
25172626 if (source == hideItem)
25182627 {
....@@ -2530,11 +2639,11 @@
25302639 {
25312640 makeSomething(new Camera());
25322641 } else
2533
- if (source == compositeItem)
2642
+ if (source == compositeItem || source == compositeButton)
25342643 {
25352644 group(new Composite());
25362645 } else
2537
- if (source == randomItem)
2646
+ if (source == switchItem || source == switchButton)
25382647 {
25392648 RandomNode random = new RandomNode();
25402649 group(random);
....@@ -2636,7 +2745,7 @@
26362745 {
26372746 group(new cLinker());
26382747 } else
2639
- if (source == textureItem)
2748
+ if (source == textureItem || source == textureButton)
26402749 {
26412750 group(new TextureNode());
26422751 } else
....@@ -2658,15 +2767,28 @@
26582767 } else
26592768 if (source == ungroupItem || source == ungroupButton)
26602769 {
2661
- //ungroup();
2770
+ boolean hasRoot = false;
2771
+
26622772 for (int i=0; i<group.selection.size(); i++)
26632773 {
2664
- Ungroup(group.selection.get(i));
2774
+ if (group.selection.get(i) == group)
2775
+ {
2776
+ hasRoot = true;
2777
+ break;
2778
+ }
26652779 }
26662780
2667
- ClearSelection(false);
2668
-
2669
- refreshContents();
2781
+ if (!hasRoot)
2782
+ {
2783
+ for (int i=0; i<group.selection.size(); i++)
2784
+ {
2785
+ Ungroup(group.selection.get(i));
2786
+ }
2787
+
2788
+ ClearSelection(false);
2789
+
2790
+ refreshContents();
2791
+ }
26702792 } else
26712793 if (source == genUVItem)
26722794 {
....@@ -3258,6 +3380,12 @@
32583380 } else
32593381 if (source == editItem || source == editButton)
32603382 {
3383
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3384
+ {
3385
+ Object3D child = (Object3D)e.nextElement();
3386
+ child.pinned = true;
3387
+ }
3388
+
32613389 EditSelection(false);
32623390 } else
32633391 if (source == uneditButton)
....@@ -3267,6 +3395,7 @@
32673395 Object3D child = (Object3D)e.nextElement();
32683396 if(child.editWindow != null)
32693397 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3398
+ child.pinned = false;
32703399 child.CloseUI();
32713400 listUI.remove(child);
32723401
....@@ -3283,6 +3412,7 @@
32833412 //copy.ClearUI();
32843413 for (Object3D obj : listUI)
32853414 {
3415
+ obj.pinned = false;
32863416 obj.CloseUI();
32873417 }
32883418 listUI.clear();
....@@ -3292,7 +3422,7 @@
32923422 {
32933423 assert(copy == group);
32943424
3295
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3425
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32963426
32973427 for (Object3D obj : listUI)
32983428 {
....@@ -3367,6 +3497,11 @@
33673497 currentLayout = sevenButton;
33683498 */
33693499 radio.layout.doClick();
3500
+
3501
+ ClearUnpinned();
3502
+ SetPinStates(group.selection.size() > 0);
3503
+ if (group.selection.size() == 1)
3504
+ EditSelection(false);
33703505 keepparent = group.parent;
33713506 // PARENT = NULL or not???
33723507 //group.parent = null; // ROOT
....@@ -3380,7 +3515,7 @@
33803515 cameraView.ProtectCamera();
33813516 cameraView.repaint();
33823517 return;
3383
- } else if (event.getSource() == revertCameraItem)
3518
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33843519 {
33853520 cameraView.RevertCamera();
33863521 cameraView.repaint();
....@@ -4434,10 +4569,6 @@
44344569 // }
44354570 // }
44364571
4437
- static boolean allparams = true;
4438
-
4439
- static Vector<Object3D> listUI = new Vector<Object3D>();
4440
-
44414572 void EditSelection(boolean newWindow)
44424573 {
44434574 // aConstraints.gridy = 0;
....@@ -4530,7 +4661,8 @@
45304661 //new Exception().printStackTrace();
45314662
45324663 freezemodel = true;
4533
-
4664
+ ClearUnpinned();
4665
+
45344666 /**/
45354667 //switch (event.id)
45364668 {
....@@ -4563,7 +4695,7 @@
45634695 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
45644696 // a camera
45654697 {
4566
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4698
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
45674699 {
45684700 CameraPane.camerachangeframe = 0; // don't refuse it
45694701 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4572,6 +4704,13 @@
45724704 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
45734705 }
45744706
4707
+ if (tps != null && tps.length == 1)
4708
+ {
4709
+ EditSelection(false);
4710
+ }
4711
+
4712
+ SetPinStates(tps != null && tps.length > 0);
4713
+
45754714 refreshContents();
45764715 //return true;
45774716 }
....@@ -4581,9 +4720,18 @@
45814720 freezemodel = false;
45824721 }
45834722
4723
+ void SetPinStates(boolean enabled)
4724
+ {
4725
+ editButton.setEnabled(enabled);
4726
+ uneditButton.setEnabled(enabled);
4727
+ unselectButton.setEnabled(enabled);
4728
+ flashSelectionButton.setEnabled(enabled);
4729
+ }
4730
+
45844731 void refreshContents(boolean cp)
45854732 {
4586
- if (!Globals.MOUSEDRAGGED)
4733
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4734
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
45874735 {
45884736 objEditor.ClearInfo(); // .GetMaterial());
45894737
....@@ -5401,17 +5549,17 @@
54015549 cButton clearpanelButton;
54025550 cButton unselectButton;
54035551
5404
- cButton minButton;
5405
- cButton maxButton;
5406
- cButton fullButton;
5407
- cButton undoButton;
5408
- cButton redoButton;
5552
+ cButton restoreCameraButton;
5553
+
54095554 cButton saveButton;
54105555 cButton oneStepButton;
54115556
54125557 cButton groupButton;
54135558 cButton ungroupButton;
54145559 cButton compositeButton;
5560
+ cButton switchButton;
5561
+ cButton loopButton;
5562
+ cButton textureButton;
54155563
54165564 cButton gridButton;
54175565 cButton boxButton;
....@@ -5444,7 +5592,7 @@
54445592 //JTree jTree;
54455593 private MenuItem lookAtItem;
54465594 private MenuItem lookFromItem;
5447
- private MenuItem switchItem;
5595
+ private MenuItem switchViewItem;
54485596 private MenuItem cutItem;
54495597 private MenuItem undoItem;
54505598 private MenuItem redoItem;
....@@ -5536,7 +5684,7 @@
55365684 private MenuItem frontItem;
55375685 private MenuItem cameraItem;
55385686 private MenuItem compositeItem;
5539
- private MenuItem randomItem;
5687
+ private MenuItem switchItem;
55405688 private MenuItem physicsItem;
55415689 private MenuItem frameselectorItem;
55425690 private MenuItem scriptNodeItem;
....@@ -5610,5 +5758,5 @@
56105758
56115759 Menu cameraMenu;
56125760 MenuItem editCameraItem;
5613
- MenuItem revertCameraItem;
5761
+ MenuItem restoreCameraItem;
56145762 }