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 {
....@@ -80,18 +105,20 @@
80105 this.copy = this.group = copy;
81106 //selectees = this.group.selectees;
82107
83
- if (copy.versions == null)
84
- {
85
- copy.versions = new byte[100][];
86
- copy.versionindex = -1;
87
- }
88
-
89108 SetupMenu2(this); //objEditor);
90109 SetupUI2(objEditor);
91110 objEditor.SetupUI(true);
92111 SetupViews(objEditor);
93112
94113 ((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
+ }
95122 }
96123
97124 void CloneSelection(boolean supports)
....@@ -526,10 +553,15 @@
526553 attachBumpItem.addActionListener(this);
527554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
528555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
529557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
530558 detachPigmentItem.addActionListener(this);
531559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
532560 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);
533565 menu.add("-");
534566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
535567 sortbysizeItem.addActionListener(this);
....@@ -601,7 +633,7 @@
601633 */
602634 cGridBag copyOptionsPanel = new cGridBag();
603635
604
- copyOptionsPanel.preferredHeight = 1;
636
+ copyOptionsPanel.preferredHeight = 2;
605637
606638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
607639
....@@ -681,25 +713,25 @@
681713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682714 snapobjectButton.addActionListener(this);
683715 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");
684720 }
685721
686722 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
687723
688
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
689
- fourButton.addActionListener(this);
690
- fourButton.setToolTipText("Show left panel only");
691
-
692
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
- twoButton.setToolTipText("Show right view only");
724
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ twoButton.setToolTipText("Show 3D view only");
694726 twoButton.addActionListener(this);
695727 this.fullscreenLayout = twoButton;
696728
697
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
- sixButton.setToolTipText("Show left and right");
729
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ threeButton.setToolTipText("Show controls and 3D view");
731
+ threeButton.addActionListener(this);
732
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ sixButton.setToolTipText("Show 3D view and controls");
699734 sixButton.addActionListener(this);
700
-// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
-// threeButton.setToolTipText("2-column layout right");
702
-// threeButton.addActionListener(this);
703735 // oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704736 // sevenButton.setToolTipText("3-column layout");
705737 // sevenButton.addActionListener(this);
....@@ -715,28 +747,30 @@
715747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
716748 //clearButton.addActionListener(this);
717749
750
+ cGridBag row1 = new cGridBag();
751
+
718752 // INSERT
719
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720754 gridButton.setToolTipText("Create grid");
721755 gridButton.addActionListener(this);
722756
723
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724758 boxButton.setToolTipText("Create box");
725759 boxButton.addActionListener(this);
726760
727
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728762 sphereButton.setToolTipText("Create sphere");
729763 sphereButton.addActionListener(this);
730764
731
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732766 coneButton.setToolTipText("Create cone");
733767 coneButton.addActionListener(this);
734768
735
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736770 torusButton.setToolTipText("Create torus");
737771 torusButton.addActionListener(this);
738772
739
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740774 superButton.setToolTipText("Create superellipsoid");
741775 superButton.addActionListener(this);
742776
....@@ -747,50 +781,144 @@
747781 kleinButton.addActionListener(this);
748782 }
749783
750
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751785 particlesButton.setToolTipText("Create particle system");
752786 particlesButton.addActionListener(this);
753787
754
- oe.toolboxPanel.Return();
788
+ oe.toolboxPanel.add(row1);
755789
756
- 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);
757793 groupButton.setToolTipText("Create group");
758794 groupButton.addActionListener(this);
759795
760
- oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
796
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761797 compositeButton.setToolTipText("Create composite");
762798 compositeButton.addActionListener(this);
763799
764
- oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765801 switchButton.setToolTipText("Create item switcher");
766802 switchButton.addActionListener(this);
767803
768
- oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769805 loopButton.setToolTipText("Create loop");
770806 loopButton.addActionListener(this);
771807
772
- oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
808
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773809 textureButton.setToolTipText("Create texture");
774810 textureButton.addActionListener(this);
775811
776
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
812
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777813 overlayButton.setToolTipText("Create overlay");
778814 overlayButton.addActionListener(this);
779815
780
- 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);
781817 lightButton.setToolTipText("Create light");
782818 lightButton.addActionListener(this);
783819
784
- 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;)
785919 {
786
- oe.toolboxPanel.Return();
787
- oe.toolboxPanel.add(new cGridBag());
788
- oe.toolboxPanel.add(new cGridBag());
789
- oe.toolboxPanel.add(new cGridBag());
790
- oe.toolboxPanel.add(new cGridBag());
791
- oe.toolboxPanel.add(new cGridBag());
792
- oe.toolboxPanel.add(new cGridBag());
793
- oe.toolboxPanel.add(new cGridBag());
920
+ //oe.toolboxPanel.Return();
921
+ oe.toolboxPanel.add(new cGridBag());
794922 }
795923
796924 // EDIT panel
....@@ -851,8 +979,8 @@
851979 versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852980 sliderPane.preferredHeight = 1;
853981
854
-// mainPanel.setDividerLocation(0.5); //1.0);
855
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
856984
857985 //jList.addListSelectionListener(this);
858986 oe.jTree.addTreeSelectionListener(this);
....@@ -860,7 +988,7 @@
860988 //jTree.setEditable(true);
861989 oe.jTree.setDragEnabled(true);
862990 //jTree.setPreferredSize(new Dimension(10,10));
863
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
864992
865993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
866994
....@@ -2132,6 +2260,23 @@
21322260 {
21332261 makeSomething(new Light());
21342262 } 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
21352280 if (source == csgItem)
21362281 {
21372282 group(new CSG());
....@@ -2217,7 +2362,7 @@
22172362 if (source == computeAOItem)
22182363 {
22192364 Globals.drawMode = CameraPane.OCCLUSION;
2220
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
22212366 } else
22222367 if (source == recompileItem)
22232368 {
....@@ -3151,7 +3296,7 @@
31513296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
31523297 {
31533298 obj = (Object3D)e.nextElement();
3154
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
31553300 }
31563301
31573302 refreshContents();
....@@ -3165,6 +3310,31 @@
31653310 obj.SetBumpTexture(obj.GetPigmentTexture());
31663311 }
31673312
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
+
31683338 refreshContents();
31693339 } else
31703340 if (source == flashSelectionButton)
....@@ -3268,8 +3438,8 @@
32683438 // centralPanel.setVisible(true);
32693439 // XYZPanel.setVisible(true);
32703440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
32713442 bigThree.add(centralPanel);
3272
- bigThree.add(XYZPanel);
32733443 bigThree.FlushUI();
32743444
32753445 cameraView.requestFocusInWindow();
....@@ -3349,8 +3519,8 @@
33493519 // centralPanel.setVisible(true);
33503520 // XYZPanel.setVisible(false);
33513521 bigThree.ClearUI();
3352
- bigThree.add(scenePanel);
33533522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
33543524 bigThree.FlushUI();
33553525
33563526 cameraView.requestFocusInWindow();
....@@ -4161,7 +4331,7 @@
41614331
41624332 try
41634333 {
4164
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
41654335 }
41664336 catch (Exception e)
41674337 {
....@@ -4798,7 +4968,7 @@
47984968
47994969 void refreshContents(boolean cp)
48004970 {
4801
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
48024972 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
48034973 {
48044974 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5644,6 +5814,22 @@
56445814 cButton loopButton;
56455815 cButton textureButton;
56465816
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
+
56475833 cButton gridButton;
56485834 cButton boxButton;
56495835 cButton sphereButton;
....@@ -5791,6 +5977,8 @@
57915977 private MenuItem attachBumpItem;
57925978 private MenuItem detachBumpItem;
57935979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
57945982
57955983 private MenuItem particleItem;
57965984 private MenuItem ragdollItem;