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 {
....@@ -871,6 +984,7 @@
871984 } else if(e.getSource() == liveCB)
872985 {
873986 cameraView.ToggleLive();
987
+ refreshContents(false);
874988 }
875989 else if(e.getSource() == supportCB)
876990 {
....@@ -935,6 +1049,14 @@
9351049 {
9361050 cameraView.ToggleOeil();
9371051 }
1052
+ else if(e.getSource() == shadowCB)
1053
+ {
1054
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1055
+ }
1056
+ else if(e.getSource() == autosaveCB)
1057
+ {
1058
+ Globals.SAVEONMAKE ^= true;
1059
+ }
9381060 else if(e.getSource() == lookAtCB)
9391061 {
9401062 cameraView.ToggleLookAt();
....@@ -951,7 +1073,8 @@
9511073
9521074 /**/
9531075 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
954
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1076
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1077
+ TreePath path = objEditor.jTree.getSelectionPath();
9551078 if ((path == null) || (path.getPathCount() <= 1)) {
9561079 // We can't move the root node or an empty selection
9571080 return;
....@@ -1075,16 +1198,16 @@
10751198 return;
10761199 }
10771200
1078
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1079
- {
1201
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1202
+// {
10801203 loadClipboard(true);
10811204 objEditor.jTree.setSelectionPath(destinationPath);
10821205 pasteInto(false, false);
1083
- } else {
1084
- loadClipboard(false);
1085
- objEditor.jTree.setSelectionPath(destinationPath);
1086
- pasteInto(false, false); // true); // ???
1087
- }
1206
+// } else {
1207
+// loadClipboard(false);
1208
+// objEditor.jTree.setSelectionPath(destinationPath);
1209
+// pasteInto(false, false); // true); // ???
1210
+// }
10881211 }
10891212 public void dropActionChanged(DropTargetDragEvent dtde)
10901213 // Called if the user has modified the current drop gesture
....@@ -1278,7 +1401,7 @@
12781401 memoryItem.addActionListener(this);
12791402 menu.add(analyzeItem = new MenuItem("Analyze"));
12801403 analyzeItem.addActionListener(this);
1281
- menu.add(dumpItem = new MenuItem("Dump"));
1404
+ menu.add(dumpItem = new MenuItem("Print"));
12821405 dumpItem.addActionListener(this);
12831406 // menu.add(pathItem = new MenuItem("From-to path"));
12841407 // pathItem.addActionListener(this);
....@@ -1419,6 +1542,7 @@
14191542 shadow.material = new cMaterial(obj.material);
14201543 shadow.material.diffuse = 0.0001f;
14211544 shadow.material.specular = 0.0001f;
1545
+ //shadow.projectedVertices[1].x = 300;
14221546
14231547 makeSomething(shadow);
14241548 }
....@@ -1675,11 +1799,11 @@
16751799 objEditor.cameraView.renderCamera.setAim(v2, v1);
16761800 objEditor.cameraView.repaint();
16771801 } else
1678
- if (source == rectoidItem)
1802
+ if (source == rectoidItem || source == boxButton)
16791803 {
16801804 makeSomething(new Box());
16811805 } else
1682
- if (source == particleItem)
1806
+ if (source == particleItem || source == particlesButton)
16831807 {
16841808 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16851809 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1758,27 +1882,27 @@
17581882
17591883 makeSomething(obj);
17601884 } else
1761
- if (source == gridItem)
1885
+ if (source == gridItem || source == gridButton)
17621886 {
17631887 makeSomething(new Grid());
17641888 } else
1765
- if (source == ellipsoidItem)
1889
+ if (source == ellipsoidItem || source == sphereButton)
17661890 {
17671891 makeSomething(new Sphere());
17681892 } else
1769
- if (source == coneItem)
1893
+ if (source == coneItem || source == coneButton)
17701894 {
17711895 makeSomething(new Cone());
17721896 } else
1773
- if (source == torusItem)
1897
+ if (source == torusItem || source == torusButton)
17741898 {
17751899 makeSomething(new Torus());
17761900 } else
1777
- if (source == superItem)
1901
+ if (source == superItem || source == superButton)
17781902 {
17791903 makeSomething(new Superellipsoid());
17801904 } else
1781
- if (source == kleinItem)
1905
+ if (source == kleinItem || source == kleinButton)
17821906 {
17831907 makeSomething(new Klein());
17841908 } else
....@@ -1798,7 +1922,7 @@
17981922 {
17991923 makeSomething(new BezierSurface());
18001924 } else
1801
- if (source == overlayItem)
1925
+ if (source == overlayItem || source == overlayButton)
18021926 {
18031927 /*
18041928 Object3D obj = new BezierSurface(5,8);
....@@ -1846,7 +1970,7 @@
18461970 s.setup();
18471971 makeSomething(s);
18481972 } else
1849
- if (source == lightItem)
1973
+ if (source == lightItem || source == lightButton)
18501974 {
18511975 makeSomething(new Light());
18521976 } else
....@@ -1968,6 +2092,18 @@
19682092 if (source == dumpItem)
19692093 {
19702094 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();
19712107 } else
19722108 if (source == undoButton)
19732109 {
....@@ -2520,7 +2656,7 @@
25202656 {
25212657 CastShadow(2);
25222658 } else
2523
- if (source == ungroupItem)
2659
+ if (source == ungroupItem || source == ungroupButton)
25242660 {
25252661 //ungroup();
25262662 for (int i=0; i<group.selection.size(); i++)
....@@ -2542,7 +2678,7 @@
25422678 } else
25432679 if (source == genNormalsMESHItem)
25442680 {
2545
- GenNormals(true); // TODO
2681
+ GenNormalsMESH();
25462682 } else
25472683 if (source == genNormalsORGANItem)
25482684 {
....@@ -2607,6 +2743,22 @@
26072743 if (source == unmarkleavesItem)
26082744 {
26092745 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);
26102762 } else
26112763 if (source == flipVItem)
26122764 {
....@@ -2842,6 +2994,10 @@
28422994 if (source == twoButton)
28432995 {
28442996 radio.layout = twoButton;
2997
+
2998
+ if (CameraPane.FULLSCREEN)
2999
+ fullscreenLayout = radio.layout;
3000
+
28453001 // bug
28463002 //gridPanel.setDividerLocation(1.0);
28473003 //bigPanel.setDividerLocation(0.0);
....@@ -2874,10 +3030,31 @@
28743030 bigThree.ClearUI();
28753031 bigThree.add(centralPanel);
28763032 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
+
28773051 } else
28783052 if (source == threeButton)
28793053 {
28803054 radio.layout = threeButton;
3055
+
3056
+ if (CameraPane.FULLSCREEN)
3057
+ fullscreenLayout = radio.layout;
28813058
28823059 // bigThree.remove(scenePanel);
28833060 // bigThree.remove(centralPanel);
....@@ -2910,10 +3087,15 @@
29103087 bigThree.add(centralPanel);
29113088 bigThree.add(XYZPanel);
29123089 bigThree.FlushUI();
3090
+
3091
+ cameraView.requestFocusInWindow();
29133092 } else
29143093 if (source == fourButton)
29153094 {
29163095 radio.layout = fourButton;
3096
+
3097
+ if (CameraPane.FULLSCREEN)
3098
+ fullscreenLayout = radio.layout;
29173099
29183100 // bigThree.remove(scenePanel);
29193101 // bigThree.remove(centralPanel);
....@@ -2945,10 +3127,15 @@
29453127 bigThree.ClearUI();
29463128 bigThree.add(scenePanel);
29473129 bigThree.FlushUI();
3130
+
3131
+ cameraView.requestFocusInWindow();
29483132 } else
29493133 if (source == sixButton)
29503134 {
29513135 radio.layout = sixButton;
3136
+
3137
+ if (CameraPane.FULLSCREEN)
3138
+ fullscreenLayout = radio.layout;
29523139
29533140 // bigThree.remove(scenePanel);
29543141 // bigThree.remove(centralPanel);
....@@ -2981,10 +3168,15 @@
29813168 bigThree.add(scenePanel);
29823169 bigThree.add(centralPanel);
29833170 bigThree.FlushUI();
3171
+
3172
+ cameraView.requestFocusInWindow();
29843173 } else
29853174 if (source == sevenButton)
29863175 {
29873176 radio.layout = sevenButton;
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
29883180
29893181 // bigThree.remove(scenePanel);
29903182 // bigThree.remove(centralPanel);
....@@ -3018,6 +3210,8 @@
30183210 bigThree.add(centralPanel);
30193211 bigThree.add(XYZPanel);
30203212 bigThree.FlushUI();
3213
+
3214
+ cameraView.requestFocusInWindow();
30213215 } else
30223216 if (source == rootButton)
30233217 {
....@@ -3029,6 +3223,7 @@
30293223 EditObject(obj);
30303224 }
30313225
3226
+ cameraView.requestFocusInWindow();
30323227 refreshContents(true);
30333228 } else
30343229 if (source == closeButton)
....@@ -3038,18 +3233,27 @@
30383233 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30393234 {
30403235 ab = (cRadio)e.nextElement();
3041
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3236
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30423237 {
3238
+ // Patch to avoid bug with transparency.
3239
+ if (!ab.hadMaterial)
3240
+ {
3241
+ ab.object.material = null;
3242
+ }
3243
+
30433244 buttonGroup.remove(ab);
30443245 radioPanel.remove(ab);
30453246
3046
- ab.GetObject().editWindow = null;
3247
+ //ab.GetObject().editWindow = null;
3248
+ ab.GetObject().manipWindow = null;
30473249 // ab.GetObject().objectUI = null; // ?????????
30483250
30493251 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30503252 break;
30513253 }
30523254 }
3255
+
3256
+ cameraView.requestFocusInWindow();
30533257 refreshContents(true);
30543258 } else
30553259 if (source == editItem || source == editButton)
....@@ -3154,7 +3358,8 @@
31543358 }
31553359
31563360 // fix "+" issue
3157
- group.editWindow = this;
3361
+ //group.editWindow = this;
3362
+ group.manipWindow = this;
31583363
31593364 /*
31603365 currentLayout = radio.layout;
....@@ -3167,6 +3372,8 @@
31673372 //group.parent = null; // ROOT
31683373 //group.attributes = -1;
31693374 ResetModel();
3375
+
3376
+ cameraView.requestFocusInWindow();
31703377 refreshContents(true);
31713378 } else if (event.getSource() == editCameraItem)
31723379 {
....@@ -3190,7 +3397,6 @@
31903397 }
31913398
31923399 boolean useclient = false;
3193
- cRadio radio;
31943400
31953401 void ToggleRoot()
31963402 {
....@@ -3429,7 +3635,8 @@
34293635
34303636 int size = obj.MemorySize();
34313637
3432
- 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)");
34333640 }
34343641 }
34353642 catch (Exception e)
....@@ -3510,6 +3717,13 @@
35103717 void GenNormals(boolean crease)
35113718 {
35123719 group.GenNormalsS(crease);
3720
+
3721
+ refreshContents();
3722
+ }
3723
+
3724
+ void GenNormalsMESH()
3725
+ {
3726
+ group.GenNormalsMeshS();
35133727
35143728 refreshContents();
35153729 }
....@@ -4137,6 +4351,18 @@
41374351 refreshContents();
41384352 }
41394353
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
+
41404366 void SetTexRes(int tr)
41414367 {
41424368 group.selection.SetTexRes(tr);
....@@ -4219,7 +4445,7 @@
42194445 {
42204446 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42214447 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4222
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4448
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42234449
42244450 Object3D elem = (Object3D)group.selection.elementAt(i);
42254451 if(elem != group || !newWindow)
....@@ -4312,7 +4538,6 @@
43124538 //case 702: // Event.LIST_DESELECT
43134539 group.deselectAll();
43144540 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4315
- objEditor.ClearInfo(); // .GetMaterial());
43164541 if (tps != null)
43174542 {
43184543 for (int i=0; i < tps.length; i++)
....@@ -4321,10 +4546,8 @@
43214546
43224547 //if (child.parent != null)
43234548 //child.parent.addSelectee(child);
4549
+ objEditor.SetMaterial(child);
43244550 group.addSelectee(child);
4325
- objEditor.SetMaterial(child); // .GetMaterial());
4326
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4327
- System.err.println("info : " + child.GetPath());
43284551 }
43294552 }
43304553 // else
....@@ -4334,8 +4557,6 @@
43344557 // System.err.println("info : " + group.GetPath());
43354558 // }
43364559
4337
- objEditor.SetText(); // jan 2014
4338
-
43394560 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43404561 CameraPane.flash = true;
43414562
....@@ -4359,6 +4580,26 @@
43594580
43604581 freezemodel = false;
43614582 }
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
+ }
43624603
43634604 void linkSomething(Object3D thing)
43644605 {
....@@ -4441,6 +4682,7 @@
44414682
44424683 if (cut)
44434684 {
4685
+ if (Globals.SAVEONMAKE)
44444686 Save();
44454687 //int indices[] = jList.getSelectedIndices();
44464688 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -5159,10 +5401,28 @@
51595401 cButton clearpanelButton;
51605402 cButton unselectButton;
51615403
5162
- cButton saveButton;
5404
+ cButton minButton;
5405
+ cButton maxButton;
5406
+ cButton fullButton;
51635407 cButton undoButton;
51645408 cButton redoButton;
5409
+ cButton saveButton;
51655410 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;
51665426
51675427 cButton screenfitButton;
51685428 cButton screenfitpointButton;
....@@ -5174,14 +5434,6 @@
51745434 cButton closeButton;
51755435
51765436 cButton setsupportButton;
5177
-
5178
- cButton twoButton;
5179
- cButton sixButton;
5180
- cButton threeButton;
5181
- cButton sevenButton;
5182
- cButton fourButton; // full panel
5183
- cButton oneButton; // full XYZ
5184
- //cButton currentLayout;
51855437
51865438 //
51875439 //Composite
....@@ -5196,7 +5448,7 @@
51965448 private MenuItem cutItem;
51975449 private MenuItem undoItem;
51985450 private MenuItem redoItem;
5199
- private MenuItem duplicateItem;
5451
+ private JMenuItem duplicateItem;
52005452 private MenuItem cloneItem;
52015453 private MenuItem cloneSupportItem;
52025454 private MenuItem overwriteGeoItem;
....@@ -5259,6 +5511,10 @@
52595511 private MenuItem showleavesItem;
52605512 private MenuItem markleavesItem;
52615513 private MenuItem unmarkleavesItem;
5514
+ private MenuItem rewindleavesItem;
5515
+ private MenuItem unrewindleavesItem;
5516
+ private MenuItem randomleavesItem;
5517
+ private MenuItem unrandomleavesItem;
52625518
52635519 private MenuItem flipVItem;
52645520 private MenuItem unflipVItem;