Normand Briere
2019-07-23 cf7cfa1c792eebba606a48aa648893f6e4873263
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -80,6 +86,14 @@
8086 SetupViews(objEditor);
8187
8288 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8397 }
8498
8599 void CloneSelection(boolean supports)
....@@ -194,8 +208,8 @@
194208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
195209 // pasteExpandItem.addActionListener(this);
196210 menu.add("-");
197
- clearItem = menu.add(new MenuItem("Clear"));
198
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
199213
200214 if (Globals.ADVANCED)
201215 {
....@@ -421,7 +435,7 @@
421435 genNormalsMESHItem.addActionListener(this);
422436 if (Globals.ADVANCED)
423437 {
424
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
425439 genNormalsMINEItem.addActionListener(this);
426440 }
427441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -514,10 +528,15 @@
514528 attachBumpItem.addActionListener(this);
515529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
516530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
517532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
518533 detachPigmentItem.addActionListener(this);
519534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
520535 detachBumpItem.addActionListener(this);
536
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
537
+ embedTexturesItem.addActionListener(this);
538
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
539
+ deEmbedTexturesItem.addActionListener(this);
521540 menu.add("-");
522541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
523542 sortbysizeItem.addActionListener(this);
....@@ -673,27 +692,28 @@
673692
674693 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
675694
676
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
- twoButton.setToolTipText("Show center view only");
678
- twoButton.addActionListener(this);
679
- this.fullscreenLayout = twoButton;
680
-
681695 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682696 fourButton.addActionListener(this);
683697 fourButton.setToolTipText("Show left panel only");
698
+
699
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ twoButton.setToolTipText("Show right view only");
701
+ twoButton.addActionListener(this);
702
+ this.fullscreenLayout = twoButton;
703
+
684704 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
685
- sixButton.setToolTipText("2-column layout left");
705
+ sixButton.setToolTipText("Show left and right");
686706 sixButton.addActionListener(this);
687
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
- threeButton.setToolTipText("2-column layout right");
689
- threeButton.addActionListener(this);
690
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
691
- sevenButton.setToolTipText("3-column layout");
692
- sevenButton.addActionListener(this);
707
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+// threeButton.setToolTipText("2-column layout right");
709
+// threeButton.addActionListener(this);
710
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+// sevenButton.setToolTipText("3-column layout");
712
+// sevenButton.addActionListener(this);
693713 //
694714
695
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
- rootButton.setToolTipText("Edit selection in new tab");
715
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
716
+ rootButton.setToolTipText("Open selection in new tab");
697717 rootButton.addActionListener(this);
698718
699719 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -834,8 +854,8 @@
834854
835855 oe.treePanel.add(copyOptionsPanel);
836856 oe.treePanel.Return();
837
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
- versionField = (cNumberSlider)sliderPane.getComponent(1);
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
839859 sliderPane.preferredHeight = 1;
840860
841861 // mainPanel.setDividerLocation(0.5); //1.0);
....@@ -859,7 +879,7 @@
859879 dgr.addDragGestureListener(this);
860880 }catch(Exception e) {}
861881 */
862
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
863883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
864884 }
865885
....@@ -1001,7 +1021,7 @@
10011021 }
10021022
10031023 radioButton.SetObject(obj);
1004
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
10051025 radioButton.SetCamera(cameraView.renderCamera, false);
10061026 radioButton.addActionListener(this);
10071027 radioPanel.add(radioButton);
....@@ -1680,6 +1700,16 @@
16801700 listUI.remove(i);
16811701 }
16821702 }
1703
+ }
1704
+
1705
+ private void EditElement(Object3D elem, boolean newWindow)
1706
+ {
1707
+ // if (!(elem instanceof Composite))
1708
+ // newWindow = false;
1709
+ listUI.add(elem);
1710
+ elem.openEditWindow(this, newWindow); //, false);
1711
+ System.out.println("edit : " + elem);
1712
+ elem.editWindow.refreshContents(true); // ? new
16831713 }
16841714
16851715 /**
....@@ -2646,7 +2676,7 @@
26462676 {
26472677 StepAll();
26482678 } else
2649
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
26502680 {
26512681 //int indices[] = jList.getSelectedIndices();
26522682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -3128,7 +3158,7 @@
31283158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
31293159 {
31303160 obj = (Object3D)e.nextElement();
3131
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
31323162 }
31333163
31343164 refreshContents();
....@@ -3142,6 +3172,31 @@
31423172 obj.SetBumpTexture(obj.GetPigmentTexture());
31433173 }
31443174
3175
+ refreshContents();
3176
+ } else
3177
+ if (source == embedTexturesItem)
3178
+ {
3179
+ Object3D obj;
3180
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3181
+ {
3182
+ obj = (Object3D)e.nextElement();
3183
+ obj.EmbedTextures(true);
3184
+ }
3185
+
3186
+ refreshContents();
3187
+ } else
3188
+ if (source == deEmbedTexturesItem)
3189
+ {
3190
+ Object3D obj;
3191
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3192
+ {
3193
+ obj = (Object3D)e.nextElement();
3194
+ obj.EmbedTextures(false);
3195
+ }
3196
+
3197
+ CameraPane.texturepigment.clear();
3198
+ CameraPane.texturebump.clear();
3199
+
31453200 refreshContents();
31463201 } else
31473202 if (source == flashSelectionButton)
....@@ -3541,8 +3596,10 @@
35413596 radio.layout.doClick();
35423597
35433598 ClearUnpinned();
3544
- SetPinStates(group.selection.size() > 0);
3545
- if (group.selection.size() == 1)
3599
+ //Grafreed.Assert(group != null);
3600
+ //Grafreed.Assert(group.selection != null);
3601
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3602
+ if (group.selection == null || group.selection.size() == 1)
35463603 EditSelection(false);
35473604 keepparent = group.parent;
35483605 // PARENT = NULL or not???
....@@ -4136,7 +4193,7 @@
41364193
41374194 try
41384195 {
4139
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
41404197 }
41414198 catch (Exception e)
41424199 {
....@@ -4613,6 +4670,12 @@
46134670
46144671 void EditSelection(boolean newWindow)
46154672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
46164679 // aConstraints.gridy = 0;
46174680 for (int i=0; i<group.selection.size(); i++)
46184681 {
....@@ -4623,12 +4686,7 @@
46234686 Object3D elem = (Object3D)group.selection.elementAt(i);
46244687 if(elem != group || !newWindow)
46254688 {
4626
- // if (!(elem instanceof Composite))
4627
- // newWindow = false;
4628
- listUI.add(elem);
4629
- elem.openEditWindow(this, newWindow); //, false);
4630
- System.out.println("edit : " + elem);
4631
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
46324690 }
46334691 }
46344692 }
....@@ -4772,7 +4830,7 @@
47724830
47734831 void refreshContents(boolean cp)
47744832 {
4775
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4833
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
47764834 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47774835 {
47784836 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5681,7 +5739,7 @@
56815739 private MenuItem pasteLinkItem;
56825740 private MenuItem pasteCloneItem;
56835741 private MenuItem pasteExpandItem;
5684
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
56855743 private MenuItem clearAllItem;
56865744 private MenuItem genUVItem;
56875745 private MenuItem genNormalsMESHItem;
....@@ -5765,6 +5823,8 @@
57655823 private MenuItem attachBumpItem;
57665824 private MenuItem detachBumpItem;
57675825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
57685828
57695829 private MenuItem particleItem;
57705830 private MenuItem ragdollItem;