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,10 +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 {
126
+ if (Globals.REPLACEONMAKE)
127
+ Save();
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
87130 // Object3D keep = GrafreeD.clipboard;
88131 //Object3D obj;
89132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +137,7 @@
94137
95138 makeSomething(clone, i==group.selection.size()-1);
96139 }
140
+ Globals.REPLACEONMAKE = keep;
97141 }
98142
99143 void CloneClipboard(boolean supports)
....@@ -189,8 +233,8 @@
189233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190234 // pasteExpandItem.addActionListener(this);
191235 menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
194238
195239 if (Globals.ADVANCED)
196240 {
....@@ -380,13 +424,14 @@
380424 shadowYItem.addActionListener(this);
381425 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
383430 if (Globals.ADVANCED)
384431 {
385432 menu.add("-");
386433 linkerItem = menu.add(new MenuItem("Linker"));
387434 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390435 templateItem = menu.add(new MenuItem("Template"));
391436 templateItem.addActionListener(this);
392437 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -415,7 +460,7 @@
415460 genNormalsMESHItem.addActionListener(this);
416461 if (Globals.ADVANCED)
417462 {
418
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
419464 genNormalsMINEItem.addActionListener(this);
420465 }
421466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -508,10 +553,15 @@
508553 attachBumpItem.addActionListener(this);
509554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
510555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
511557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
512558 detachPigmentItem.addActionListener(this);
513559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
514560 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);
515565 menu.add("-");
516566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
517567 sortbysizeItem.addActionListener(this);
....@@ -538,6 +588,7 @@
538588 buildToolsMenu(menu);
539589 }
540590
591
+
541592 void SetupUI2(ObjEditor oe)
542593 {
543594 // June 2019
....@@ -582,7 +633,7 @@
582633 */
583634 cGridBag copyOptionsPanel = new cGridBag();
584635
585
- copyOptionsPanel.preferredHeight = 1;
636
+ copyOptionsPanel.preferredHeight = 2;
586637
587638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588639
....@@ -590,50 +641,66 @@
590641 //minButton.setToolTipText("Minimize window");
591642 //minButton.addActionListener(this);
592643
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
644
+ if (Globals.ADVANCED)
645
+ {
646
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ maxButton.setToolTipText("Maximize window");
648
+ maxButton.addActionListener(this);
649
+ }
596650
597651 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598652 fullButton.setToolTipText("Full-screen window");
599653 fullButton.addActionListener(this);
600654
655
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ screenfitButton.setToolTipText("Screen fit");
657
+ screenfitButton.addActionListener(this);
658
+
601659 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602660 restoreCameraButton.setToolTipText("Restore viewpoint");
603661 restoreCameraButton.addActionListener(this);
604662
663
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ saveButton.setToolTipText("New version");
665
+ saveButton.addActionListener(this);
666
+
605667 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
- undoButton.setToolTipText("Undo changes");
668
+ undoButton.setToolTipText("Previous version");
607669 undoButton.addActionListener(this);
608670 undoButton.setEnabled(false);
609671
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
+
610685 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
- redoButton.setToolTipText("Redo changes");
686
+ redoButton.setToolTipText("Next version");
612687 redoButton.addActionListener(this);
613688 redoButton.setEnabled(false);
614689
615
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
- saveButton.setToolTipText("Save changes");
617
- saveButton.addActionListener(this);
618
-
619
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
620691 liveCB.setToolTipText("Enable animation");
621692 liveCB.addItemListener(this);
622693
623
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624695 oneStepButton.setToolTipText("Animate one step forward");
625696 oneStepButton.addActionListener(this);
626697
627
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
628699 fastCB.setToolTipText("Fast mode");
629700 fastCB.addItemListener(this);
630701
631702 //oe.toolboxPanel.Return();
632703
633
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- screenfitButton.setToolTipText("Screen fit");
635
- screenfitButton.addActionListener(this);
636
-
637704 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638705 // trackCB.setToolTipText("Enable tracking");
639706 // trackCB.addItemListener(this);
....@@ -646,31 +713,32 @@
646713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647714 snapobjectButton.addActionListener(this);
648715 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");
649720 }
650721
651722 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
652723
653
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
- 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");
655726 twoButton.addActionListener(this);
656727 this.fullscreenLayout = twoButton;
657728
658
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
659
- fourButton.addActionListener(this);
660
- fourButton.setToolTipText("Show left panel only");
661
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
- sixButton.setToolTipText("2-column layout left");
663
- sixButton.addActionListener(this);
664
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
- 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");
666731 threeButton.addActionListener(this);
667
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
- sevenButton.setToolTipText("3-column layout");
669
- 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);
670738 //
671739
672
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
673
- 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");
674742 rootButton.addActionListener(this);
675743
676744 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -679,28 +747,30 @@
679747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
680748 //clearButton.addActionListener(this);
681749
750
+ cGridBag row1 = new cGridBag();
751
+
682752 // INSERT
683
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684754 gridButton.setToolTipText("Create grid");
685755 gridButton.addActionListener(this);
686756
687
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688758 boxButton.setToolTipText("Create box");
689759 boxButton.addActionListener(this);
690760
691
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
692762 sphereButton.setToolTipText("Create sphere");
693763 sphereButton.addActionListener(this);
694764
695
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696766 coneButton.setToolTipText("Create cone");
697767 coneButton.addActionListener(this);
698768
699
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700770 torusButton.setToolTipText("Create torus");
701771 torusButton.addActionListener(this);
702772
703
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704774 superButton.setToolTipText("Create superellipsoid");
705775 superButton.addActionListener(this);
706776
....@@ -711,50 +781,144 @@
711781 kleinButton.addActionListener(this);
712782 }
713783
714
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715785 particlesButton.setToolTipText("Create particle system");
716786 particlesButton.addActionListener(this);
717787
718
- oe.toolboxPanel.Return();
788
+ oe.toolboxPanel.add(row1);
719789
720
- 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);
721793 groupButton.setToolTipText("Create group");
722794 groupButton.addActionListener(this);
723795
724
- oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
796
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725797 compositeButton.setToolTipText("Create composite");
726798 compositeButton.addActionListener(this);
727799
728
- oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729801 switchButton.setToolTipText("Create item switcher");
730802 switchButton.addActionListener(this);
731803
732
- oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733805 loopButton.setToolTipText("Create loop");
734806 loopButton.addActionListener(this);
735807
736
- oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
808
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737809 textureButton.setToolTipText("Create texture");
738810 textureButton.addActionListener(this);
739811
740
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
812
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741813 overlayButton.setToolTipText("Create overlay");
742814 overlayButton.addActionListener(this);
743815
744
- 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);
745817 lightButton.setToolTipText("Create light");
746818 lightButton.addActionListener(this);
747819
748
- 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;)
749919 {
750
- oe.toolboxPanel.Return();
751
- oe.toolboxPanel.add(new cGridBag());
752
- oe.toolboxPanel.add(new cGridBag());
753
- oe.toolboxPanel.add(new cGridBag());
754
- oe.toolboxPanel.add(new cGridBag());
755
- oe.toolboxPanel.add(new cGridBag());
756
- oe.toolboxPanel.add(new cGridBag());
757
- oe.toolboxPanel.add(new cGridBag());
920
+ //oe.toolboxPanel.Return();
921
+ oe.toolboxPanel.add(new cGridBag());
758922 }
759923
760924 // EDIT panel
....@@ -811,9 +975,12 @@
811975
812976 oe.treePanel.add(copyOptionsPanel);
813977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
814981
815
-// mainPanel.setDividerLocation(0.5); //1.0);
816
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
817984
818985 //jList.addListSelectionListener(this);
819986 oe.jTree.addTreeSelectionListener(this);
....@@ -821,7 +988,7 @@
821988 //jTree.setEditable(true);
822989 oe.jTree.setDragEnabled(true);
823990 //jTree.setPreferredSize(new Dimension(10,10));
824
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
825992
826993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
827994
....@@ -833,7 +1000,7 @@
8331000 dgr.addDragGestureListener(this);
8341001 }catch(Exception e) {}
8351002 */
836
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
8371004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8381005 }
8391006
....@@ -936,9 +1103,9 @@
9361103 toggleSwitchCB.setToolTipText("Choose a single item");
9371104 toggleSwitchCB.addItemListener(this);
9381105
939
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
940
- autosaveCB.setToolTipText("On structure change");
941
- autosaveCB.addItemListener(this);
1106
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1107
+ autokeepCB.setToolTipText("On structure change");
1108
+ autokeepCB.addItemListener(this);
9421109
9431110 panel.Return();
9441111 if (Globals.ADVANCED)
....@@ -967,7 +1134,7 @@
9671134 {
9681135 cRadio radioButton = new cRadio(obj.name);
9691136
970
- // Patch to avoid bug with transparency.
1137
+ // June 2019. Patch to avoid bug with transparency.
9711138 radioButton.hadMaterial = obj.material != null;
9721139 if (!radioButton.hadMaterial)
9731140 {
....@@ -975,7 +1142,7 @@
9751142 }
9761143
9771144 radioButton.SetObject(obj);
978
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
9791146 radioButton.SetCamera(cameraView.renderCamera, false);
9801147 radioButton.addActionListener(this);
9811148 radioPanel.add(radioButton);
....@@ -1015,7 +1182,7 @@
10151182
10161183 cCheckBox oeilCB;
10171184 cCheckBox shadowCB;
1018
- cCheckBox autosaveCB;
1185
+ cCheckBox autokeepCB;
10191186 cCheckBox lookAtCB;
10201187
10211188 // static int COLOR = 1;
....@@ -1127,9 +1294,9 @@
11271294 {
11281295 Globals.FREEZEONMOVE ^= true;
11291296 }
1130
- else if(e.getSource() == autosaveCB)
1297
+ else if(e.getSource() == autokeepCB)
11311298 {
1132
- Globals.SAVEONMAKE ^= true;
1299
+ Globals.REPLACEONMAKE ^= true;
11331300 }
11341301 else if(e.getSource() == lookAtCB)
11351302 {
....@@ -1211,8 +1378,6 @@
12111378 }
12121379 }
12131380
1214
- String string = (String) object;
1215
-
12161381 System.out.println("Transfer = " + object + "; drop : " + target);
12171382 // if( object instanceof java.io.File[])
12181383 // {
....@@ -1220,6 +1385,8 @@
12201385 // objEditor.DropFile((java.io.File[]) object, true);
12211386 // return;
12221387 // }
1388
+
1389
+ String string = object.toString();
12231390
12241391 // File path for Mac and Windows
12251392 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1469,6 +1636,9 @@
14691636 animationItem.addItemListener(this);
14701637 animationItem.setState(Globals.ANIMATION);
14711638
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
1641
+
14721642 menu.add("-");
14731643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14741644 parseverticesItem.addActionListener(this);
....@@ -1481,6 +1651,8 @@
14811651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14821652 reduce34MorphItem.addActionListener(this);
14831653 menu.add("-");
1654
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1655
+ memoryItem.addActionListener(this);
14841656 menu.add(computeAOItem = new MenuItem("Compute AO"));
14851657 computeAOItem.addActionListener(this);
14861658
....@@ -1489,8 +1661,6 @@
14891661 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14901662 mirrorItem.addActionListener(this);
14911663 menu.add("-");
1492
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1493
- memoryItem.addActionListener(this);
14941664 menu.add(analyzeItem = new MenuItem("Analyze"));
14951665 analyzeItem.addActionListener(this);
14961666 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1651,6 +1821,16 @@
16511821 listUI.remove(i);
16521822 }
16531823 }
1824
+ }
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
16541834 }
16551835
16561836 /**
....@@ -2080,6 +2260,23 @@
20802260 {
20812261 makeSomething(new Light());
20822262 } 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
20832280 if (source == csgItem)
20842281 {
20852282 group(new CSG());
....@@ -2165,7 +2362,7 @@
21652362 if (source == computeAOItem)
21662363 {
21672364 Globals.drawMode = CameraPane.OCCLUSION;
2168
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
21692366 } else
21702367 if (source == recompileItem)
21712368 {
....@@ -2213,15 +2410,31 @@
22132410 } else
22142411 if (source == undoButton)
22152412 {
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
22162416 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();
22172427 } else
22182428 if (source == redoButton)
22192429 {
2430
+ // Go to next version
22202431 Redo();
22212432 } else
22222433 if (source == saveButton)
22232434 {
2224
- Save();
2435
+ // Save a new version
2436
+ if (!Save(true))
2437
+ java.awt.Toolkit.getDefaultToolkit().beep();
22252438 } else
22262439 if (source == oneStepButton)
22272440 {
....@@ -2230,17 +2443,14 @@
22302443 } else
22312444 if (source == screenfitButton)
22322445 {
2233
- //Reload(lastConverter, lastFilename, true);
22342446 ScreenFit();
22352447 } else
22362448 if (source == screenfitpointButton)
22372449 {
2238
- //Reload(lastConverter, lastFilename, true);
22392450 ScreenFitPoint();
22402451 } else
22412452 if (source == snapobjectButton)
22422453 {
2243
- //Reload(lastConverter, lastFilename, true);
22442454 SnapObject();
22452455 } else
22462456 // if (event.getSource() == recompileButton)
....@@ -2604,7 +2814,7 @@
26042814 {
26052815 StepAll();
26062816 } else
2607
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
26082818 {
26092819 //int indices[] = jList.getSelectedIndices();
26102820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -3086,7 +3296,7 @@
30863296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30873297 {
30883298 obj = (Object3D)e.nextElement();
3089
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
30903300 }
30913301
30923302 refreshContents();
....@@ -3100,6 +3310,31 @@
31003310 obj.SetBumpTexture(obj.GetPigmentTexture());
31013311 }
31023312
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
+
31033338 refreshContents();
31043339 } else
31053340 if (source == flashSelectionButton)
....@@ -3203,8 +3438,8 @@
32033438 // centralPanel.setVisible(true);
32043439 // XYZPanel.setVisible(true);
32053440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
32063442 bigThree.add(centralPanel);
3207
- bigThree.add(XYZPanel);
32083443 bigThree.FlushUI();
32093444
32103445 cameraView.requestFocusInWindow();
....@@ -3284,8 +3519,8 @@
32843519 // centralPanel.setVisible(true);
32853520 // XYZPanel.setVisible(false);
32863521 bigThree.ClearUI();
3287
- bigThree.add(scenePanel);
32883522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
32893524 bigThree.FlushUI();
32903525
32913526 cameraView.requestFocusInWindow();
....@@ -3468,6 +3703,9 @@
34683703 }
34693704
34703705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
34713709 //Globals.theRenderer.object = group;
34723710 if(!useclient)
34733711 {
....@@ -3496,8 +3734,10 @@
34963734 radio.layout.doClick();
34973735
34983736 ClearUnpinned();
3499
- SetPinStates(group.selection.size() > 0);
3500
- 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)
35013741 EditSelection(false);
35023742 keepparent = group.parent;
35033743 // PARENT = NULL or not???
....@@ -4091,7 +4331,7 @@
40914331
40924332 try
40934333 {
4094
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
40954335 }
40964336 catch (Exception e)
40974337 {
....@@ -4568,6 +4808,12 @@
45684808
45694809 void EditSelection(boolean newWindow)
45704810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
45714817 // aConstraints.gridy = 0;
45724818 for (int i=0; i<group.selection.size(); i++)
45734819 {
....@@ -4578,12 +4824,7 @@
45784824 Object3D elem = (Object3D)group.selection.elementAt(i);
45794825 if(elem != group || !newWindow)
45804826 {
4581
- // if (!(elem instanceof Composite))
4582
- // newWindow = false;
4583
- listUI.add(elem);
4584
- elem.openEditWindow(this, newWindow); //, false);
4585
- System.out.println("edit : " + elem);
4586
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
45874828 }
45884829 }
45894830 }
....@@ -4727,8 +4968,8 @@
47274968
47284969 void refreshContents(boolean cp)
47294970 {
4730
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4731
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4972
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47324973 {
47334974 objEditor.ClearInfo(); // .GetMaterial());
47344975
....@@ -4827,8 +5068,8 @@
48275068
48285069 if (cut)
48295070 {
4830
- if (Globals.SAVEONMAKE)
4831
- Save();
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
48325073 //int indices[] = jList.getSelectedIndices();
48335074 //for (int i = indices.length - 1; i >= 0; i--)
48345075 //jList.remove(indices[i]);
....@@ -4931,6 +5172,10 @@
49315172
49325173 void paste(boolean expand)
49335174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
49345179 // if (GrafreeD.clipboard == null)
49355180 // return;
49365181 boolean first = true;
....@@ -4990,6 +5235,7 @@
49905235 Grafreed.clipboard.get(0).parent = keepparent;
49915236 }
49925237
5238
+ Globals.REPLACEONMAKE = keep;
49935239 ResetModel();
49945240 refreshContents();
49955241 }
....@@ -5125,6 +5371,10 @@
51255371
51265372 void group(Object3D csg, boolean grab)
51275373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
51285378 if (//false) // why??
51295379 !group.selection.isEmpty())
51305380 {
....@@ -5238,10 +5488,15 @@
52385488 //node.add(csg);
52395489 //makeSomething(node);
52405490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
52415492 }
52425493
52435494 void Ungroup(Object3D g)
52445495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
52455500 if (g instanceof HiddenObject)
52465501 {
52475502 HiddenObject h = (HiddenObject) g;
....@@ -5258,6 +5513,7 @@
52585513 objEditor.makeSomething(g.get(i), false);
52595514 }
52605515 }
5516
+ Globals.REPLACEONMAKE = keep;
52615517 }
52625518
52635519 void ungroup()
....@@ -5558,6 +5814,22 @@
55585814 cButton loopButton;
55595815 cButton textureButton;
55605816
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
+
55615833 cButton gridButton;
55625834 cButton boxButton;
55635835 cButton sphereButton;
....@@ -5621,7 +5893,7 @@
56215893 private MenuItem pasteLinkItem;
56225894 private MenuItem pasteCloneItem;
56235895 private MenuItem pasteExpandItem;
5624
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
56255897 private MenuItem clearAllItem;
56265898 private MenuItem genUVItem;
56275899 private MenuItem genNormalsMESHItem;
....@@ -5705,6 +5977,8 @@
57055977 private MenuItem attachBumpItem;
57065978 private MenuItem detachBumpItem;
57075979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
57085982
57095983 private MenuItem particleItem;
57105984 private MenuItem ragdollItem;