Normand Briere
2019-07-28 a434119e65146fe53d612c28e1ee7af532d1b70a
GroupEditor.java
....@@ -23,6 +23,31 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row3)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ skyboxButton.setToolTipText(s);
33
+ skyboxButton.addActionListener(new ActionListener()
34
+ {
35
+ @Override
36
+ public void actionPerformed(ActionEvent e)
37
+ {
38
+ ChangeSkybox(path);
39
+ }
40
+ });
41
+ }
42
+
43
+ public void ChangeSkybox(String name)
44
+ {
45
+ cameraView.envyoff = false;
46
+ cameraView.skyboxname = name;
47
+ cameraView.skyboxext = "jpg";
48
+ cameraView.repaint();
49
+ }
50
+
2651 //ObjEditor objEditor;
2752 public void closeUI2()
2853 {
....@@ -60,6 +85,12 @@
6085 this.copy = this.group = group;
6186 //selectees = this.group.selectees;
6287
88
+ if (copy.versions == null)
89
+ {
90
+ copy.versions = new byte[100][];
91
+ copy.versionindex = -1;
92
+ }
93
+
6394 if(ui)
6495 SetupUI(objEditor);
6596 }
....@@ -80,14 +111,22 @@
80111 SetupViews(objEditor);
81112
82113 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
114
+
115
+ if (copy.versions == null)
116
+ {
117
+ copy.versions = new byte[100][];
118
+ copy.versionindex = -1;
119
+
120
+ Save(true);
121
+ }
83122 }
84123
85124 void CloneSelection(boolean supports)
86125 {
87
- if (Globals.SAVEONMAKE)
126
+ if (Globals.REPLACEONMAKE)
88127 Save();
89
- boolean keep = Globals.SAVEONMAKE;
90
- Globals.SAVEONMAKE = false;
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
91130 // Object3D keep = GrafreeD.clipboard;
92131 //Object3D obj;
93132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -98,7 +137,7 @@
98137
99138 makeSomething(clone, i==group.selection.size()-1);
100139 }
101
- Globals.SAVEONMAKE = keep;
140
+ Globals.REPLACEONMAKE = keep;
102141 }
103142
104143 void CloneClipboard(boolean supports)
....@@ -194,8 +233,8 @@
194233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
195234 // pasteExpandItem.addActionListener(this);
196235 menu.add("-");
197
- clearItem = menu.add(new MenuItem("Clear"));
198
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
199238
200239 if (Globals.ADVANCED)
201240 {
....@@ -421,7 +460,7 @@
421460 genNormalsMESHItem.addActionListener(this);
422461 if (Globals.ADVANCED)
423462 {
424
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
425464 genNormalsMINEItem.addActionListener(this);
426465 }
427466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -514,10 +553,15 @@
514553 attachBumpItem.addActionListener(this);
515554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
516555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
517557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
518558 detachPigmentItem.addActionListener(this);
519559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
520560 detachBumpItem.addActionListener(this);
561
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
562
+ embedTexturesItem.addActionListener(this);
563
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
564
+ deEmbedTexturesItem.addActionListener(this);
521565 menu.add("-");
522566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
523567 sortbysizeItem.addActionListener(this);
....@@ -544,6 +588,7 @@
544588 buildToolsMenu(menu);
545589 }
546590
591
+
547592 void SetupUI2(ObjEditor oe)
548593 {
549594 // June 2019
....@@ -588,7 +633,7 @@
588633 */
589634 cGridBag copyOptionsPanel = new cGridBag();
590635
591
- copyOptionsPanel.preferredHeight = 1;
636
+ copyOptionsPanel.preferredHeight = 2;
592637
593638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
594639
....@@ -615,29 +660,42 @@
615660 restoreCameraButton.setToolTipText("Restore viewpoint");
616661 restoreCameraButton.addActionListener(this);
617662
663
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ saveButton.setToolTipText("New version");
665
+ saveButton.addActionListener(this);
666
+
618667 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
- undoButton.setToolTipText("Undo changes");
668
+ undoButton.setToolTipText("Previous version");
620669 undoButton.addActionListener(this);
621670 undoButton.setEnabled(false);
622671
672
+ cGridBag updown = new cGridBag().setVertical(true);
673
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ restoreButton.setToolTipText("Restore current");
675
+ restoreButton.addActionListener(this);
676
+ restoreButton.setEnabled(false);
677
+
678
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ replaceButton.setToolTipText("Replace current");
680
+ replaceButton.addActionListener(this);
681
+ replaceButton.setEnabled(false);
682
+
683
+ copyOptionsPanel.add(updown);
684
+
623685 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- redoButton.setToolTipText("Redo changes");
686
+ redoButton.setToolTipText("Next version");
625687 redoButton.addActionListener(this);
626688 redoButton.setEnabled(false);
627689
628
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- saveButton.setToolTipText("Save changes");
630
- saveButton.addActionListener(this);
631
-
632
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633691 liveCB.setToolTipText("Enable animation");
634692 liveCB.addItemListener(this);
635693
636
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637695 oneStepButton.setToolTipText("Animate one step forward");
638696 oneStepButton.addActionListener(this);
639697
640
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641699 fastCB.setToolTipText("Fast mode");
642700 fastCB.addItemListener(this);
643701
....@@ -655,31 +713,32 @@
655713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656714 snapobjectButton.addActionListener(this);
657715 snapobjectButton.setToolTipText("Snap Object");
716
+
717
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
718
+ fourButton.addActionListener(this);
719
+ fourButton.setToolTipText("Show control panel only");
658720 }
659721
660722 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
661723
662
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
- twoButton.setToolTipText("Show center view only");
724
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ twoButton.setToolTipText("Show 3D view only");
664726 twoButton.addActionListener(this);
665727 this.fullscreenLayout = twoButton;
666728
667
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
- fourButton.addActionListener(this);
669
- fourButton.setToolTipText("Show left panel only");
670
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- sixButton.setToolTipText("2-column layout left");
672
- sixButton.addActionListener(this);
673
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- threeButton.setToolTipText("2-column layout right");
729
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ threeButton.setToolTipText("Show controls and 3D view");
675731 threeButton.addActionListener(this);
676
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
- sevenButton.setToolTipText("3-column layout");
678
- sevenButton.addActionListener(this);
732
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ sixButton.setToolTipText("Show 3D view and controls");
734
+ sixButton.addActionListener(this);
735
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+// sevenButton.setToolTipText("3-column layout");
737
+// sevenButton.addActionListener(this);
679738 //
680739
681
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
- rootButton.setToolTipText("Edit selection in new tab");
740
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ rootButton.setToolTipText("Open selection in new tab");
683742 rootButton.addActionListener(this);
684743
685744 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -688,28 +747,30 @@
688747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
689748 //clearButton.addActionListener(this);
690749
750
+ cGridBag row1 = new cGridBag();
751
+
691752 // INSERT
692
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693754 gridButton.setToolTipText("Create grid");
694755 gridButton.addActionListener(this);
695756
696
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697758 boxButton.setToolTipText("Create box");
698759 boxButton.addActionListener(this);
699760
700
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701762 sphereButton.setToolTipText("Create sphere");
702763 sphereButton.addActionListener(this);
703764
704
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705766 coneButton.setToolTipText("Create cone");
706767 coneButton.addActionListener(this);
707768
708
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709770 torusButton.setToolTipText("Create torus");
710771 torusButton.addActionListener(this);
711772
712
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713774 superButton.setToolTipText("Create superellipsoid");
714775 superButton.addActionListener(this);
715776
....@@ -720,50 +781,144 @@
720781 kleinButton.addActionListener(this);
721782 }
722783
723
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724785 particlesButton.setToolTipText("Create particle system");
725786 particlesButton.addActionListener(this);
726787
727
- oe.toolboxPanel.Return();
788
+ oe.toolboxPanel.add(row1);
728789
729
- oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
790
+ cGridBag row2 = new cGridBag();
791
+
792
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730793 groupButton.setToolTipText("Create group");
731794 groupButton.addActionListener(this);
732795
733
- oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
796
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734797 compositeButton.setToolTipText("Create composite");
735798 compositeButton.addActionListener(this);
736799
737
- oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738801 switchButton.setToolTipText("Create item switcher");
739802 switchButton.addActionListener(this);
740803
741
- oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742805 loopButton.setToolTipText("Create loop");
743806 loopButton.addActionListener(this);
744807
745
- oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
808
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746809 textureButton.setToolTipText("Create texture");
747810 textureButton.addActionListener(this);
748811
749
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
812
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750813 overlayButton.setToolTipText("Create overlay");
751814 overlayButton.addActionListener(this);
752815
753
- oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
816
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754817 lightButton.setToolTipText("Create light");
755818 lightButton.addActionListener(this);
756819
757
- for (int i=6; --i>=0;)
820
+ oe.toolboxPanel.add(row2);
821
+
822
+ // ENVYMAPS
823
+ cGridBag row3 = new cGridBag();
824
+ row3.preferredHeight = 20;
825
+
826
+ AddSkyboxButton("default", "rgb", row3);
827
+ AddSkyboxButton("default", "cornell", row3);
828
+ AddSkyboxButton("default", "uffizi", row3);
829
+ AddSkyboxButton("default", "CloudyHills", row3);
830
+ AddSkyboxButton("default", "skycube", row3);
831
+
832
+ oe.toolboxPanel.add(row3);
833
+
834
+ cGridBag row4 = new cGridBag();
835
+ row4.preferredHeight = 20;
836
+
837
+ AddSkyboxButton("bridge", "Bridge2", row4);
838
+ AddSkyboxButton("urban", "GamlaStan2", row4);
839
+ AddSkyboxButton("urban", "Parliament", row4);
840
+ AddSkyboxButton("urban", "Roundabout", row4);
841
+
842
+ oe.toolboxPanel.add(row4);
843
+
844
+ cGridBag row5 = new cGridBag();
845
+ row5.preferredHeight = 20;
846
+
847
+ AddSkyboxButton("urban", "SaintLazarusChurch", row5);
848
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row5);
849
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row5);
850
+ AddSkyboxButton("urban", "UnionSquare", row5);
851
+
852
+ oe.toolboxPanel.add(row5);
853
+
854
+ cGridBag row6 = new cGridBag();
855
+ row6.preferredHeight = 20;
856
+
857
+ AddSkyboxButton("park", "BerzeliiPark", row6);
858
+ AddSkyboxButton("park", "Buddha", row6);
859
+ AddSkyboxButton("park", "CNTower2", row6);
860
+ //AddSkyboxButton("park", "Fatbursparken", row6);
861
+ AddSkyboxButton("park", "NiagaraFalls1", row6);
862
+
863
+ oe.toolboxPanel.add(row6);
864
+
865
+ cGridBag row7 = new cGridBag();
866
+ row7.preferredHeight = 20;
867
+
868
+ AddSkyboxButton("park", "NiagaraFalls3", row7);
869
+ AddSkyboxButton("park", "Park", row7);
870
+ //AddSkyboxButton("park", "Park2", row6);
871
+ //AddSkyboxButton("park", "Path", row6);
872
+ AddSkyboxButton("park", "Pond", row7);
873
+ AddSkyboxButton("park", "Skansen", row7);
874
+
875
+ oe.toolboxPanel.add(row7);
876
+
877
+ cGridBag row8 = new cGridBag();
878
+ row8.preferredHeight = 20;
879
+
880
+ AddSkyboxButton("park", "Skansen2", row8);
881
+ AddSkyboxButton("park", "Skansen3", row8);
882
+ AddSkyboxButton("park", "Skansen4", row8);
883
+ AddSkyboxButton("park", "Skansen5", row8);
884
+
885
+ oe.toolboxPanel.add(row8);
886
+
887
+ cGridBag row9 = new cGridBag();
888
+ row9.preferredHeight = 20;
889
+
890
+ AddSkyboxButton("park", "Stairs", row9);
891
+ //AddSkyboxButton("park", "Tantolunden", row6);
892
+ //AddSkyboxButton("park", "Tantolunden3", row6);
893
+ AddSkyboxButton("park", "Tantolunden4", row9);
894
+
895
+ oe.toolboxPanel.add(row9);
896
+/*
897
+BerzeliiPark
898
+Buddha
899
+CNTower2
900
+Fatbursparken
901
+NiagaraFalls1
902
+NiagaraFalls3
903
+Park
904
+Park2
905
+Path
906
+Pond
907
+Skansen
908
+Skansen2
909
+Skansen3
910
+Skansen4
911
+Skansen5
912
+Stairs
913
+Tantolunden
914
+Tantolunden3
915
+Tantolunden4
916
+ */
917
+
918
+ for (int i=1; --i>=0;)
758919 {
759
- oe.toolboxPanel.Return();
760
- oe.toolboxPanel.add(new cGridBag());
761
- oe.toolboxPanel.add(new cGridBag());
762
- oe.toolboxPanel.add(new cGridBag());
763
- oe.toolboxPanel.add(new cGridBag());
764
- oe.toolboxPanel.add(new cGridBag());
765
- oe.toolboxPanel.add(new cGridBag());
766
- oe.toolboxPanel.add(new cGridBag());
920
+ //oe.toolboxPanel.Return();
921
+ oe.toolboxPanel.add(new cGridBag());
767922 }
768923
769924 // EDIT panel
....@@ -820,9 +975,12 @@
820975
821976 oe.treePanel.add(copyOptionsPanel);
822977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
823981
824
-// mainPanel.setDividerLocation(0.5); //1.0);
825
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
826984
827985 //jList.addListSelectionListener(this);
828986 oe.jTree.addTreeSelectionListener(this);
....@@ -830,7 +988,7 @@
830988 //jTree.setEditable(true);
831989 oe.jTree.setDragEnabled(true);
832990 //jTree.setPreferredSize(new Dimension(10,10));
833
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
834992
835993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
836994
....@@ -842,7 +1000,7 @@
8421000 dgr.addDragGestureListener(this);
8431001 }catch(Exception e) {}
8441002 */
845
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
8461004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8471005 }
8481006
....@@ -945,9 +1103,9 @@
9451103 toggleSwitchCB.setToolTipText("Choose a single item");
9461104 toggleSwitchCB.addItemListener(this);
9471105
948
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
- autosaveCB.setToolTipText("On structure change");
950
- autosaveCB.addItemListener(this);
1106
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1107
+ autokeepCB.setToolTipText("On structure change");
1108
+ autokeepCB.addItemListener(this);
9511109
9521110 panel.Return();
9531111 if (Globals.ADVANCED)
....@@ -984,7 +1142,7 @@
9841142 }
9851143
9861144 radioButton.SetObject(obj);
987
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
9881146 radioButton.SetCamera(cameraView.renderCamera, false);
9891147 radioButton.addActionListener(this);
9901148 radioPanel.add(radioButton);
....@@ -1024,7 +1182,7 @@
10241182
10251183 cCheckBox oeilCB;
10261184 cCheckBox shadowCB;
1027
- cCheckBox autosaveCB;
1185
+ cCheckBox autokeepCB;
10281186 cCheckBox lookAtCB;
10291187
10301188 // static int COLOR = 1;
....@@ -1136,9 +1294,9 @@
11361294 {
11371295 Globals.FREEZEONMOVE ^= true;
11381296 }
1139
- else if(e.getSource() == autosaveCB)
1297
+ else if(e.getSource() == autokeepCB)
11401298 {
1141
- Globals.SAVEONMAKE ^= true;
1299
+ Globals.REPLACEONMAKE ^= true;
11421300 }
11431301 else if(e.getSource() == lookAtCB)
11441302 {
....@@ -1664,6 +1822,16 @@
16641822 }
16651823 }
16661824 }
1825
+
1826
+ private void EditElement(Object3D elem, boolean newWindow)
1827
+ {
1828
+ // if (!(elem instanceof Composite))
1829
+ // newWindow = false;
1830
+ listUI.add(elem);
1831
+ elem.openEditWindow(this, newWindow); //, false);
1832
+ System.out.println("edit : " + elem);
1833
+ elem.editWindow.refreshContents(true); // ? new
1834
+ }
16671835
16681836 /**
16691837 * applyExample
....@@ -2092,6 +2260,23 @@
20922260 {
20932261 makeSomething(new Light());
20942262 } else
2263
+// if (source == skybox1Button ||
2264
+// source == skybox2Button ||
2265
+// source == skybox3Button ||
2266
+// source == skybox4Button ||
2267
+// source == skybox5Button ||
2268
+// source == skybox6Button ||
2269
+// source == skybox7Button ||
2270
+// source == skybox11Button ||
2271
+// source == skybox12Button ||
2272
+// source == skybox13Button ||
2273
+// source == skybox14Button ||
2274
+// source == skybox15Button ||
2275
+// source == skybox16Button ||
2276
+// source == skybox17Button)
2277
+// {
2278
+// ChangeSkybox(source);
2279
+// } else
20952280 if (source == csgItem)
20962281 {
20972282 group(new CSG());
....@@ -2177,7 +2362,7 @@
21772362 if (source == computeAOItem)
21782363 {
21792364 Globals.drawMode = CameraPane.OCCLUSION;
2180
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
21812366 } else
21822367 if (source == recompileItem)
21832368 {
....@@ -2225,15 +2410,29 @@
22252410 } else
22262411 if (source == undoButton)
22272412 {
2228
- if (!Undo())
2229
- java.awt.Toolkit.getDefaultToolkit().beep();
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2416
+ Undo();
2417
+ } else
2418
+ if (source == restoreButton)
2419
+ {
2420
+ // Restore current version
2421
+ Restore();
2422
+ } else
2423
+ if (source == replaceButton)
2424
+ {
2425
+ // Overwrite current version
2426
+ Replace();
22302427 } else
22312428 if (source == redoButton)
22322429 {
2430
+ // Go to next version
22332431 Redo();
22342432 } else
22352433 if (source == saveButton)
22362434 {
2435
+ // Save a new version
22372436 if (!Save(true))
22382437 java.awt.Toolkit.getDefaultToolkit().beep();
22392438 } else
....@@ -2615,7 +2814,7 @@
26152814 {
26162815 StepAll();
26172816 } else
2618
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
26192818 {
26202819 //int indices[] = jList.getSelectedIndices();
26212820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -3097,7 +3296,7 @@
30973296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30983297 {
30993298 obj = (Object3D)e.nextElement();
3100
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
31013300 }
31023301
31033302 refreshContents();
....@@ -3111,6 +3310,31 @@
31113310 obj.SetBumpTexture(obj.GetPigmentTexture());
31123311 }
31133312
3313
+ refreshContents();
3314
+ } else
3315
+ if (source == embedTexturesItem)
3316
+ {
3317
+ Object3D obj;
3318
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3319
+ {
3320
+ obj = (Object3D)e.nextElement();
3321
+ obj.EmbedTextures(true);
3322
+ }
3323
+
3324
+ refreshContents();
3325
+ } else
3326
+ if (source == deEmbedTexturesItem)
3327
+ {
3328
+ Object3D obj;
3329
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3330
+ {
3331
+ obj = (Object3D)e.nextElement();
3332
+ obj.EmbedTextures(false);
3333
+ }
3334
+
3335
+ CameraPane.texturepigment.clear();
3336
+ CameraPane.texturebump.clear();
3337
+
31143338 refreshContents();
31153339 } else
31163340 if (source == flashSelectionButton)
....@@ -3214,8 +3438,8 @@
32143438 // centralPanel.setVisible(true);
32153439 // XYZPanel.setVisible(true);
32163440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
32173442 bigThree.add(centralPanel);
3218
- bigThree.add(XYZPanel);
32193443 bigThree.FlushUI();
32203444
32213445 cameraView.requestFocusInWindow();
....@@ -3295,8 +3519,8 @@
32953519 // centralPanel.setVisible(true);
32963520 // XYZPanel.setVisible(false);
32973521 bigThree.ClearUI();
3298
- bigThree.add(scenePanel);
32993522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
33003524 bigThree.FlushUI();
33013525
33023526 cameraView.requestFocusInWindow();
....@@ -3479,6 +3703,9 @@
34793703 }
34803704
34813705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
34823709 //Globals.theRenderer.object = group;
34833710 if(!useclient)
34843711 {
....@@ -3507,8 +3734,10 @@
35073734 radio.layout.doClick();
35083735
35093736 ClearUnpinned();
3510
- SetPinStates(group.selection.size() > 0);
3511
- if (group.selection.size() == 1)
3737
+ //Grafreed.Assert(group != null);
3738
+ //Grafreed.Assert(group.selection != null);
3739
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3740
+ if (group.selection == null || group.selection.size() == 1)
35123741 EditSelection(false);
35133742 keepparent = group.parent;
35143743 // PARENT = NULL or not???
....@@ -4102,7 +4331,7 @@
41024331
41034332 try
41044333 {
4105
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
41064335 }
41074336 catch (Exception e)
41084337 {
....@@ -4579,6 +4808,12 @@
45794808
45804809 void EditSelection(boolean newWindow)
45814810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
45824817 // aConstraints.gridy = 0;
45834818 for (int i=0; i<group.selection.size(); i++)
45844819 {
....@@ -4589,12 +4824,7 @@
45894824 Object3D elem = (Object3D)group.selection.elementAt(i);
45904825 if(elem != group || !newWindow)
45914826 {
4592
- // if (!(elem instanceof Composite))
4593
- // newWindow = false;
4594
- listUI.add(elem);
4595
- elem.openEditWindow(this, newWindow); //, false);
4596
- System.out.println("edit : " + elem);
4597
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
45984828 }
45994829 }
46004830 }
....@@ -4738,7 +4968,7 @@
47384968
47394969 void refreshContents(boolean cp)
47404970 {
4741
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
47424972 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47434973 {
47444974 objEditor.ClearInfo(); // .GetMaterial());
....@@ -4942,10 +5172,10 @@
49425172
49435173 void paste(boolean expand)
49445174 {
4945
- if (Globals.SAVEONMAKE)
5175
+ if (Globals.REPLACEONMAKE)
49465176 Save();
4947
- boolean keep = Globals.SAVEONMAKE;
4948
- Globals.SAVEONMAKE = false;
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
49495179 // if (GrafreeD.clipboard == null)
49505180 // return;
49515181 boolean first = true;
....@@ -5005,7 +5235,7 @@
50055235 Grafreed.clipboard.get(0).parent = keepparent;
50065236 }
50075237
5008
- Globals.SAVEONMAKE = keep;
5238
+ Globals.REPLACEONMAKE = keep;
50095239 ResetModel();
50105240 refreshContents();
50115241 }
....@@ -5141,10 +5371,10 @@
51415371
51425372 void group(Object3D csg, boolean grab)
51435373 {
5144
- if (Globals.SAVEONMAKE)
5374
+ if (Globals.REPLACEONMAKE)
51455375 Save();
5146
- boolean keep = Globals.SAVEONMAKE;
5147
- Globals.SAVEONMAKE = false;
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
51485378 if (//false) // why??
51495379 !group.selection.isEmpty())
51505380 {
....@@ -5258,15 +5488,15 @@
52585488 //node.add(csg);
52595489 //makeSomething(node);
52605490 makeSomething(csg);
5261
- Globals.SAVEONMAKE = keep;
5491
+ Globals.REPLACEONMAKE = keep;
52625492 }
52635493
52645494 void Ungroup(Object3D g)
52655495 {
5266
- if (Globals.SAVEONMAKE)
5496
+ if (Globals.REPLACEONMAKE)
52675497 Save();
5268
- boolean keep = Globals.SAVEONMAKE;
5269
- Globals.SAVEONMAKE = false;
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
52705500 if (g instanceof HiddenObject)
52715501 {
52725502 HiddenObject h = (HiddenObject) g;
....@@ -5283,7 +5513,7 @@
52835513 objEditor.makeSomething(g.get(i), false);
52845514 }
52855515 }
5286
- Globals.SAVEONMAKE = keep;
5516
+ Globals.REPLACEONMAKE = keep;
52875517 }
52885518
52895519 void ungroup()
....@@ -5584,6 +5814,22 @@
55845814 cButton loopButton;
55855815 cButton textureButton;
55865816
5817
+ cButton skybox1Button;
5818
+ cButton skybox2Button;
5819
+ cButton skybox3Button;
5820
+ cButton skybox4Button;
5821
+ cButton skybox5Button;
5822
+ cButton skybox6Button;
5823
+ cButton skybox7Button;
5824
+
5825
+ cButton skybox11Button;
5826
+ cButton skybox12Button;
5827
+ cButton skybox13Button;
5828
+ cButton skybox14Button;
5829
+ cButton skybox15Button;
5830
+ cButton skybox16Button;
5831
+ cButton skybox17Button;
5832
+
55875833 cButton gridButton;
55885834 cButton boxButton;
55895835 cButton sphereButton;
....@@ -5647,7 +5893,7 @@
56475893 private MenuItem pasteLinkItem;
56485894 private MenuItem pasteCloneItem;
56495895 private MenuItem pasteExpandItem;
5650
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
56515897 private MenuItem clearAllItem;
56525898 private MenuItem genUVItem;
56535899 private MenuItem genNormalsMESHItem;
....@@ -5731,6 +5977,8 @@
57315977 private MenuItem attachBumpItem;
57325978 private MenuItem detachBumpItem;
57335979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
57345982
57355983 private MenuItem particleItem;
57365984 private MenuItem ragdollItem;