Normand Briere
2019-07-25 f2b6a33fdf84a06b958f9cb9d667a2eff3063d8b
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,10 +86,22 @@
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)
86100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
87105 // Object3D keep = GrafreeD.clipboard;
88106 //Object3D obj;
89107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +112,7 @@
94112
95113 makeSomething(clone, i==group.selection.size()-1);
96114 }
115
+ Globals.REPLACEONMAKE = keep;
97116 }
98117
99118 void CloneClipboard(boolean supports)
....@@ -189,8 +208,8 @@
189208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190209 // pasteExpandItem.addActionListener(this);
191210 menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
194213
195214 if (Globals.ADVANCED)
196215 {
....@@ -220,7 +239,7 @@
220239 // toggleSwitchItem.addItemListener(this);
221240 // toggleSwitchItem.setState(CameraPane.SWITCH);
222241
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224243 toggleHandleItem.addItemListener(this);
225244 toggleHandleItem.setState(CameraPane.HANDLES);
226245
....@@ -380,13 +399,14 @@
380399 shadowYItem.addActionListener(this);
381400 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
383405 if (Globals.ADVANCED)
384406 {
385407 menu.add("-");
386408 linkerItem = menu.add(new MenuItem("Linker"));
387409 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390410 templateItem = menu.add(new MenuItem("Template"));
391411 templateItem.addActionListener(this);
392412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -415,7 +435,7 @@
415435 genNormalsMESHItem.addActionListener(this);
416436 if (Globals.ADVANCED)
417437 {
418
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
419439 genNormalsMINEItem.addActionListener(this);
420440 }
421441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -508,10 +528,15 @@
508528 attachBumpItem.addActionListener(this);
509529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
510530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
511532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
512533 detachPigmentItem.addActionListener(this);
513534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
514535 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);
515540 menu.add("-");
516541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
517542 sortbysizeItem.addActionListener(this);
....@@ -538,6 +563,7 @@
538563 buildToolsMenu(menu);
539564 }
540565
566
+
541567 void SetupUI2(ObjEditor oe)
542568 {
543569 // June 2019
....@@ -582,7 +608,7 @@
582608 */
583609 cGridBag copyOptionsPanel = new cGridBag();
584610
585
- copyOptionsPanel.preferredHeight = 2;
611
+ copyOptionsPanel.preferredHeight = 1;
586612
587613 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588614
....@@ -590,50 +616,66 @@
590616 //minButton.setToolTipText("Minimize window");
591617 //minButton.addActionListener(this);
592618
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
619
+ if (Globals.ADVANCED)
620
+ {
621
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ maxButton.setToolTipText("Maximize window");
623
+ maxButton.addActionListener(this);
624
+ }
596625
597626 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598627 fullButton.setToolTipText("Full-screen window");
599628 fullButton.addActionListener(this);
600629
630
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ screenfitButton.setToolTipText("Screen fit");
632
+ screenfitButton.addActionListener(this);
633
+
601634 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602635 restoreCameraButton.setToolTipText("Restore viewpoint");
603636 restoreCameraButton.addActionListener(this);
604637
638
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ saveButton.setToolTipText("New version");
640
+ saveButton.addActionListener(this);
641
+
605642 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
- undoButton.setToolTipText("Undo changes");
643
+ undoButton.setToolTipText("Previous version");
607644 undoButton.addActionListener(this);
608645 undoButton.setEnabled(false);
609646
647
+ cGridBag updown = new cGridBag().setVertical(true);
648
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ restoreButton.setToolTipText("Restore current");
650
+ restoreButton.addActionListener(this);
651
+ restoreButton.setEnabled(false);
652
+
653
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ replaceButton.setToolTipText("Replace current");
655
+ replaceButton.addActionListener(this);
656
+ replaceButton.setEnabled(false);
657
+
658
+ copyOptionsPanel.add(updown);
659
+
610660 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
- redoButton.setToolTipText("Redo changes");
661
+ redoButton.setToolTipText("Next version");
612662 redoButton.addActionListener(this);
613663 redoButton.setEnabled(false);
614664
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);
665
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
620666 liveCB.setToolTipText("Enable animation");
621667 liveCB.addItemListener(this);
622668
623
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624670 oneStepButton.setToolTipText("Animate one step forward");
625671 oneStepButton.addActionListener(this);
626672
627
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
628674 fastCB.setToolTipText("Fast mode");
629675 fastCB.addItemListener(this);
630676
631677 //oe.toolboxPanel.Return();
632678
633
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- screenfitButton.setToolTipText("Screen fit");
635
- screenfitButton.addActionListener(this);
636
-
637679 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638680 // trackCB.setToolTipText("Enable tracking");
639681 // trackCB.addItemListener(this);
....@@ -650,27 +692,28 @@
650692
651693 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
652694
653
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
- twoButton.setToolTipText("Show center view only");
655
- twoButton.addActionListener(this);
656
- this.fullscreenLayout = twoButton;
657
-
658695 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
659696 fourButton.addActionListener(this);
660697 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
+
661704 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
- sixButton.setToolTipText("2-column layout left");
705
+ sixButton.setToolTipText("Show left and right");
663706 sixButton.addActionListener(this);
664
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
- threeButton.setToolTipText("2-column layout right");
666
- threeButton.addActionListener(this);
667
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
- sevenButton.setToolTipText("3-column layout");
669
- 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);
670713 //
671714
672
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
673
- 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");
674717 rootButton.addActionListener(this);
675718
676719 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -726,7 +769,7 @@
726769 compositeButton.addActionListener(this);
727770
728771 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
- switchButton.setToolTipText("Create switch");
772
+ switchButton.setToolTipText("Create item switcher");
730773 switchButton.addActionListener(this);
731774
732775 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -811,6 +854,9 @@
811854
812855 oe.treePanel.add(copyOptionsPanel);
813856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
814860
815861 // mainPanel.setDividerLocation(0.5); //1.0);
816862 // mainPanel.setResizeWeight(0.5);
....@@ -833,7 +879,7 @@
833879 dgr.addDragGestureListener(this);
834880 }catch(Exception e) {}
835881 */
836
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
837883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
838884 }
839885
....@@ -863,9 +909,13 @@
863909
864910 if (true) // Globals.ADVANCED)
865911 {
866
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
867
- supportCB.setToolTipText("Enable rigging");
868
- supportCB.addItemListener(this);
912
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
913
+// supportCB.setToolTipText("Enable rigging");
914
+// supportCB.addItemListener(this);
915
+
916
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
917
+ freezeCB.setToolTipText("Fast moving camera");
918
+ freezeCB.addItemListener(this);
869919
870920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
871921 // localCB.addItemListener(this);
....@@ -929,12 +979,12 @@
929979 toggleTextureCB.addItemListener(this);
930980
931981 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
932
- toggleSwitchCB.setToolTipText("Use switch");
982
+ toggleSwitchCB.setToolTipText("Choose a single item");
933983 toggleSwitchCB.addItemListener(this);
934984
935
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
936
- autosaveCB.setToolTipText("On structure change");
937
- autosaveCB.addItemListener(this);
985
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
986
+ autokeepCB.setToolTipText("On structure change");
987
+ autokeepCB.addItemListener(this);
938988
939989 panel.Return();
940990 if (Globals.ADVANCED)
....@@ -963,7 +1013,7 @@
9631013 {
9641014 cRadio radioButton = new cRadio(obj.name);
9651015
966
- // Patch to avoid bug with transparency.
1016
+ // June 2019. Patch to avoid bug with transparency.
9671017 radioButton.hadMaterial = obj.material != null;
9681018 if (!radioButton.hadMaterial)
9691019 {
....@@ -971,7 +1021,7 @@
9711021 }
9721022
9731023 radioButton.SetObject(obj);
974
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
9751025 radioButton.SetCamera(cameraView.renderCamera, false);
9761026 radioButton.addActionListener(this);
9771027 radioPanel.add(radioButton);
....@@ -1000,6 +1050,7 @@
10001050 cCheckBox slowCB;
10011051 cCheckBox boxCB;
10021052 cCheckBox zoomBoxCB;
1053
+ cCheckBox freezeCB;
10031054 //cToggleButton trackCB;
10041055 cCheckBox trackCB;
10051056 cCheckBox smoothfocusCB;
....@@ -1010,7 +1061,7 @@
10101061
10111062 cCheckBox oeilCB;
10121063 cCheckBox shadowCB;
1013
- cCheckBox autosaveCB;
1064
+ cCheckBox autokeepCB;
10141065 cCheckBox lookAtCB;
10151066
10161067 // static int COLOR = 1;
....@@ -1118,9 +1169,13 @@
11181169 {
11191170 Globals.COMPUTESHADOWWHENLIVE ^= true;
11201171 }
1121
- else if(e.getSource() == autosaveCB)
1172
+ else if(e.getSource() == freezeCB)
11221173 {
1123
- Globals.SAVEONMAKE ^= true;
1174
+ Globals.FREEZEONMOVE ^= true;
1175
+ }
1176
+ else if(e.getSource() == autokeepCB)
1177
+ {
1178
+ Globals.REPLACEONMAKE ^= true;
11241179 }
11251180 else if(e.getSource() == lookAtCB)
11261181 {
....@@ -1202,8 +1257,6 @@
12021257 }
12031258 }
12041259
1205
- String string = (String) object;
1206
-
12071260 System.out.println("Transfer = " + object + "; drop : " + target);
12081261 // if( object instanceof java.io.File[])
12091262 // {
....@@ -1211,6 +1264,8 @@
12111264 // objEditor.DropFile((java.io.File[]) object, true);
12121265 // return;
12131266 // }
1267
+
1268
+ String string = object.toString();
12141269
12151270 // File path for Mac and Windows
12161271 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1460,6 +1515,9 @@
14601515 animationItem.addItemListener(this);
14611516 animationItem.setState(Globals.ANIMATION);
14621517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
14631521 menu.add("-");
14641522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14651523 parseverticesItem.addActionListener(this);
....@@ -1472,6 +1530,8 @@
14721530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14731531 reduce34MorphItem.addActionListener(this);
14741532 menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
14751535 menu.add(computeAOItem = new MenuItem("Compute AO"));
14761536 computeAOItem.addActionListener(this);
14771537
....@@ -1480,8 +1540,6 @@
14801540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14811541 mirrorItem.addActionListener(this);
14821542 menu.add("-");
1483
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1484
- memoryItem.addActionListener(this);
14851543 menu.add(analyzeItem = new MenuItem("Analyze"));
14861544 analyzeItem.addActionListener(this);
14871545 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1642,6 +1700,16 @@
16421700 listUI.remove(i);
16431701 }
16441702 }
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
16451713 }
16461714
16471715 /**
....@@ -2122,25 +2190,25 @@
21222190 Composite csg = new GroupLeaf();
21232191 csg.count = 5;
21242192 group(csg);
2125
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
21262194 csg.addChild(child);
21272195 child.addChild(csg);
21282196 } else
21292197 if (source == doubleItem)
21302198 {
2131
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
21322200 csg.count = 5;
21332201 group(csg);
2134
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
21352203 csg.addChild(child);
21362204 child.addChild(csg);
2137
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
21382206 csg.addChild(child);
21392207 child.addChild(csg);
21402208 } else
21412209 if (source == tripleItem)
21422210 {
2143
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
21442212 csg.count = 4;
21452213 group(csg);
21462214 Composite child = new cGroup();
....@@ -2204,15 +2272,31 @@
22042272 } else
22052273 if (source == undoButton)
22062274 {
2275
+ // Go to previous version
2276
+ //if (!Undo())
2277
+ //java.awt.Toolkit.getDefaultToolkit().beep();
22072278 Undo();
2279
+ } else
2280
+ if (source == restoreButton)
2281
+ {
2282
+ // Restore current version
2283
+ Restore();
2284
+ } else
2285
+ if (source == replaceButton)
2286
+ {
2287
+ // Overwrite current version
2288
+ Replace();
22082289 } else
22092290 if (source == redoButton)
22102291 {
2292
+ // Go to next version
22112293 Redo();
22122294 } else
22132295 if (source == saveButton)
22142296 {
2215
- Save();
2297
+ // Save a new version
2298
+ if (!Save(true))
2299
+ java.awt.Toolkit.getDefaultToolkit().beep();
22162300 } else
22172301 if (source == oneStepButton)
22182302 {
....@@ -2221,17 +2305,14 @@
22212305 } else
22222306 if (source == screenfitButton)
22232307 {
2224
- //Reload(lastConverter, lastFilename, true);
22252308 ScreenFit();
22262309 } else
22272310 if (source == screenfitpointButton)
22282311 {
2229
- //Reload(lastConverter, lastFilename, true);
22302312 ScreenFitPoint();
22312313 } else
22322314 if (source == snapobjectButton)
22332315 {
2234
- //Reload(lastConverter, lastFilename, true);
22352316 SnapObject();
22362317 } else
22372318 // if (event.getSource() == recompileButton)
....@@ -2595,7 +2676,7 @@
25952676 {
25962677 StepAll();
25972678 } else
2598
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
25992680 {
26002681 //int indices[] = jList.getSelectedIndices();
26012682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2755,15 +2836,28 @@
27552836 } else
27562837 if (source == ungroupItem || source == ungroupButton)
27572838 {
2758
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
27592841 for (int i=0; i<group.selection.size(); i++)
27602842 {
2761
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
27622848 }
27632849
2764
- ClearSelection(false);
2765
-
2766
- refreshContents();
2850
+ if (!hasRoot)
2851
+ {
2852
+ for (int i=0; i<group.selection.size(); i++)
2853
+ {
2854
+ Ungroup(group.selection.get(i));
2855
+ }
2856
+
2857
+ ClearSelection(false);
2858
+
2859
+ refreshContents();
2860
+ }
27672861 } else
27682862 if (source == genUVItem)
27692863 {
....@@ -3064,7 +3158,7 @@
30643158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30653159 {
30663160 obj = (Object3D)e.nextElement();
3067
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
30683162 }
30693163
30703164 refreshContents();
....@@ -3078,6 +3172,31 @@
30783172 obj.SetBumpTexture(obj.GetPigmentTexture());
30793173 }
30803174
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
+
30813200 refreshContents();
30823201 } else
30833202 if (source == flashSelectionButton)
....@@ -3446,6 +3565,9 @@
34463565 }
34473566
34483567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
34493571 //Globals.theRenderer.object = group;
34503572 if(!useclient)
34513573 {
....@@ -3474,8 +3596,10 @@
34743596 radio.layout.doClick();
34753597
34763598 ClearUnpinned();
3477
- SetPinStates(group.selection.size() > 0);
3478
- 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)
34793603 EditSelection(false);
34803604 keepparent = group.parent;
34813605 // PARENT = NULL or not???
....@@ -4069,7 +4193,7 @@
40694193
40704194 try
40714195 {
4072
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
40734197 }
40744198 catch (Exception e)
40754199 {
....@@ -4546,6 +4670,12 @@
45464670
45474671 void EditSelection(boolean newWindow)
45484672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
45494679 // aConstraints.gridy = 0;
45504680 for (int i=0; i<group.selection.size(); i++)
45514681 {
....@@ -4556,12 +4686,7 @@
45564686 Object3D elem = (Object3D)group.selection.elementAt(i);
45574687 if(elem != group || !newWindow)
45584688 {
4559
- // if (!(elem instanceof Composite))
4560
- // newWindow = false;
4561
- listUI.add(elem);
4562
- elem.openEditWindow(this, newWindow); //, false);
4563
- System.out.println("edit : " + elem);
4564
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
45654690 }
45664691 }
45674692 }
....@@ -4705,8 +4830,8 @@
47054830
47064831 void refreshContents(boolean cp)
47074832 {
4708
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4709
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4833
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4834
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47104835 {
47114836 objEditor.ClearInfo(); // .GetMaterial());
47124837
....@@ -4805,8 +4930,8 @@
48054930
48064931 if (cut)
48074932 {
4808
- if (Globals.SAVEONMAKE)
4809
- Save();
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
48104935 //int indices[] = jList.getSelectedIndices();
48114936 //for (int i = indices.length - 1; i >= 0; i--)
48124937 //jList.remove(indices[i]);
....@@ -4909,6 +5034,10 @@
49095034
49105035 void paste(boolean expand)
49115036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
49125041 // if (GrafreeD.clipboard == null)
49135042 // return;
49145043 boolean first = true;
....@@ -4968,6 +5097,7 @@
49685097 Grafreed.clipboard.get(0).parent = keepparent;
49695098 }
49705099
5100
+ Globals.REPLACEONMAKE = keep;
49715101 ResetModel();
49725102 refreshContents();
49735103 }
....@@ -5103,6 +5233,10 @@
51035233
51045234 void group(Object3D csg, boolean grab)
51055235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
51065240 if (//false) // why??
51075241 !group.selection.isEmpty())
51085242 {
....@@ -5216,10 +5350,15 @@
52165350 //node.add(csg);
52175351 //makeSomething(node);
52185352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
52195354 }
52205355
52215356 void Ungroup(Object3D g)
52225357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
52235362 if (g instanceof HiddenObject)
52245363 {
52255364 HiddenObject h = (HiddenObject) g;
....@@ -5236,6 +5375,7 @@
52365375 objEditor.makeSomething(g.get(i), false);
52375376 }
52385377 }
5378
+ Globals.REPLACEONMAKE = keep;
52395379 }
52405380
52415381 void ungroup()
....@@ -5526,9 +5666,6 @@
55265666
55275667 cButton restoreCameraButton;
55285668
5529
- cButton minButton;
5530
- cButton maxButton;
5531
- cButton fullButton;
55325669 cButton saveButton;
55335670 cButton oneStepButton;
55345671
....@@ -5602,7 +5739,7 @@
56025739 private MenuItem pasteLinkItem;
56035740 private MenuItem pasteCloneItem;
56045741 private MenuItem pasteExpandItem;
5605
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
56065743 private MenuItem clearAllItem;
56075744 private MenuItem genUVItem;
56085745 private MenuItem genNormalsMESHItem;
....@@ -5686,6 +5823,8 @@
56865823 private MenuItem attachBumpItem;
56875824 private MenuItem detachBumpItem;
56885825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
56895828
56905829 private MenuItem particleItem;
56915830 private MenuItem ragdollItem;