Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
GroupEditor.java
....@@ -150,11 +150,19 @@
150150
151151 void SetupMenu2(GroupEditor oe)
152152 {
153
+ oe.jTree = new cTree();
154
+
153155 Menu menu;
154156 oe.menuBar.add(menu = new Menu("Edit"));
155157 //editItem = menu.add(new MenuItem("Edit"));
156158 //editItem.addActionListener(this);
157
- duplicateItem = menu.add(new MenuItem("Duplicate"));
159
+
160
+// undoItem = menu.add(new MenuItem("Undo"));
161
+// undoItem.addActionListener(this);
162
+// redoItem = menu.add(new MenuItem("Redo"));
163
+// redoItem.addActionListener(this);
164
+// menu.add("-");
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
158166 duplicateItem.addActionListener(this);
159167 cloneItem = menu.add(new MenuItem("Clone"));
160168 cloneItem.addActionListener(this);
....@@ -170,7 +178,6 @@
170178 copyItem.addActionListener(this);
171179 pasteItem = menu.add(new MenuItem("Paste"));
172180 pasteItem.addActionListener(this);
173
- menu.add("-");
174181
175182 menu.add("-");
176183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,7 +204,7 @@
197204 //zBufferItem.addActionListener(this);
198205 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199206 //normalLensItem.addActionListener(this);
200
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
207
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
201208 revertCameraItem.addActionListener(this);
202209
203210 cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
....@@ -240,7 +247,7 @@
240247
241248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242249 toggleDebugItem.addItemListener(this);
243
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
244251
245252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246253 toggleFrustumItem.addItemListener(this);
....@@ -261,7 +268,7 @@
261268 // animationItem.addItemListener(this);
262269 // animationItem.setState(CameraPane.ANIMATION);
263270 cameraMenu.add("-");
264
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
265272 editCameraItem.addActionListener(this);
266273
267274 if (Globals.ADVANCED)
....@@ -329,13 +336,21 @@
329336 frontItem.addActionListener(this);
330337 compositeItem = menu.add(new MenuItem("Composite"));
331338 compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
332342 hideItem = menu.add(new MenuItem("Hidden Group"));
333343 hideItem.addActionListener(this);
344
+ }
334345 ungroupItem = menu.add(new MenuItem("Ungroup"));
335346 ungroupItem.addActionListener(this);
347
+
336348 menu.add("-");
349
+
337350 randomItem = menu.add(new MenuItem("Switch node"));
338351 randomItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
339354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
340355 switchGeoItem.addActionListener(this);
341356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -343,8 +358,6 @@
343358 morphItem = menu.add(new MenuItem("Morph Group"));
344359 morphItem.addActionListener(this);
345360
346
- if (Globals.ADVANCED)
347
- {
348361 menu.add("-");
349362 physicsItem = menu.add(new MenuItem("Physics"));
350363 physicsItem.addActionListener(this);
....@@ -363,11 +376,11 @@
363376 billboardItem.addActionListener(this);
364377 csgItem = menu.add(new MenuItem("CSG"));
365378 csgItem.addActionListener(this);
366
- shadowXItem = menu.add(new MenuItem("Shadow X"));
379
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
367380 shadowXItem.addActionListener(this);
368
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
381
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
369382 shadowYItem.addActionListener(this);
370
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
383
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
371384 shadowZItem.addActionListener(this);
372385 if (Globals.ADVANCED)
373386 {
....@@ -464,6 +477,14 @@
464477 markleavesItem.addActionListener(this);
465478 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
466479 unmarkleavesItem.addActionListener(this);
480
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
481
+ rewindleavesItem.addActionListener(this);
482
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
483
+ unrewindleavesItem.addActionListener(this);
484
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
485
+ randomleavesItem.addActionListener(this);
486
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
487
+ unrandomleavesItem.addActionListener(this);
467488 menu.add("-");
468489 flipVItem = menu.add(new MenuItem("Flip V"));
469490 flipVItem.addActionListener(this);
....@@ -521,6 +542,18 @@
521542
522543 void SetupUI2(ObjEditor oe)
523544 {
545
+ // June 2019
546
+ if (oe == null)
547
+ {
548
+ //super.SetupUI2(this);
549
+ //return;
550
+ }
551
+
552
+ if (copy != group)
553
+ {
554
+ //super.SetupUI2(this);
555
+ }
556
+
524557 //new Exception().printStackTrace();
525558
526559 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -551,23 +584,49 @@
551584 */
552585 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
553586
554
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
587
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ //minButton.setToolTipText("Minimize window");
589
+ //minButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ maxButton.setToolTipText("Maximize window");
593
+ maxButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ fullButton.setToolTipText("Full-screen window");
597
+ fullButton.addActionListener(this);
598
+
599
+ oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ undoButton.setToolTipText("Undo changes");
601
+ undoButton.addActionListener(this);
602
+
603
+ oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
604
+ redoButton.setToolTipText("Redo changes");
605
+ redoButton.addActionListener(this);
606
+
607
+ oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ saveButton.setToolTipText("Save changes");
609
+ saveButton.addActionListener(this);
610
+
611
+ oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
555612 liveCB.setToolTipText("Enable animation");
556613 liveCB.addItemListener(this);
557614
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559616 oneStepButton.setToolTipText("Animate one step forward");
560617 oneStepButton.addActionListener(this);
561618
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
619
+ oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
563620 fastCB.setToolTipText("Fast mode");
564621 fastCB.addItemListener(this);
565622
566
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
623
+ oe.toolboxPanel.Return();
624
+
625
+ oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
567626 trackCB.setToolTipText("Enable tracking");
568627 trackCB.addItemListener(this);
569628
570
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
571630 screenfitButton.setToolTipText("Screen fit");
572631 screenfitButton.addActionListener(this);
573632
....@@ -581,65 +640,112 @@
581640 snapobjectButton.setToolTipText("Snap Object");
582641 }
583642
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
643
+ oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ flashSelectionButton.setToolTipText("Highlight selection");
586645 flashSelectionButton.addActionListener(this);
587646
588
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
647
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
589648
590
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591650 twoButton.setToolTipText("Show center view only");
592651 twoButton.addActionListener(this);
593
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ this.fullscreenLayout = twoButton;
653
+
654
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594655 fourButton.addActionListener(this);
595656 fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597658 sixButton.setToolTipText("2-column layout left");
598659 sixButton.addActionListener(this);
599
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600661 threeButton.setToolTipText("2-column layout right");
601662 threeButton.addActionListener(this);
602
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603664 sevenButton.setToolTipText("3-column layout");
604665 sevenButton.addActionListener(this);
605666 //
606667
607
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608669 rootButton.setToolTipText("Edit selection in new tab");
609670 rootButton.addActionListener(this);
610671
611
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612673 closeButton.setToolTipText("Close tab");
613674 closeButton.addActionListener(this);
614675 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
615676 //clearButton.addActionListener(this);
616
-
617
- cGridBag commandsPanel = new cGridBag();
677
+
678
+ // INSERT
679
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680
+ gridButton.setToolTipText("Create grid");
681
+ gridButton.addActionListener(this);
682
+
683
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ boxButton.setToolTipText("Create box");
685
+ boxButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ sphereButton.setToolTipText("Create sphere");
689
+ sphereButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.Return();
618692
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ coneButton.setToolTipText("Create cone");
695
+ coneButton.addActionListener(this);
696
+
697
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ torusButton.setToolTipText("Create torus");
699
+ torusButton.addActionListener(this);
700
+
701
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702
+ superButton.setToolTipText("Create superellipsoid");
703
+ superButton.addActionListener(this);
704
+
705
+ if (Globals.ADVANCED)
706
+ {
707
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ kleinButton.setToolTipText("Create Klein bottle");
709
+ kleinButton.addActionListener(this);
710
+ }
711
+
712
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ particlesButton.setToolTipText("Create particle system");
714
+ particlesButton.addActionListener(this);
715
+
716
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
717
+ overlayButton.setToolTipText("Create overlay");
718
+ overlayButton.addActionListener(this);
719
+
720
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ lightButton.setToolTipText("Create light");
722
+ lightButton.addActionListener(this);
723
+
724
+ // EDIT panel
725
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620726 editButton.setToolTipText("Edit selection");
621727 editButton.addActionListener(this);
622728
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624730 uneditButton.setToolTipText("Unedit selection");
625731 uneditButton.addActionListener(this);
626732
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
733
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628734 allParamsButton.setToolTipText("Edit all params");
629735 allParamsButton.addActionListener(this);
630736
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632738 clearPanelButton.setToolTipText("Clear edit panel");
633739 clearPanelButton.addActionListener(this);
634740
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636742 unselectButton.setToolTipText("Unselect");
637743 unselectButton.addActionListener(this);
638744
639
- commandsPanel.preferredHeight = 1;
745
+ editCommandsPanel.preferredHeight = 1;
640746
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
747
+// oe.treePanel.add(commandsPanel);
748
+// oe.treePanel.Return();
643749
644750 // oe.aConstraints.gridx += 1;
645751 // oe.aConstraints.weighty = 0;
....@@ -656,7 +762,7 @@
656762
657763 JScrollPane jSP;
658764 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
765
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660766 ResetModel();
661767
662768 oe.treePanel.add(jSPPanel);
....@@ -761,11 +867,23 @@
761867 // debugCB.addItemListener(this);
762868
763869 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
+ oeilCB.setToolTipText("Move camera when tracking target");
764871 oeilCB.addItemListener(this);
765872
873
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
+ shadowCB.setToolTipText("Compute shadows when live");
875
+ shadowCB.addItemListener(this);
876
+
877
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
+ autosaveCB.setToolTipText("Auto-save on structure change");
879
+ autosaveCB.addItemListener(this);
880
+
881
+ if (Globals.ADVANCED)
882
+ {
766883 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767884 lookAtCB.setToolTipText("Look-at target");
768885 lookAtCB.addItemListener(this);
886
+ }
769887
770888 }
771889
....@@ -780,6 +898,14 @@
780898 void EditObject(Object3D obj)
781899 {
782900 cRadio radioButton = new cRadio(obj.name);
901
+
902
+ // Patch to avoid bug with transparency.
903
+ radioButton.hadMaterial = obj.material != null;
904
+ if (!radioButton.hadMaterial)
905
+ {
906
+ obj.material = new cMaterial();
907
+ }
908
+
783909 radioButton.SetObject(obj);
784910 radioButton.layout = sevenButton;
785911 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -791,6 +917,8 @@
791917
792918 void SetupViews(ObjEditor oe)
793919 {
920
+ theFrame = this;
921
+
794922 oe.SetupViews();
795923
796924 System.out.println("SetupViews");
....@@ -799,23 +927,26 @@
799927 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
800928 }
801929
802
- JCheckBox liveCB;
803
- JCheckBox supportCB;
804
- JCheckBox localCB;
805
- JCheckBox crowdCB;
806
- JCheckBox smoothCB;
807
- JCheckBox fastCB;
808
- JCheckBox slowCB;
809
- JCheckBox boxCB;
810
- JCheckBox zoomBoxCB;
811
- JCheckBox trackCB;
812
- JCheckBox smoothfocusCB;
930
+ cToggleButton liveCB;
931
+ cCheckBox supportCB;
932
+ cCheckBox localCB;
933
+ cCheckBox crowdCB;
934
+ cCheckBox smoothCB;
935
+ cToggleButton fastCB;
936
+ cCheckBox slowCB;
937
+ cCheckBox boxCB;
938
+ cCheckBox zoomBoxCB;
939
+ cToggleButton trackCB;
940
+ cCheckBox smoothfocusCB;
813941 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
942
+ cCheckBox speakerCameraCB;
943
+ cCheckBox speakerFocusCB;
944
+ cCheckBox debugCB;
945
+
946
+ cCheckBox oeilCB;
947
+ cCheckBox shadowCB;
948
+ cCheckBox autosaveCB;
949
+ cCheckBox lookAtCB;
819950
820951 // static int COLOR = 1;
821952 // static int MATERIAL = 2;
....@@ -823,9 +954,9 @@
823954
824955 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
825956
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
957
+ cCheckBox colorCB;
958
+ cCheckBox materialCB;
959
+ cCheckBox textureCB;
829960
830961 public void itemStateChanged(ItemEvent e)
831962 {
....@@ -853,6 +984,7 @@
853984 } else if(e.getSource() == liveCB)
854985 {
855986 cameraView.ToggleLive();
987
+ refreshContents(false);
856988 }
857989 else if(e.getSource() == supportCB)
858990 {
....@@ -917,6 +1049,14 @@
9171049 {
9181050 cameraView.ToggleOeil();
9191051 }
1052
+ else if(e.getSource() == shadowCB)
1053
+ {
1054
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1055
+ }
1056
+ else if(e.getSource() == autosaveCB)
1057
+ {
1058
+ Globals.SAVEONMAKE ^= true;
1059
+ }
9201060 else if(e.getSource() == lookAtCB)
9211061 {
9221062 cameraView.ToggleLookAt();
....@@ -933,7 +1073,8 @@
9331073
9341074 /**/
9351075 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1076
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1077
+ TreePath path = objEditor.jTree.getSelectionPath();
9371078 if ((path == null) || (path.getPathCount() <= 1)) {
9381079 // We can't move the root node or an empty selection
9391080 return;
....@@ -1057,16 +1198,16 @@
10571198 return;
10581199 }
10591200
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1061
- {
1201
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1202
+// {
10621203 loadClipboard(true);
10631204 objEditor.jTree.setSelectionPath(destinationPath);
10641205 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1206
+// } else {
1207
+// loadClipboard(false);
1208
+// objEditor.jTree.setSelectionPath(destinationPath);
1209
+// pasteInto(false, false); // true); // ???
1210
+// }
10701211 }
10711212 public void dropActionChanged(DropTargetDragEvent dtde)
10721213 // Called if the user has modified the current drop gesture
....@@ -1260,7 +1401,7 @@
12601401 memoryItem.addActionListener(this);
12611402 menu.add(analyzeItem = new MenuItem("Analyze"));
12621403 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1404
+ menu.add(dumpItem = new MenuItem("Print"));
12641405 dumpItem.addActionListener(this);
12651406 // menu.add(pathItem = new MenuItem("From-to path"));
12661407 // pathItem.addActionListener(this);
....@@ -1401,6 +1542,7 @@
14011542 shadow.material = new cMaterial(obj.material);
14021543 shadow.material.diffuse = 0.0001f;
14031544 shadow.material.specular = 0.0001f;
1545
+ //shadow.projectedVertices[1].x = 300;
14041546
14051547 makeSomething(shadow);
14061548 }
....@@ -1657,11 +1799,11 @@
16571799 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581800 objEditor.cameraView.repaint();
16591801 } else
1660
- if (source == rectoidItem)
1802
+ if (source == rectoidItem || source == boxButton)
16611803 {
16621804 makeSomething(new Box());
16631805 } else
1664
- if (source == particleItem)
1806
+ if (source == particleItem || source == particlesButton)
16651807 {
16661808 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671809 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +1882,27 @@
17401882
17411883 makeSomething(obj);
17421884 } else
1743
- if (source == gridItem)
1885
+ if (source == gridItem || source == gridButton)
17441886 {
17451887 makeSomething(new Grid());
17461888 } else
1747
- if (source == ellipsoidItem)
1889
+ if (source == ellipsoidItem || source == sphereButton)
17481890 {
17491891 makeSomething(new Sphere());
17501892 } else
1751
- if (source == coneItem)
1893
+ if (source == coneItem || source == coneButton)
17521894 {
17531895 makeSomething(new Cone());
17541896 } else
1755
- if (source == torusItem)
1897
+ if (source == torusItem || source == torusButton)
17561898 {
17571899 makeSomething(new Torus());
17581900 } else
1759
- if (source == superItem)
1901
+ if (source == superItem || source == superButton)
17601902 {
17611903 makeSomething(new Superellipsoid());
17621904 } else
1763
- if (source == kleinItem)
1905
+ if (source == kleinItem || source == kleinButton)
17641906 {
17651907 makeSomething(new Klein());
17661908 } else
....@@ -1780,7 +1922,7 @@
17801922 {
17811923 makeSomething(new BezierSurface());
17821924 } else
1783
- if (source == overlayItem)
1925
+ if (source == overlayItem || source == overlayButton)
17841926 {
17851927 /*
17861928 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +1970,7 @@
18281970 s.setup();
18291971 makeSomething(s);
18301972 } else
1831
- if (source == lightItem)
1973
+ if (source == lightItem || source == lightButton)
18321974 {
18331975 makeSomething(new Light());
18341976 } else
....@@ -1951,6 +2093,30 @@
19512093 {
19522094 DumpObject();
19532095 } else
2096
+ if (source == minButton)
2097
+ {
2098
+ Minimize();
2099
+ } else
2100
+ if (source == maxButton)
2101
+ {
2102
+ Maximize();
2103
+ } else
2104
+ if (source == fullButton)
2105
+ {
2106
+ ToggleFullScreen();
2107
+ } else
2108
+ if (source == undoButton)
2109
+ {
2110
+ Undo();
2111
+ } else
2112
+ if (source == redoButton)
2113
+ {
2114
+ Redo();
2115
+ } else
2116
+ if (source == saveButton)
2117
+ {
2118
+ Save();
2119
+ } else
19542120 if (source == oneStepButton)
19552121 {
19562122 Globals.ONESTEP = true;
....@@ -2004,6 +2170,14 @@
20042170 if (source == cutItem || source == clearButton)
20052171 {
20062172 loadClipboard(true);
2173
+ } else
2174
+ if (source == undoItem)
2175
+ {
2176
+ Undo();
2177
+ } else
2178
+ if (source == redoItem)
2179
+ {
2180
+ Redo();
20072181 } else
20082182 if (source == duplicateItem)
20092183 {
....@@ -2482,7 +2656,7 @@
24822656 {
24832657 CastShadow(2);
24842658 } else
2485
- if (source == ungroupItem)
2659
+ if (source == ungroupItem || source == ungroupButton)
24862660 {
24872661 //ungroup();
24882662 for (int i=0; i<group.selection.size(); i++)
....@@ -2504,7 +2678,7 @@
25042678 } else
25052679 if (source == genNormalsMESHItem)
25062680 {
2507
- GenNormals(true); // TODO
2681
+ GenNormalsMESH();
25082682 } else
25092683 if (source == genNormalsORGANItem)
25102684 {
....@@ -2569,6 +2743,22 @@
25692743 if (source == unmarkleavesItem)
25702744 {
25712745 MarkLeaves(false);
2746
+ } else
2747
+ if (source == rewindleavesItem)
2748
+ {
2749
+ RewindLeaves(true);
2750
+ } else
2751
+ if (source == unrewindleavesItem)
2752
+ {
2753
+ RewindLeaves(false);
2754
+ } else
2755
+ if (source == randomleavesItem)
2756
+ {
2757
+ RandomLeaves(true);
2758
+ } else
2759
+ if (source == unrandomleavesItem)
2760
+ {
2761
+ RandomLeaves(false);
25722762 } else
25732763 if (source == flipVItem)
25742764 {
....@@ -2804,6 +2994,10 @@
28042994 if (source == twoButton)
28052995 {
28062996 radio.layout = twoButton;
2997
+
2998
+ if (CameraPane.FULLSCREEN)
2999
+ fullscreenLayout = radio.layout;
3000
+
28073001 // bug
28083002 //gridPanel.setDividerLocation(1.0);
28093003 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3030,31 @@
28363030 bigThree.ClearUI();
28373031 bigThree.add(centralPanel);
28383032 bigThree.FlushUI();
3033
+
3034
+ cameraView.requestFocusInWindow();
3035
+
3036
+// refreshContents(true);
3037
+//
3038
+// try
3039
+// {
3040
+// java.awt.Robot bot = new java.awt.Robot();
3041
+// int mask = InputEvent.BUTTON1_MASK;
3042
+// bot.mouseMove(100, 100);
3043
+// bot.mousePress(mask);
3044
+// bot.mouseRelease(mask);
3045
+// }
3046
+// catch (Exception e)
3047
+// {
3048
+//
3049
+// }
3050
+
28393051 } else
28403052 if (source == threeButton)
28413053 {
28423054 radio.layout = threeButton;
3055
+
3056
+ if (CameraPane.FULLSCREEN)
3057
+ fullscreenLayout = radio.layout;
28433058
28443059 // bigThree.remove(scenePanel);
28453060 // bigThree.remove(centralPanel);
....@@ -2872,10 +3087,15 @@
28723087 bigThree.add(centralPanel);
28733088 bigThree.add(XYZPanel);
28743089 bigThree.FlushUI();
3090
+
3091
+ cameraView.requestFocusInWindow();
28753092 } else
28763093 if (source == fourButton)
28773094 {
28783095 radio.layout = fourButton;
3096
+
3097
+ if (CameraPane.FULLSCREEN)
3098
+ fullscreenLayout = radio.layout;
28793099
28803100 // bigThree.remove(scenePanel);
28813101 // bigThree.remove(centralPanel);
....@@ -2907,10 +3127,15 @@
29073127 bigThree.ClearUI();
29083128 bigThree.add(scenePanel);
29093129 bigThree.FlushUI();
3130
+
3131
+ cameraView.requestFocusInWindow();
29103132 } else
29113133 if (source == sixButton)
29123134 {
29133135 radio.layout = sixButton;
3136
+
3137
+ if (CameraPane.FULLSCREEN)
3138
+ fullscreenLayout = radio.layout;
29143139
29153140 // bigThree.remove(scenePanel);
29163141 // bigThree.remove(centralPanel);
....@@ -2943,10 +3168,15 @@
29433168 bigThree.add(scenePanel);
29443169 bigThree.add(centralPanel);
29453170 bigThree.FlushUI();
3171
+
3172
+ cameraView.requestFocusInWindow();
29463173 } else
29473174 if (source == sevenButton)
29483175 {
29493176 radio.layout = sevenButton;
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
29503180
29513181 // bigThree.remove(scenePanel);
29523182 // bigThree.remove(centralPanel);
....@@ -2980,6 +3210,8 @@
29803210 bigThree.add(centralPanel);
29813211 bigThree.add(XYZPanel);
29823212 bigThree.FlushUI();
3213
+
3214
+ cameraView.requestFocusInWindow();
29833215 } else
29843216 if (source == rootButton)
29853217 {
....@@ -2991,6 +3223,7 @@
29913223 EditObject(obj);
29923224 }
29933225
3226
+ cameraView.requestFocusInWindow();
29943227 refreshContents(true);
29953228 } else
29963229 if (source == closeButton)
....@@ -3000,18 +3233,27 @@
30003233 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013234 {
30023235 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3236
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043237 {
3238
+ // Patch to avoid bug with transparency.
3239
+ if (!ab.hadMaterial)
3240
+ {
3241
+ ab.object.material = null;
3242
+ }
3243
+
30053244 buttonGroup.remove(ab);
30063245 radioPanel.remove(ab);
30073246
3008
- ab.GetObject().editWindow = null;
3247
+ //ab.GetObject().editWindow = null;
3248
+ ab.GetObject().manipWindow = null;
30093249 // ab.GetObject().objectUI = null; // ?????????
30103250
30113251 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123252 break;
30133253 }
30143254 }
3255
+
3256
+ cameraView.requestFocusInWindow();
30153257 refreshContents(true);
30163258 } else
30173259 if (source == editItem || source == editButton)
....@@ -3028,7 +3270,7 @@
30283270 child.CloseUI();
30293271 listUI.remove(child);
30303272
3031
- child.editWindow = null; // ???????????
3273
+ //child.editWindow = null; // ???????????
30323274 }
30333275 objEditor.ctrlPanel.FlushUI();
30343276 //objEditor.jTree.clearSelection();
....@@ -3115,7 +3357,9 @@
31153357 sideView.object = group;
31163358 }
31173359
3118
-// fix "+" issue group.editWindow = this;
3360
+// fix "+" issue
3361
+ //group.editWindow = this;
3362
+ group.manipWindow = this;
31193363
31203364 /*
31213365 currentLayout = radio.layout;
....@@ -3128,6 +3372,8 @@
31283372 //group.parent = null; // ROOT
31293373 //group.attributes = -1;
31303374 ResetModel();
3375
+
3376
+ cameraView.requestFocusInWindow();
31313377 refreshContents(true);
31323378 } else if (event.getSource() == editCameraItem)
31333379 {
....@@ -3151,7 +3397,6 @@
31513397 }
31523398
31533399 boolean useclient = false;
3154
- cRadio radio;
31553400
31563401 void ToggleRoot()
31573402 {
....@@ -3390,7 +3635,8 @@
33903635
33913636 int size = obj.MemorySize();
33923637
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3638
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3639
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943640 }
33953641 }
33963642 catch (Exception e)
....@@ -3471,6 +3717,13 @@
34713717 void GenNormals(boolean crease)
34723718 {
34733719 group.GenNormalsS(crease);
3720
+
3721
+ refreshContents();
3722
+ }
3723
+
3724
+ void GenNormalsMESH()
3725
+ {
3726
+ group.GenNormalsMeshS();
34743727
34753728 refreshContents();
34763729 }
....@@ -4098,6 +4351,18 @@
40984351 refreshContents();
40994352 }
41004353
4354
+ void RewindLeaves(boolean hide)
4355
+ {
4356
+ group.selection.RewindLeaves(hide);
4357
+ refreshContents();
4358
+ }
4359
+
4360
+ void RandomLeaves(boolean hide)
4361
+ {
4362
+ group.selection.RandomLeaves(hide);
4363
+ refreshContents();
4364
+ }
4365
+
41014366 void SetTexRes(int tr)
41024367 {
41034368 group.selection.SetTexRes(tr);
....@@ -4180,7 +4445,7 @@
41804445 {
41814446 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824447 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4448
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844449
41854450 Object3D elem = (Object3D)group.selection.elementAt(i);
41864451 if(elem != group || !newWindow)
....@@ -4273,7 +4538,6 @@
42734538 //case 702: // Event.LIST_DESELECT
42744539 group.deselectAll();
42754540 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774541 if (tps != null)
42784542 {
42794543 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4546,8 @@
42824546
42834547 //if (child.parent != null)
42844548 //child.parent.addSelectee(child);
4549
+ objEditor.SetMaterial(child);
42854550 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894551 }
42904552 }
42914553 // else
....@@ -4295,16 +4557,17 @@
42954557 // System.err.println("info : " + group.GetPath());
42964558 // }
42974559
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4560
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014561 CameraPane.flash = true;
43024562
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4563
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044564 // a camera
43054565 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4566
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4567
+ {
4568
+ CameraPane.camerachangeframe = 0; // don't refuse it
4569
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4570
+ }
43084571 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094572 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104573 }
....@@ -4317,6 +4580,26 @@
43174580
43184581 freezemodel = false;
43194582 }
4583
+
4584
+ void refreshContents(boolean cp)
4585
+ {
4586
+ if (!Globals.MOUSEDRAGGED)
4587
+ {
4588
+ objEditor.ClearInfo(); // .GetMaterial());
4589
+
4590
+ for (int i=0; i < group.selection.Size(); i++)
4591
+ {
4592
+ Object3D child = (Object3D) group.selection.get(i);
4593
+
4594
+ objEditor.AddInfo(child, this, true);
4595
+ System.err.println("info : " + child.GetPath());
4596
+ }
4597
+
4598
+ objEditor.SetText(); // jan 2014
4599
+ }
4600
+
4601
+ super.refreshContents(cp);
4602
+ }
43204603
43214604 void linkSomething(Object3D thing)
43224605 {
....@@ -4388,6 +4671,7 @@
43884671 {
43894672 if (group.selection.isEmpty())
43904673 return;
4674
+
43914675 Grafreed.clipboardIsTempGroup = false;
43924676 Composite tGroup = null;
43934677 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4682,8 @@
43984682
43994683 if (cut)
44004684 {
4685
+ if (Globals.SAVEONMAKE)
4686
+ Save();
44014687 //int indices[] = jList.getSelectedIndices();
44024688 //for (int i = indices.length - 1; i >= 0; i--)
44034689 //jList.remove(indices[i]);
....@@ -4487,8 +4773,10 @@
44874773 }
44884774
44894775 }
4776
+
44904777 if (Grafreed.clipboardIsTempGroup)
44914778 Grafreed.clipboard = tGroup;
4779
+
44924780 if (cut)
44934781 {
44944782 ResetModel();
....@@ -5113,7 +5401,28 @@
51135401 cButton clearpanelButton;
51145402 cButton unselectButton;
51155403
5404
+ cButton minButton;
5405
+ cButton maxButton;
5406
+ cButton fullButton;
5407
+ cButton undoButton;
5408
+ cButton redoButton;
5409
+ cButton saveButton;
51165410 cButton oneStepButton;
5411
+
5412
+ cButton groupButton;
5413
+ cButton ungroupButton;
5414
+ cButton compositeButton;
5415
+
5416
+ cButton gridButton;
5417
+ cButton boxButton;
5418
+ cButton sphereButton;
5419
+ cButton coneButton;
5420
+ cButton torusButton;
5421
+ cButton superButton;
5422
+ cButton kleinButton;
5423
+ cButton particlesButton;
5424
+ cButton overlayButton;
5425
+ cButton lightButton;
51175426
51185427 cButton screenfitButton;
51195428 cButton screenfitpointButton;
....@@ -5126,14 +5435,6 @@
51265435
51275436 cButton setsupportButton;
51285437
5129
- cButton twoButton;
5130
- cButton sixButton;
5131
- cButton threeButton;
5132
- cButton sevenButton;
5133
- cButton fourButton; // full panel
5134
- cButton oneButton; // full XYZ
5135
- //cButton currentLayout;
5136
-
51375438 //
51385439 //Composite
51395440 Object3D // to do !!
....@@ -5145,7 +5446,9 @@
51455446 private MenuItem lookFromItem;
51465447 private MenuItem switchItem;
51475448 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5449
+ private MenuItem undoItem;
5450
+ private MenuItem redoItem;
5451
+ private JMenuItem duplicateItem;
51495452 private MenuItem cloneItem;
51505453 private MenuItem cloneSupportItem;
51515454 private MenuItem overwriteGeoItem;
....@@ -5208,6 +5511,10 @@
52085511 private MenuItem showleavesItem;
52095512 private MenuItem markleavesItem;
52105513 private MenuItem unmarkleavesItem;
5514
+ private MenuItem rewindleavesItem;
5515
+ private MenuItem unrewindleavesItem;
5516
+ private MenuItem randomleavesItem;
5517
+ private MenuItem unrandomleavesItem;
52115518
52125519 private MenuItem flipVItem;
52135520 private MenuItem unflipVItem;