Normand Briere
2019-07-23 de4f66e0239a736bce24e09c9a0b49b5bb92d84b
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);
....@@ -758,16 +801,16 @@
758801 }
759802
760803 // EDIT panel
761
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
- editButton.setToolTipText("Edit selection");
804
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ editButton.setToolTipText("Pin selection controls");
763806 editButton.addActionListener(this);
764807
765
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
- uneditButton.setToolTipText("Unedit selection");
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
767810 uneditButton.addActionListener(this);
768811
769812 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
770
- allParamsButton.setToolTipText("Edit all params");
813
+ allParamsButton.setToolTipText("Show all controle");
771814 allParamsButton.addActionListener(this);
772815
773816 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -784,6 +827,7 @@
784827
785828 editCommandsPanel.preferredHeight = 1;
786829
830
+ SetPinStates(false);
787831 // oe.treePanel.add(commandsPanel);
788832 // oe.treePanel.Return();
789833
....@@ -810,6 +854,9 @@
810854
811855 oe.treePanel.add(copyOptionsPanel);
812856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
813860
814861 // mainPanel.setDividerLocation(0.5); //1.0);
815862 // mainPanel.setResizeWeight(0.5);
....@@ -832,7 +879,7 @@
832879 dgr.addDragGestureListener(this);
833880 }catch(Exception e) {}
834881 */
835
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
836883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
837884 }
838885
....@@ -857,14 +904,18 @@
857904 boxCB.addItemListener(this);
858905
859906 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
860
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
861908 zoomBoxCB.addItemListener(this);
862909
863910 if (true) // Globals.ADVANCED)
864911 {
865
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
866
- supportCB.setToolTipText("Enable rigging");
867
- 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);
868919
869920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
870921 // localCB.addItemListener(this);
....@@ -919,7 +970,7 @@
919970 oeilCB.addItemListener(this);
920971
921972 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
922
- shadowCB.setToolTipText("Compute shadows when live");
973
+ shadowCB.setToolTipText("When live compute shadows");
923974 shadowCB.addItemListener(this);
924975
925976 panel.Return();
....@@ -928,12 +979,12 @@
928979 toggleTextureCB.addItemListener(this);
929980
930981 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
931
- toggleSwitchCB.setToolTipText("Use switch");
982
+ toggleSwitchCB.setToolTipText("Choose a single item");
932983 toggleSwitchCB.addItemListener(this);
933984
934
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
935
- autosaveCB.setToolTipText("Auto-save on structure change");
936
- autosaveCB.addItemListener(this);
985
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
986
+ autokeepCB.setToolTipText("On structure change");
987
+ autokeepCB.addItemListener(this);
937988
938989 panel.Return();
939990 if (Globals.ADVANCED)
....@@ -962,7 +1013,7 @@
9621013 {
9631014 cRadio radioButton = new cRadio(obj.name);
9641015
965
- // Patch to avoid bug with transparency.
1016
+ // June 2019. Patch to avoid bug with transparency.
9661017 radioButton.hadMaterial = obj.material != null;
9671018 if (!radioButton.hadMaterial)
9681019 {
....@@ -970,7 +1021,7 @@
9701021 }
9711022
9721023 radioButton.SetObject(obj);
973
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
9741025 radioButton.SetCamera(cameraView.renderCamera, false);
9751026 radioButton.addActionListener(this);
9761027 radioPanel.add(radioButton);
....@@ -999,6 +1050,7 @@
9991050 cCheckBox slowCB;
10001051 cCheckBox boxCB;
10011052 cCheckBox zoomBoxCB;
1053
+ cCheckBox freezeCB;
10021054 //cToggleButton trackCB;
10031055 cCheckBox trackCB;
10041056 cCheckBox smoothfocusCB;
....@@ -1009,7 +1061,7 @@
10091061
10101062 cCheckBox oeilCB;
10111063 cCheckBox shadowCB;
1012
- cCheckBox autosaveCB;
1064
+ cCheckBox autokeepCB;
10131065 cCheckBox lookAtCB;
10141066
10151067 // static int COLOR = 1;
....@@ -1117,9 +1169,13 @@
11171169 {
11181170 Globals.COMPUTESHADOWWHENLIVE ^= true;
11191171 }
1120
- else if(e.getSource() == autosaveCB)
1172
+ else if(e.getSource() == freezeCB)
11211173 {
1122
- Globals.SAVEONMAKE ^= true;
1174
+ Globals.FREEZEONMOVE ^= true;
1175
+ }
1176
+ else if(e.getSource() == autokeepCB)
1177
+ {
1178
+ Globals.REPLACEONMAKE ^= true;
11231179 }
11241180 else if(e.getSource() == lookAtCB)
11251181 {
....@@ -1201,8 +1257,6 @@
12011257 }
12021258 }
12031259
1204
- String string = (String) object;
1205
-
12061260 System.out.println("Transfer = " + object + "; drop : " + target);
12071261 // if( object instanceof java.io.File[])
12081262 // {
....@@ -1210,6 +1264,8 @@
12101264 // objEditor.DropFile((java.io.File[]) object, true);
12111265 // return;
12121266 // }
1267
+
1268
+ String string = object.toString();
12131269
12141270 // File path for Mac and Windows
12151271 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1459,6 +1515,9 @@
14591515 animationItem.addItemListener(this);
14601516 animationItem.setState(Globals.ANIMATION);
14611517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
14621521 menu.add("-");
14631522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14641523 parseverticesItem.addActionListener(this);
....@@ -1471,6 +1530,8 @@
14711530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14721531 reduce34MorphItem.addActionListener(this);
14731532 menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
14741535 menu.add(computeAOItem = new MenuItem("Compute AO"));
14751536 computeAOItem.addActionListener(this);
14761537
....@@ -1479,8 +1540,6 @@
14791540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14801541 mirrorItem.addActionListener(this);
14811542 menu.add("-");
1482
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1483
- memoryItem.addActionListener(this);
14841543 menu.add(analyzeItem = new MenuItem("Analyze"));
14851544 analyzeItem.addActionListener(this);
14861545 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1628,6 +1687,30 @@
16281687
16291688 makeSomething(shadow);
16301689 }
1690
+
1691
+ private void ClearUnpinned()
1692
+ {
1693
+ //for (Object3D obj : listUI)
1694
+ for (int i=listUI.size(); --i>=0;)
1695
+ {
1696
+ Object3D obj = listUI.elementAt(i);
1697
+ if (!obj.pinned)
1698
+ {
1699
+ obj.CloseUI();
1700
+ listUI.remove(i);
1701
+ }
1702
+ }
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
1713
+ }
16311714
16321715 /**
16331716 * applyExample
....@@ -2107,25 +2190,25 @@
21072190 Composite csg = new GroupLeaf();
21082191 csg.count = 5;
21092192 group(csg);
2110
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
21112194 csg.addChild(child);
21122195 child.addChild(csg);
21132196 } else
21142197 if (source == doubleItem)
21152198 {
2116
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
21172200 csg.count = 5;
21182201 group(csg);
2119
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
21202203 csg.addChild(child);
21212204 child.addChild(csg);
2122
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
21232206 csg.addChild(child);
21242207 child.addChild(csg);
21252208 } else
21262209 if (source == tripleItem)
21272210 {
2128
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
21292212 csg.count = 4;
21302213 group(csg);
21312214 Composite child = new cGroup();
....@@ -2189,15 +2272,31 @@
21892272 } else
21902273 if (source == undoButton)
21912274 {
2275
+ // Go to previous version
2276
+ //if (!Undo())
2277
+ //java.awt.Toolkit.getDefaultToolkit().beep();
21922278 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();
21932289 } else
21942290 if (source == redoButton)
21952291 {
2292
+ // Go to next version
21962293 Redo();
21972294 } else
21982295 if (source == saveButton)
21992296 {
2200
- Save();
2297
+ // Save a new version
2298
+ if (!Save(true))
2299
+ java.awt.Toolkit.getDefaultToolkit().beep();
22012300 } else
22022301 if (source == oneStepButton)
22032302 {
....@@ -2206,17 +2305,14 @@
22062305 } else
22072306 if (source == screenfitButton)
22082307 {
2209
- //Reload(lastConverter, lastFilename, true);
22102308 ScreenFit();
22112309 } else
22122310 if (source == screenfitpointButton)
22132311 {
2214
- //Reload(lastConverter, lastFilename, true);
22152312 ScreenFitPoint();
22162313 } else
22172314 if (source == snapobjectButton)
22182315 {
2219
- //Reload(lastConverter, lastFilename, true);
22202316 SnapObject();
22212317 } else
22222318 // if (event.getSource() == recompileButton)
....@@ -2580,7 +2676,7 @@
25802676 {
25812677 StepAll();
25822678 } else
2583
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
25842680 {
25852681 //int indices[] = jList.getSelectedIndices();
25862682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2740,15 +2836,28 @@
27402836 } else
27412837 if (source == ungroupItem || source == ungroupButton)
27422838 {
2743
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
27442841 for (int i=0; i<group.selection.size(); i++)
27452842 {
2746
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
27472848 }
27482849
2749
- ClearSelection(false);
2750
-
2751
- 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
+ }
27522861 } else
27532862 if (source == genUVItem)
27542863 {
....@@ -3049,7 +3158,7 @@
30493158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30503159 {
30513160 obj = (Object3D)e.nextElement();
3052
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
30533162 }
30543163
30553164 refreshContents();
....@@ -3063,6 +3172,31 @@
30633172 obj.SetBumpTexture(obj.GetPigmentTexture());
30643173 }
30653174
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
+
30663200 refreshContents();
30673201 } else
30683202 if (source == flashSelectionButton)
....@@ -3372,7 +3506,7 @@
33723506 //copy.ClearUI();
33733507 for (Object3D obj : listUI)
33743508 {
3375
- obj.pinned = true;
3509
+ obj.pinned = false;
33763510 obj.CloseUI();
33773511 }
33783512 listUI.clear();
....@@ -3431,6 +3565,9 @@
34313565 }
34323566
34333567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
34343571 //Globals.theRenderer.object = group;
34353572 if(!useclient)
34363573 {
....@@ -3457,6 +3594,13 @@
34573594 currentLayout = sevenButton;
34583595 */
34593596 radio.layout.doClick();
3597
+
3598
+ ClearUnpinned();
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)
3603
+ EditSelection(false);
34603604 keepparent = group.parent;
34613605 // PARENT = NULL or not???
34623606 //group.parent = null; // ROOT
....@@ -4049,7 +4193,7 @@
40494193
40504194 try
40514195 {
4052
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
40534197 }
40544198 catch (Exception e)
40554199 {
....@@ -4526,6 +4670,12 @@
45264670
45274671 void EditSelection(boolean newWindow)
45284672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
45294679 // aConstraints.gridy = 0;
45304680 for (int i=0; i<group.selection.size(); i++)
45314681 {
....@@ -4536,12 +4686,7 @@
45364686 Object3D elem = (Object3D)group.selection.elementAt(i);
45374687 if(elem != group || !newWindow)
45384688 {
4539
- // if (!(elem instanceof Composite))
4540
- // newWindow = false;
4541
- listUI.add(elem);
4542
- elem.openEditWindow(this, newWindow); //, false);
4543
- System.out.println("edit : " + elem);
4544
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
45454690 }
45464691 }
45474692 }
....@@ -4616,17 +4761,7 @@
46164761 //new Exception().printStackTrace();
46174762
46184763 freezemodel = true;
4619
-
4620
- //for (Object3D obj : listUI)
4621
- for (int i=listUI.size(); --i>=0;)
4622
- {
4623
- Object3D obj = listUI.elementAt(i);
4624
- if (!obj.pinned)
4625
- {
4626
- obj.CloseUI();
4627
- listUI.remove(i);
4628
- }
4629
- }
4764
+ ClearUnpinned();
46304765
46314766 /**/
46324767 //switch (event.id)
....@@ -4689,12 +4824,14 @@
46894824 {
46904825 editButton.setEnabled(enabled);
46914826 uneditButton.setEnabled(enabled);
4827
+ unselectButton.setEnabled(enabled);
4828
+ flashSelectionButton.setEnabled(enabled);
46924829 }
46934830
46944831 void refreshContents(boolean cp)
46954832 {
4696
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4697
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4833
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4834
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
46984835 {
46994836 objEditor.ClearInfo(); // .GetMaterial());
47004837
....@@ -4793,8 +4930,8 @@
47934930
47944931 if (cut)
47954932 {
4796
- if (Globals.SAVEONMAKE)
4797
- Save();
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
47984935 //int indices[] = jList.getSelectedIndices();
47994936 //for (int i = indices.length - 1; i >= 0; i--)
48004937 //jList.remove(indices[i]);
....@@ -4897,6 +5034,10 @@
48975034
48985035 void paste(boolean expand)
48995036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
49005041 // if (GrafreeD.clipboard == null)
49015042 // return;
49025043 boolean first = true;
....@@ -4956,6 +5097,7 @@
49565097 Grafreed.clipboard.get(0).parent = keepparent;
49575098 }
49585099
5100
+ Globals.REPLACEONMAKE = keep;
49595101 ResetModel();
49605102 refreshContents();
49615103 }
....@@ -5091,6 +5233,10 @@
50915233
50925234 void group(Object3D csg, boolean grab)
50935235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
50945240 if (//false) // why??
50955241 !group.selection.isEmpty())
50965242 {
....@@ -5204,10 +5350,15 @@
52045350 //node.add(csg);
52055351 //makeSomething(node);
52065352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
52075354 }
52085355
52095356 void Ungroup(Object3D g)
52105357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
52115362 if (g instanceof HiddenObject)
52125363 {
52135364 HiddenObject h = (HiddenObject) g;
....@@ -5224,6 +5375,7 @@
52245375 objEditor.makeSomething(g.get(i), false);
52255376 }
52265377 }
5378
+ Globals.REPLACEONMAKE = keep;
52275379 }
52285380
52295381 void ungroup()
....@@ -5514,9 +5666,6 @@
55145666
55155667 cButton restoreCameraButton;
55165668
5517
- cButton minButton;
5518
- cButton maxButton;
5519
- cButton fullButton;
55205669 cButton saveButton;
55215670 cButton oneStepButton;
55225671
....@@ -5590,7 +5739,7 @@
55905739 private MenuItem pasteLinkItem;
55915740 private MenuItem pasteCloneItem;
55925741 private MenuItem pasteExpandItem;
5593
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
55945743 private MenuItem clearAllItem;
55955744 private MenuItem genUVItem;
55965745 private MenuItem genNormalsMESHItem;
....@@ -5674,6 +5823,8 @@
56745823 private MenuItem attachBumpItem;
56755824 private MenuItem detachBumpItem;
56765825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
56775828
56785829 private MenuItem particleItem;
56795830 private MenuItem ragdollItem;