Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
GroupEditor.java
....@@ -150,6 +150,8 @@
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"));
....@@ -160,7 +162,7 @@
160162 // redoItem = menu.add(new MenuItem("Redo"));
161163 // redoItem.addActionListener(this);
162164 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164166 duplicateItem.addActionListener(this);
165167 cloneItem = menu.add(new MenuItem("Clone"));
166168 cloneItem.addActionListener(this);
....@@ -176,7 +178,6 @@
176178 copyItem.addActionListener(this);
177179 pasteItem = menu.add(new MenuItem("Paste"));
178180 pasteItem.addActionListener(this);
179
- menu.add("-");
180181
181182 menu.add("-");
182183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -246,7 +247,7 @@
246247
247248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248249 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
250251
251252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252253 toggleFrustumItem.addItemListener(this);
....@@ -335,13 +336,21 @@
335336 frontItem.addActionListener(this);
336337 compositeItem = menu.add(new MenuItem("Composite"));
337338 compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
338342 hideItem = menu.add(new MenuItem("Hidden Group"));
339343 hideItem.addActionListener(this);
344
+ }
340345 ungroupItem = menu.add(new MenuItem("Ungroup"));
341346 ungroupItem.addActionListener(this);
347
+
342348 menu.add("-");
349
+
343350 randomItem = menu.add(new MenuItem("Switch node"));
344351 randomItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
345354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346355 switchGeoItem.addActionListener(this);
347356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +358,6 @@
349358 morphItem = menu.add(new MenuItem("Morph Group"));
350359 morphItem.addActionListener(this);
351360
352
- if (Globals.ADVANCED)
353
- {
354361 menu.add("-");
355362 physicsItem = menu.add(new MenuItem("Physics"));
356363 physicsItem.addActionListener(this);
....@@ -369,11 +376,11 @@
369376 billboardItem.addActionListener(this);
370377 csgItem = menu.add(new MenuItem("CSG"));
371378 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
379
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373380 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
381
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375382 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
383
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377384 shadowZItem.addActionListener(this);
378385 if (Globals.ADVANCED)
379386 {
....@@ -470,6 +477,14 @@
470477 markleavesItem.addActionListener(this);
471478 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472479 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);
473488 menu.add("-");
474489 flipVItem = menu.add(new MenuItem("Flip V"));
475490 flipVItem.addActionListener(this);
....@@ -527,6 +542,18 @@
527542
528543 void SetupUI2(ObjEditor oe)
529544 {
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
+
530557 //new Exception().printStackTrace();
531558
532559 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -557,35 +584,49 @@
557584 */
558585 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559586
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, 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);
561600 undoButton.setToolTipText("Undo changes");
562601 undoButton.addActionListener(this);
563602
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565604 redoButton.setToolTipText("Redo changes");
566605 redoButton.addActionListener(this);
567606
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569608 saveButton.setToolTipText("Save changes");
570609 saveButton.addActionListener(this);
571610
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
611
+ oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
573612 liveCB.setToolTipText("Enable animation");
574613 liveCB.addItemListener(this);
575614
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577616 oneStepButton.setToolTipText("Animate one step forward");
578617 oneStepButton.addActionListener(this);
579618
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
619
+ oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581620 fastCB.setToolTipText("Fast mode");
582621 fastCB.addItemListener(this);
583622
584
- 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);
585626 trackCB.setToolTipText("Enable tracking");
586627 trackCB.addItemListener(this);
587628
588
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589630 screenfitButton.setToolTipText("Screen fit");
590631 screenfitButton.addActionListener(this);
591632
....@@ -599,65 +640,112 @@
599640 snapobjectButton.setToolTipText("Snap Object");
600641 }
601642
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
643
+ oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ flashSelectionButton.setToolTipText("Highlight selection");
604645 flashSelectionButton.addActionListener(this);
605646
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
647
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607648
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609650 twoButton.setToolTipText("Show center view only");
610651 twoButton.addActionListener(this);
611
- 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);
612655 fourButton.addActionListener(this);
613656 fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615658 sixButton.setToolTipText("2-column layout left");
616659 sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618661 threeButton.setToolTipText("2-column layout right");
619662 threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621664 sevenButton.setToolTipText("3-column layout");
622665 sevenButton.addActionListener(this);
623666 //
624667
625
- 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);
626669 rootButton.setToolTipText("Edit selection in new tab");
627670 rootButton.addActionListener(this);
628671
629
- 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);
630673 closeButton.setToolTipText("Close tab");
631674 closeButton.addActionListener(this);
632675 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633676 //clearButton.addActionListener(this);
634
-
635
- 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();
636692
637
- 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);
638726 editButton.setToolTipText("Edit selection");
639727 editButton.addActionListener(this);
640728
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642730 uneditButton.setToolTipText("Unedit selection");
643731 uneditButton.addActionListener(this);
644732
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
733
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646734 allParamsButton.setToolTipText("Edit all params");
647735 allParamsButton.addActionListener(this);
648736
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650738 clearPanelButton.setToolTipText("Clear edit panel");
651739 clearPanelButton.addActionListener(this);
652740
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654742 unselectButton.setToolTipText("Unselect");
655743 unselectButton.addActionListener(this);
656744
657
- commandsPanel.preferredHeight = 1;
745
+ editCommandsPanel.preferredHeight = 1;
658746
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
747
+// oe.treePanel.add(commandsPanel);
748
+// oe.treePanel.Return();
661749
662750 // oe.aConstraints.gridx += 1;
663751 // oe.aConstraints.weighty = 0;
....@@ -674,7 +762,7 @@
674762
675763 JScrollPane jSP;
676764 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
765
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678766 ResetModel();
679767
680768 oe.treePanel.add(jSPPanel);
....@@ -779,11 +867,23 @@
779867 // debugCB.addItemListener(this);
780868
781869 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
+ oeilCB.setToolTipText("Move camera when tracking target");
782871 oeilCB.addItemListener(this);
783872
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
+ {
784883 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
785884 lookAtCB.setToolTipText("Look-at target");
786885 lookAtCB.addItemListener(this);
886
+ }
787887
788888 }
789889
....@@ -798,6 +898,14 @@
798898 void EditObject(Object3D obj)
799899 {
800900 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
+
801909 radioButton.SetObject(obj);
802910 radioButton.layout = sevenButton;
803911 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -809,6 +917,8 @@
809917
810918 void SetupViews(ObjEditor oe)
811919 {
920
+ theFrame = this;
921
+
812922 oe.SetupViews();
813923
814924 System.out.println("SetupViews");
....@@ -817,23 +927,26 @@
817927 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
818928 }
819929
820
- JCheckBox liveCB;
821
- JCheckBox supportCB;
822
- JCheckBox localCB;
823
- JCheckBox crowdCB;
824
- JCheckBox smoothCB;
825
- JCheckBox fastCB;
826
- JCheckBox slowCB;
827
- JCheckBox boxCB;
828
- JCheckBox zoomBoxCB;
829
- JCheckBox trackCB;
830
- 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;
831941 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
942
+ cCheckBox speakerCameraCB;
943
+ cCheckBox speakerFocusCB;
944
+ cCheckBox debugCB;
945
+
946
+ cCheckBox oeilCB;
947
+ cCheckBox shadowCB;
948
+ cCheckBox autosaveCB;
949
+ cCheckBox lookAtCB;
837950
838951 // static int COLOR = 1;
839952 // static int MATERIAL = 2;
....@@ -841,9 +954,9 @@
841954
842955 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
843956
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
957
+ cCheckBox colorCB;
958
+ cCheckBox materialCB;
959
+ cCheckBox textureCB;
847960
848961 public void itemStateChanged(ItemEvent e)
849962 {
....@@ -936,6 +1049,14 @@
9361049 {
9371050 cameraView.ToggleOeil();
9381051 }
1052
+ else if(e.getSource() == shadowCB)
1053
+ {
1054
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1055
+ }
1056
+ else if(e.getSource() == autosaveCB)
1057
+ {
1058
+ Globals.SAVEONMAKE ^= true;
1059
+ }
9391060 else if(e.getSource() == lookAtCB)
9401061 {
9411062 cameraView.ToggleLookAt();
....@@ -952,7 +1073,8 @@
9521073
9531074 /**/
9541075 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
955
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1076
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1077
+ TreePath path = objEditor.jTree.getSelectionPath();
9561078 if ((path == null) || (path.getPathCount() <= 1)) {
9571079 // We can't move the root node or an empty selection
9581080 return;
....@@ -1076,16 +1198,16 @@
10761198 return;
10771199 }
10781200
1079
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1080
- {
1201
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1202
+// {
10811203 loadClipboard(true);
10821204 objEditor.jTree.setSelectionPath(destinationPath);
10831205 pasteInto(false, false);
1084
- } else {
1085
- loadClipboard(false);
1086
- objEditor.jTree.setSelectionPath(destinationPath);
1087
- pasteInto(false, false); // true); // ???
1088
- }
1206
+// } else {
1207
+// loadClipboard(false);
1208
+// objEditor.jTree.setSelectionPath(destinationPath);
1209
+// pasteInto(false, false); // true); // ???
1210
+// }
10891211 }
10901212 public void dropActionChanged(DropTargetDragEvent dtde)
10911213 // Called if the user has modified the current drop gesture
....@@ -1420,6 +1542,7 @@
14201542 shadow.material = new cMaterial(obj.material);
14211543 shadow.material.diffuse = 0.0001f;
14221544 shadow.material.specular = 0.0001f;
1545
+ //shadow.projectedVertices[1].x = 300;
14231546
14241547 makeSomething(shadow);
14251548 }
....@@ -1676,11 +1799,11 @@
16761799 objEditor.cameraView.renderCamera.setAim(v2, v1);
16771800 objEditor.cameraView.repaint();
16781801 } else
1679
- if (source == rectoidItem)
1802
+ if (source == rectoidItem || source == boxButton)
16801803 {
16811804 makeSomething(new Box());
16821805 } else
1683
- if (source == particleItem)
1806
+ if (source == particleItem || source == particlesButton)
16841807 {
16851808 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16861809 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1759,27 +1882,27 @@
17591882
17601883 makeSomething(obj);
17611884 } else
1762
- if (source == gridItem)
1885
+ if (source == gridItem || source == gridButton)
17631886 {
17641887 makeSomething(new Grid());
17651888 } else
1766
- if (source == ellipsoidItem)
1889
+ if (source == ellipsoidItem || source == sphereButton)
17671890 {
17681891 makeSomething(new Sphere());
17691892 } else
1770
- if (source == coneItem)
1893
+ if (source == coneItem || source == coneButton)
17711894 {
17721895 makeSomething(new Cone());
17731896 } else
1774
- if (source == torusItem)
1897
+ if (source == torusItem || source == torusButton)
17751898 {
17761899 makeSomething(new Torus());
17771900 } else
1778
- if (source == superItem)
1901
+ if (source == superItem || source == superButton)
17791902 {
17801903 makeSomething(new Superellipsoid());
17811904 } else
1782
- if (source == kleinItem)
1905
+ if (source == kleinItem || source == kleinButton)
17831906 {
17841907 makeSomething(new Klein());
17851908 } else
....@@ -1799,7 +1922,7 @@
17991922 {
18001923 makeSomething(new BezierSurface());
18011924 } else
1802
- if (source == overlayItem)
1925
+ if (source == overlayItem || source == overlayButton)
18031926 {
18041927 /*
18051928 Object3D obj = new BezierSurface(5,8);
....@@ -1847,7 +1970,7 @@
18471970 s.setup();
18481971 makeSomething(s);
18491972 } else
1850
- if (source == lightItem)
1973
+ if (source == lightItem || source == lightButton)
18511974 {
18521975 makeSomething(new Light());
18531976 } else
....@@ -1969,6 +2092,18 @@
19692092 if (source == dumpItem)
19702093 {
19712094 DumpObject();
2095
+ } 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();
19722107 } else
19732108 if (source == undoButton)
19742109 {
....@@ -2521,7 +2656,7 @@
25212656 {
25222657 CastShadow(2);
25232658 } else
2524
- if (source == ungroupItem)
2659
+ if (source == ungroupItem || source == ungroupButton)
25252660 {
25262661 //ungroup();
25272662 for (int i=0; i<group.selection.size(); i++)
....@@ -2608,6 +2743,22 @@
26082743 if (source == unmarkleavesItem)
26092744 {
26102745 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);
26112762 } else
26122763 if (source == flipVItem)
26132764 {
....@@ -2843,6 +2994,10 @@
28432994 if (source == twoButton)
28442995 {
28452996 radio.layout = twoButton;
2997
+
2998
+ if (CameraPane.FULLSCREEN)
2999
+ fullscreenLayout = radio.layout;
3000
+
28463001 // bug
28473002 //gridPanel.setDividerLocation(1.0);
28483003 //bigPanel.setDividerLocation(0.0);
....@@ -2875,10 +3030,31 @@
28753030 bigThree.ClearUI();
28763031 bigThree.add(centralPanel);
28773032 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
+
28783051 } else
28793052 if (source == threeButton)
28803053 {
28813054 radio.layout = threeButton;
3055
+
3056
+ if (CameraPane.FULLSCREEN)
3057
+ fullscreenLayout = radio.layout;
28823058
28833059 // bigThree.remove(scenePanel);
28843060 // bigThree.remove(centralPanel);
....@@ -2911,10 +3087,15 @@
29113087 bigThree.add(centralPanel);
29123088 bigThree.add(XYZPanel);
29133089 bigThree.FlushUI();
3090
+
3091
+ cameraView.requestFocusInWindow();
29143092 } else
29153093 if (source == fourButton)
29163094 {
29173095 radio.layout = fourButton;
3096
+
3097
+ if (CameraPane.FULLSCREEN)
3098
+ fullscreenLayout = radio.layout;
29183099
29193100 // bigThree.remove(scenePanel);
29203101 // bigThree.remove(centralPanel);
....@@ -2946,10 +3127,15 @@
29463127 bigThree.ClearUI();
29473128 bigThree.add(scenePanel);
29483129 bigThree.FlushUI();
3130
+
3131
+ cameraView.requestFocusInWindow();
29493132 } else
29503133 if (source == sixButton)
29513134 {
29523135 radio.layout = sixButton;
3136
+
3137
+ if (CameraPane.FULLSCREEN)
3138
+ fullscreenLayout = radio.layout;
29533139
29543140 // bigThree.remove(scenePanel);
29553141 // bigThree.remove(centralPanel);
....@@ -2982,10 +3168,15 @@
29823168 bigThree.add(scenePanel);
29833169 bigThree.add(centralPanel);
29843170 bigThree.FlushUI();
3171
+
3172
+ cameraView.requestFocusInWindow();
29853173 } else
29863174 if (source == sevenButton)
29873175 {
29883176 radio.layout = sevenButton;
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
29893180
29903181 // bigThree.remove(scenePanel);
29913182 // bigThree.remove(centralPanel);
....@@ -3019,6 +3210,8 @@
30193210 bigThree.add(centralPanel);
30203211 bigThree.add(XYZPanel);
30213212 bigThree.FlushUI();
3213
+
3214
+ cameraView.requestFocusInWindow();
30223215 } else
30233216 if (source == rootButton)
30243217 {
....@@ -3030,6 +3223,7 @@
30303223 EditObject(obj);
30313224 }
30323225
3226
+ cameraView.requestFocusInWindow();
30333227 refreshContents(true);
30343228 } else
30353229 if (source == closeButton)
....@@ -3039,18 +3233,27 @@
30393233 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30403234 {
30413235 ab = (cRadio)e.nextElement();
3042
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3236
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30433237 {
3238
+ // Patch to avoid bug with transparency.
3239
+ if (!ab.hadMaterial)
3240
+ {
3241
+ ab.object.material = null;
3242
+ }
3243
+
30443244 buttonGroup.remove(ab);
30453245 radioPanel.remove(ab);
30463246
3047
- ab.GetObject().editWindow = null;
3247
+ //ab.GetObject().editWindow = null;
3248
+ ab.GetObject().manipWindow = null;
30483249 // ab.GetObject().objectUI = null; // ?????????
30493250
30503251 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30513252 break;
30523253 }
30533254 }
3255
+
3256
+ cameraView.requestFocusInWindow();
30543257 refreshContents(true);
30553258 } else
30563259 if (source == editItem || source == editButton)
....@@ -3155,7 +3358,8 @@
31553358 }
31563359
31573360 // fix "+" issue
3158
- group.editWindow = this;
3361
+ //group.editWindow = this;
3362
+ group.manipWindow = this;
31593363
31603364 /*
31613365 currentLayout = radio.layout;
....@@ -3168,6 +3372,8 @@
31683372 //group.parent = null; // ROOT
31693373 //group.attributes = -1;
31703374 ResetModel();
3375
+
3376
+ cameraView.requestFocusInWindow();
31713377 refreshContents(true);
31723378 } else if (event.getSource() == editCameraItem)
31733379 {
....@@ -3191,7 +3397,6 @@
31913397 }
31923398
31933399 boolean useclient = false;
3194
- cRadio radio;
31953400
31963401 void ToggleRoot()
31973402 {
....@@ -4146,6 +4351,18 @@
41464351 refreshContents();
41474352 }
41484353
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
+
41494366 void SetTexRes(int tr)
41504367 {
41514368 group.selection.SetTexRes(tr);
....@@ -4228,7 +4445,7 @@
42284445 {
42294446 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42304447 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4231
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4448
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42324449
42334450 Object3D elem = (Object3D)group.selection.elementAt(i);
42344451 if(elem != group || !newWindow)
....@@ -4329,6 +4546,7 @@
43294546
43304547 //if (child.parent != null)
43314548 //child.parent.addSelectee(child);
4549
+ objEditor.SetMaterial(child);
43324550 group.addSelectee(child);
43334551 }
43344552 }
....@@ -4369,15 +4587,12 @@
43694587 {
43704588 objEditor.ClearInfo(); // .GetMaterial());
43714589
4372
- for (int i=0; i < group.selection.size(); i++)
4590
+ for (int i=0; i < group.selection.Size(); i++)
43734591 {
4374
- Object3D child = (Object3D) group.selection.reserve(i);
4592
+ Object3D child = (Object3D) group.selection.get(i);
43754593
4376
- objEditor.SetMaterial(child);
43774594 objEditor.AddInfo(child, this, true);
43784595 System.err.println("info : " + child.GetPath());
4379
-
4380
- group.selection.release(i);
43814596 }
43824597
43834598 objEditor.SetText(); // jan 2014
....@@ -4467,6 +4682,7 @@
44674682
44684683 if (cut)
44694684 {
4685
+ if (Globals.SAVEONMAKE)
44704686 Save();
44714687 //int indices[] = jList.getSelectedIndices();
44724688 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -5185,10 +5401,28 @@
51855401 cButton clearpanelButton;
51865402 cButton unselectButton;
51875403
5188
- cButton saveButton;
5404
+ cButton minButton;
5405
+ cButton maxButton;
5406
+ cButton fullButton;
51895407 cButton undoButton;
51905408 cButton redoButton;
5409
+ cButton saveButton;
51915410 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;
51925426
51935427 cButton screenfitButton;
51945428 cButton screenfitpointButton;
....@@ -5200,14 +5434,6 @@
52005434 cButton closeButton;
52015435
52025436 cButton setsupportButton;
5203
-
5204
- cButton twoButton;
5205
- cButton sixButton;
5206
- cButton threeButton;
5207
- cButton sevenButton;
5208
- cButton fourButton; // full panel
5209
- cButton oneButton; // full XYZ
5210
- //cButton currentLayout;
52115437
52125438 //
52135439 //Composite
....@@ -5222,7 +5448,7 @@
52225448 private MenuItem cutItem;
52235449 private MenuItem undoItem;
52245450 private MenuItem redoItem;
5225
- private MenuItem duplicateItem;
5451
+ private JMenuItem duplicateItem;
52265452 private MenuItem cloneItem;
52275453 private MenuItem cloneSupportItem;
52285454 private MenuItem overwriteGeoItem;
....@@ -5285,6 +5511,10 @@
52855511 private MenuItem showleavesItem;
52865512 private MenuItem markleavesItem;
52875513 private MenuItem unmarkleavesItem;
5514
+ private MenuItem rewindleavesItem;
5515
+ private MenuItem unrewindleavesItem;
5516
+ private MenuItem randomleavesItem;
5517
+ private MenuItem unrandomleavesItem;
52885518
52895519 private MenuItem flipVItem;
52905520 private MenuItem unflipVItem;