Normand Briere
2019-07-23 5140c320d8addf4bd8dcaa7f350b6accdc4ffbaf
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 {
....@@ -204,23 +223,23 @@
204223 //zBufferItem.addActionListener(this);
205224 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206225 //normalLensItem.addActionListener(this);
207
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
208
- revertCameraItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
209228
210
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
- toggleFullScreenItem.addItemListener(this);
212
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
- cameraMenu.add("-");
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
214241
215
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
- toggleTextureItem.addItemListener(this);
217
- toggleTextureItem.setState(CameraPane.textureon);
218
-
219
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
- toggleSwitchItem.addItemListener(this);
221
- toggleSwitchItem.setState(CameraPane.SWITCH);
222
-
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
....@@ -275,7 +294,7 @@
275294 {
276295 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277296 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279298 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280299 oe.cameraMenu.add("-");
281300 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -283,7 +302,7 @@
283302 editLeafItem.addActionListener(this);
284303 lookAtItem.addActionListener(this);
285304 //lookFromItem.addActinoListener(this);
286
- //switchItem.addActionListener(this);
305
+ //switchViewItem.addActionListener(this);
287306 }
288307
289308 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -328,14 +347,14 @@
328347 }
329348
330349 oe.menuBar.add(menu = new Menu("Group"));
331
- grabItem = menu.add(new MenuItem("Grab"));
332
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
333352 backItem = menu.add(new MenuItem("Back"));
334353 backItem.addActionListener(this);
335354 frontItem = menu.add(new MenuItem("Front"));
336355 frontItem.addActionListener(this);
337
- compositeItem = menu.add(new MenuItem("Composite"));
338
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
339358
340359 if (Globals.ADVANCED)
341360 {
....@@ -345,10 +364,10 @@
345364 ungroupItem = menu.add(new MenuItem("Ungroup"));
346365 ungroupItem.addActionListener(this);
347366
348
- menu.add("-");
349
-
350
- randomItem = menu.add(new MenuItem("Switch node"));
351
- randomItem.addActionListener(this);
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
352371 if (Globals.ADVANCED)
353372 {
354373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
....@@ -365,13 +384,11 @@
365384 frameselectorItem.addActionListener(this);
366385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
367386 scriptNodeItem.addActionListener(this);
368
- cameraItem = menu.add(new MenuItem("Camera"));
369
- cameraItem.addActionListener(this);
370387 }
371388
372389 oe.menuBar.add(menu = new Menu("Object"));
373
- textureItem = menu.add(new MenuItem("Texture"));
374
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
375392 billboardItem = menu.add(new MenuItem("Billboard"));
376393 billboardItem.addActionListener(this);
377394 csgItem = menu.add(new MenuItem("CSG"));
....@@ -382,13 +399,14 @@
382399 shadowYItem.addActionListener(this);
383400 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
384401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
385405 if (Globals.ADVANCED)
386406 {
387407 menu.add("-");
388408 linkerItem = menu.add(new MenuItem("Linker"));
389409 linkerItem.addActionListener(this);
390
- attributeItem = menu.add(new MenuItem("Attribute"));
391
- attributeItem.addActionListener(this);
392410 templateItem = menu.add(new MenuItem("Template"));
393411 templateItem.addActionListener(this);
394412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -417,7 +435,7 @@
417435 genNormalsMESHItem.addActionListener(this);
418436 if (Globals.ADVANCED)
419437 {
420
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
421439 genNormalsMINEItem.addActionListener(this);
422440 }
423441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -510,10 +528,15 @@
510528 attachBumpItem.addActionListener(this);
511529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
512530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
513532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
514533 detachPigmentItem.addActionListener(this);
515534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
516535 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);
517540 menu.add("-");
518541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
519542 sortbysizeItem.addActionListener(this);
....@@ -540,6 +563,7 @@
540563 buildToolsMenu(menu);
541564 }
542565
566
+
543567 void SetupUI2(ObjEditor oe)
544568 {
545569 // June 2019
....@@ -582,53 +606,79 @@
582606 oe.radioPanel.add(dummyButton);
583607 oe.buttonGroup.add(dummyButton);
584608 */
609
+ cGridBag copyOptionsPanel = new cGridBag();
610
+
611
+ copyOptionsPanel.preferredHeight = 1;
612
+
585613 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
586614
587615 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588616 //minButton.setToolTipText("Minimize window");
589617 //minButton.addActionListener(this);
590618
591
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- maxButton.setToolTipText("Maximize window");
593
- 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
+ }
594625
595626 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596627 fullButton.setToolTipText("Full-screen window");
597628 fullButton.addActionListener(this);
598629
599
- oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- undoButton.setToolTipText("Undo changes");
601
- undoButton.addActionListener(this);
630
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ screenfitButton.setToolTipText("Screen fit");
632
+ screenfitButton.addActionListener(this);
633
+
634
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ restoreCameraButton.setToolTipText("Restore viewpoint");
636
+ restoreCameraButton.addActionListener(this);
602637
603
- oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
604
- redoButton.setToolTipText("Redo changes");
605
- redoButton.addActionListener(this);
606
-
607
- oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- saveButton.setToolTipText("Save changes");
638
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ saveButton.setToolTipText("New version");
609640 saveButton.addActionListener(this);
641
+
642
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643
+ undoButton.setToolTipText("Previous version");
644
+ undoButton.addActionListener(this);
645
+ undoButton.setEnabled(false);
610646
611
- oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
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
+
660
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ redoButton.setToolTipText("Next version");
662
+ redoButton.addActionListener(this);
663
+ redoButton.setEnabled(false);
664
+
665
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
612666 liveCB.setToolTipText("Enable animation");
613667 liveCB.addItemListener(this);
614668
615
- oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616670 oneStepButton.setToolTipText("Animate one step forward");
617671 oneStepButton.addActionListener(this);
618672
619
- oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
620674 fastCB.setToolTipText("Fast mode");
621675 fastCB.addItemListener(this);
622676
623
- oe.toolboxPanel.Return();
677
+ //oe.toolboxPanel.Return();
624678
625
- oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
626
- trackCB.setToolTipText("Enable tracking");
627
- trackCB.addItemListener(this);
628
-
629
- oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
- screenfitButton.setToolTipText("Screen fit");
631
- screenfitButton.addActionListener(this);
679
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
680
+// trackCB.setToolTipText("Enable tracking");
681
+// trackCB.addItemListener(this);
632682
633683 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
634684 // screenfitpointButton.addActionListener(this);
....@@ -640,33 +690,30 @@
640690 snapobjectButton.setToolTipText("Snap Object");
641691 }
642692
643
- oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
- flashSelectionButton.setToolTipText("Highlight selection");
645
- flashSelectionButton.addActionListener(this);
646
-
647693 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
648
-
649
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- twoButton.setToolTipText("Show center view only");
651
- twoButton.addActionListener(this);
652
- this.fullscreenLayout = twoButton;
653694
654695 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
655696 fourButton.addActionListener(this);
656697 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
+
657704 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658
- sixButton.setToolTipText("2-column layout left");
705
+ sixButton.setToolTipText("Show left and right");
659706 sixButton.addActionListener(this);
660
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
- threeButton.setToolTipText("2-column layout right");
662
- threeButton.addActionListener(this);
663
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
- sevenButton.setToolTipText("3-column layout");
665
- 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);
666713 //
667714
668
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
- 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");
670717 rootButton.addActionListener(this);
671718
672719 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -688,8 +735,6 @@
688735 sphereButton.setToolTipText("Create sphere");
689736 sphereButton.addActionListener(this);
690737
691
- oe.toolboxPanel.Return();
692
-
693738 oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694739 coneButton.setToolTipText("Create cone");
695740 coneButton.addActionListener(this);
....@@ -713,6 +758,28 @@
713758 particlesButton.setToolTipText("Create particle system");
714759 particlesButton.addActionListener(this);
715760
761
+ oe.toolboxPanel.Return();
762
+
763
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ groupButton.setToolTipText("Create group");
765
+ groupButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ compositeButton.setToolTipText("Create composite");
769
+ compositeButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ switchButton.setToolTipText("Create item switcher");
773
+ switchButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ loopButton.setToolTipText("Create loop");
777
+ loopButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ textureButton.setToolTipText("Create texture");
781
+ textureButton.addActionListener(this);
782
+
716783 oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
717784 overlayButton.setToolTipText("Create overlay");
718785 overlayButton.addActionListener(this);
....@@ -721,17 +788,29 @@
721788 lightButton.setToolTipText("Create light");
722789 lightButton.addActionListener(this);
723790
791
+ for (int i=6; --i>=0;)
792
+ {
793
+ oe.toolboxPanel.Return();
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ oe.toolboxPanel.add(new cGridBag());
797
+ oe.toolboxPanel.add(new cGridBag());
798
+ oe.toolboxPanel.add(new cGridBag());
799
+ oe.toolboxPanel.add(new cGridBag());
800
+ oe.toolboxPanel.add(new cGridBag());
801
+ }
802
+
724803 // EDIT panel
725
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
- editButton.setToolTipText("Edit selection");
804
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ editButton.setToolTipText("Pin selection controls");
727806 editButton.addActionListener(this);
728807
729
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
- uneditButton.setToolTipText("Unedit selection");
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
731810 uneditButton.addActionListener(this);
732811
733812 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
734
- allParamsButton.setToolTipText("Edit all params");
813
+ allParamsButton.setToolTipText("Show all controle");
735814 allParamsButton.addActionListener(this);
736815
737816 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -742,8 +821,13 @@
742821 unselectButton.setToolTipText("Unselect");
743822 unselectButton.addActionListener(this);
744823
824
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
825
+ flashSelectionButton.setToolTipText("Highlight selection");
826
+ flashSelectionButton.addActionListener(this);
827
+
745828 editCommandsPanel.preferredHeight = 1;
746829
830
+ SetPinStates(false);
747831 // oe.treePanel.add(commandsPanel);
748832 // oe.treePanel.Return();
749833
....@@ -768,23 +852,11 @@
768852 oe.treePanel.add(jSPPanel);
769853 oe.treePanel.Return();
770854
771
- cGridBag copyOptionsPanel = new cGridBag();
772
-
773
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
774
- colorCB.setToolTipText("Copy color when dropped");
775
- colorCB.addItemListener(this);
776
-
777
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
778
- materialCB.setToolTipText("Copy material when dropped");
779
- materialCB.addItemListener(this);
780
-
781
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
782
- textureCB.setToolTipText("Copy texture when dropped");
783
- textureCB.addItemListener(this);
784
-
785
- copyOptionsPanel.preferredHeight = 1;
786855 oe.treePanel.add(copyOptionsPanel);
787856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
788860
789861 // mainPanel.setDividerLocation(0.5); //1.0);
790862 // mainPanel.setResizeWeight(0.5);
....@@ -807,29 +879,49 @@
807879 dgr.addDragGestureListener(this);
808880 }catch(Exception e) {}
809881 */
810
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
811883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
812884 }
813885
814886 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
815887 {
888
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
889
+ colorCB.setToolTipText("Copy color when dropped");
890
+ colorCB.addItemListener(this);
891
+
892
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
893
+ materialCB.setToolTipText("Copy material when dropped");
894
+ materialCB.addItemListener(this);
895
+
896
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
897
+ textureCB.setToolTipText("Copy texture when dropped");
898
+ textureCB.addItemListener(this);
899
+
900
+ panel.Return();
901
+
816902 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
817903 boxCB.setToolTipText("Display bounding boxes");
818904 boxCB.addItemListener(this);
819905
820906 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
821
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
822908 zoomBoxCB.addItemListener(this);
823909
824910 if (true) // Globals.ADVANCED)
825911 {
826
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
827
- supportCB.setToolTipText("Enable rigging");
828
- 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);
829919
830920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
831921 // localCB.addItemListener(this);
832922
923
+ panel.Return();
924
+
833925 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
834926 crowdCB.setToolTipText("Used for crowds");
835927 crowdCB.addItemListener(this);
....@@ -846,6 +938,8 @@
846938 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
847939 // speakerMocapCB.addItemListener(this);
848940
941
+ panel.Return();
942
+
849943 if (false)
850944 {
851945 // handled in scripts
....@@ -860,24 +954,39 @@
860954 //constraints.gridy += 1;
861955 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
862956 smoothfocusCB.addItemListener(this);
957
+ panel.Return();
863958 }
864959
865960 //constraints.gridx += 1;
866961 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
867962 // debugCB.addItemListener(this);
868963
964
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
965
+ trackCB.setToolTipText("Enable tracking target");
966
+ trackCB.addItemListener(this);
967
+
869968 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
- oeilCB.setToolTipText("Move camera when tracking target");
969
+ oeilCB.setToolTipText("Move camera when tracking");
871970 oeilCB.addItemListener(this);
872971
873972 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
- shadowCB.setToolTipText("Compute shadows when live");
973
+ shadowCB.setToolTipText("When live compute shadows");
875974 shadowCB.addItemListener(this);
876975
877
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
- autosaveCB.setToolTipText("Auto-save on structure change");
879
- autosaveCB.addItemListener(this);
976
+ panel.Return();
977
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
978
+ toggleTextureCB.setToolTipText("Load textures");
979
+ toggleTextureCB.addItemListener(this);
980
+
981
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
982
+ toggleSwitchCB.setToolTipText("Choose a single item");
983
+ toggleSwitchCB.addItemListener(this);
984
+
985
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
986
+ autokeepCB.setToolTipText("On structure change");
987
+ autokeepCB.addItemListener(this);
880988
989
+ panel.Return();
881990 if (Globals.ADVANCED)
882991 {
883992 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -888,10 +997,15 @@
888997 }
889998
890999 cGridBag fill = new cGridBag();
891
-
8921000 fill.preferredHeight = 200;
1001
+ cGridBag fill2 = new cGridBag();
1002
+ fill2.preferredHeight = 200;
1003
+ cGridBag fill3 = new cGridBag();
1004
+ fill3.preferredHeight = 200;
8931005
8941006 panel.add(fill);
1007
+ panel.add(fill2);
1008
+ panel.add(fill3);
8951009
8961010 }
8971011
....@@ -899,7 +1013,7 @@
8991013 {
9001014 cRadio radioButton = new cRadio(obj.name);
9011015
902
- // Patch to avoid bug with transparency.
1016
+ // June 2019. Patch to avoid bug with transparency.
9031017 radioButton.hadMaterial = obj.material != null;
9041018 if (!radioButton.hadMaterial)
9051019 {
....@@ -907,7 +1021,7 @@
9071021 }
9081022
9091023 radioButton.SetObject(obj);
910
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
9111025 radioButton.SetCamera(cameraView.renderCamera, false);
9121026 radioButton.addActionListener(this);
9131027 radioPanel.add(radioButton);
....@@ -936,7 +1050,9 @@
9361050 cCheckBox slowCB;
9371051 cCheckBox boxCB;
9381052 cCheckBox zoomBoxCB;
939
- cToggleButton trackCB;
1053
+ cCheckBox freezeCB;
1054
+ //cToggleButton trackCB;
1055
+ cCheckBox trackCB;
9401056 cCheckBox smoothfocusCB;
9411057 // JCheckBox speakerMocapCB;
9421058 cCheckBox speakerCameraCB;
....@@ -945,7 +1061,7 @@
9451061
9461062 cCheckBox oeilCB;
9471063 cCheckBox shadowCB;
948
- cCheckBox autosaveCB;
1064
+ cCheckBox autokeepCB;
9491065 cCheckBox lookAtCB;
9501066
9511067 // static int COLOR = 1;
....@@ -1053,9 +1169,13 @@
10531169 {
10541170 Globals.COMPUTESHADOWWHENLIVE ^= true;
10551171 }
1056
- else if(e.getSource() == autosaveCB)
1172
+ else if(e.getSource() == freezeCB)
10571173 {
1058
- Globals.SAVEONMAKE ^= true;
1174
+ Globals.FREEZEONMOVE ^= true;
1175
+ }
1176
+ else if(e.getSource() == autokeepCB)
1177
+ {
1178
+ Globals.REPLACEONMAKE ^= true;
10591179 }
10601180 else if(e.getSource() == lookAtCB)
10611181 {
....@@ -1137,8 +1257,6 @@
11371257 }
11381258 }
11391259
1140
- String string = (String) object;
1141
-
11421260 System.out.println("Transfer = " + object + "; drop : " + target);
11431261 // if( object instanceof java.io.File[])
11441262 // {
....@@ -1146,6 +1264,8 @@
11461264 // objEditor.DropFile((java.io.File[]) object, true);
11471265 // return;
11481266 // }
1267
+
1268
+ String string = object.toString();
11491269
11501270 // File path for Mac and Windows
11511271 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1191,13 +1311,23 @@
11911311
11921312 assert target == objEditor.jTree;
11931313 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1314
+ Object3D destinationLeaf;
11941315 try {
1195
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1316
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11961317 } catch (Exception e) {
11971318 System.out.println("destinationPath : " + destinationPath);
11981319 return;
11991320 }
12001321
1322
+ for (int i=group.selection.size(); --i>=0;)
1323
+ {
1324
+ Object3D child = (Object3D)group.selection.elementAt(i);
1325
+
1326
+ // Cannot move into itself
1327
+ if (child == destinationLeaf)
1328
+ return;
1329
+ }
1330
+
12011331 // june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
12021332 // {
12031333 loadClipboard(true);
....@@ -1312,22 +1442,30 @@
13121442 {
13131443 //heightFieldItem = menu.add(new MenuItem("Height Field"));
13141444 //heightFieldItem.addActionListener(this);
1315
- gridItem = menu.add(new MenuItem("Grid"));
1316
- gridItem.addActionListener(this);
1317
- rectoidItem = menu.add(new MenuItem("Box"));
1318
- rectoidItem.addActionListener(this);
1319
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1320
- ellipsoidItem.addActionListener(this);
1321
- coneItem = menu.add(new MenuItem("Cone"));
1322
- coneItem.addActionListener(this);
1323
- torusItem = menu.add(new MenuItem("Torus"));
1324
- torusItem.addActionListener(this);
1325
- superItem = menu.add(new MenuItem("Superellipsoid"));
1326
- superItem.addActionListener(this);
1445
+// gridItem = menu.add(new MenuItem("Grid"));
1446
+// gridItem.addActionListener(this);
1447
+// rectoidItem = menu.add(new MenuItem("Box"));
1448
+// rectoidItem.addActionListener(this);
1449
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1450
+// ellipsoidItem.addActionListener(this);
1451
+// coneItem = menu.add(new MenuItem("Cone"));
1452
+// coneItem.addActionListener(this);
1453
+// torusItem = menu.add(new MenuItem("Torus"));
1454
+// torusItem.addActionListener(this);
1455
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1456
+// superItem.addActionListener(this);
1457
+
1458
+ cameraItem = menu.add(new MenuItem("Camera"));
1459
+ cameraItem.addActionListener(this);
1460
+
1461
+ if (!Globals.ADVANCED)
1462
+ {
13271463 kleinItem = menu.add(new MenuItem("Klein Bottle"));
13281464 kleinItem.addActionListener(this);
1329
- particleItem = menu.add(new MenuItem("Particle system"));
1330
- particleItem.addActionListener(this);
1465
+ }
1466
+
1467
+// particleItem = menu.add(new MenuItem("Particle system"));
1468
+// particleItem.addActionListener(this);
13311469 if (Globals.ADVANCED)
13321470 {
13331471 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1353,15 +1491,15 @@
13531491 }
13541492 bezierItem = menu.add(new MenuItem("Bezier Patch"));
13551493 bezierItem.addActionListener(this);
1356
- overlayItem = menu.add(new MenuItem("Overlay"));
1357
- overlayItem.addActionListener(this);
1358
- lightItem = menu.add(new MenuItem("Light"));
1359
- lightItem.addActionListener(this);
1494
+// overlayItem = menu.add(new MenuItem("Overlay"));
1495
+// overlayItem.addActionListener(this);
1496
+// lightItem = menu.add(new MenuItem("Light"));
1497
+// lightItem.addActionListener(this);
13601498 menu.add("-");
13611499 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13621500 //superLoopItem.addActionListener(this);
1363
- loopItem = menu.add(new MenuItem("Loop"));
1364
- loopItem.addActionListener(this);
1501
+// loopItem = menu.add(new MenuItem("Loop"));
1502
+// loopItem.addActionListener(this);
13651503 doubleItem = menu.add(new MenuItem("Fork"));
13661504 doubleItem.addActionListener(this);
13671505 if (Globals.ADVANCED)
....@@ -1377,6 +1515,9 @@
13771515 animationItem.addItemListener(this);
13781516 animationItem.setState(Globals.ANIMATION);
13791517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
13801521 menu.add("-");
13811522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13821523 parseverticesItem.addActionListener(this);
....@@ -1389,6 +1530,8 @@
13891530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13901531 reduce34MorphItem.addActionListener(this);
13911532 menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
13921535 menu.add(computeAOItem = new MenuItem("Compute AO"));
13931536 computeAOItem.addActionListener(this);
13941537
....@@ -1397,8 +1540,6 @@
13971540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13981541 mirrorItem.addActionListener(this);
13991542 menu.add("-");
1400
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1401
- memoryItem.addActionListener(this);
14021543 menu.add(analyzeItem = new MenuItem("Analyze"));
14031544 analyzeItem.addActionListener(this);
14041545 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1546,6 +1687,30 @@
15461687
15471688 makeSomething(shadow);
15481689 }
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
+ }
15491714
15501715 /**
15511716 * applyExample
....@@ -1790,7 +1955,7 @@
17901955 {
17911956 ScreenFit();
17921957 } else
1793
- if (source == switchItem)
1958
+ if (source == switchViewItem)
17941959 {
17951960 cVector v1 = new cVector();
17961961 cVector v2 = new cVector();
....@@ -2020,30 +2185,30 @@
20202185
20212186 group(g);
20222187 } else
2023
- if (source == loopItem)
2188
+ if (source == loopItem || source == loopButton)
20242189 {
20252190 Composite csg = new GroupLeaf();
20262191 csg.count = 5;
20272192 group(csg);
2028
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
20292194 csg.addChild(child);
20302195 child.addChild(csg);
20312196 } else
20322197 if (source == doubleItem)
20332198 {
2034
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
20352200 csg.count = 5;
20362201 group(csg);
2037
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
20382203 csg.addChild(child);
20392204 child.addChild(csg);
2040
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
20412206 csg.addChild(child);
20422207 child.addChild(csg);
20432208 } else
20442209 if (source == tripleItem)
20452210 {
2046
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
20472212 csg.count = 4;
20482213 group(csg);
20492214 Composite child = new cGroup();
....@@ -2107,15 +2272,31 @@
21072272 } else
21082273 if (source == undoButton)
21092274 {
2275
+ // Go to previous version
2276
+ //if (!Undo())
2277
+ //java.awt.Toolkit.getDefaultToolkit().beep();
21102278 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();
21112289 } else
21122290 if (source == redoButton)
21132291 {
2292
+ // Go to next version
21142293 Redo();
21152294 } else
21162295 if (source == saveButton)
21172296 {
2118
- Save();
2297
+ // Save a new version
2298
+ if (!Save(true))
2299
+ java.awt.Toolkit.getDefaultToolkit().beep();
21192300 } else
21202301 if (source == oneStepButton)
21212302 {
....@@ -2124,17 +2305,14 @@
21242305 } else
21252306 if (source == screenfitButton)
21262307 {
2127
- //Reload(lastConverter, lastFilename, true);
21282308 ScreenFit();
21292309 } else
21302310 if (source == screenfitpointButton)
21312311 {
2132
- //Reload(lastConverter, lastFilename, true);
21332312 ScreenFitPoint();
21342313 } else
21352314 if (source == snapobjectButton)
21362315 {
2137
- //Reload(lastConverter, lastFilename, true);
21382316 SnapObject();
21392317 } else
21402318 // if (event.getSource() == recompileButton)
....@@ -2498,7 +2676,7 @@
24982676 {
24992677 StepAll();
25002678 } else
2501
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
25022680 {
25032681 //int indices[] = jList.getSelectedIndices();
25042682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2510,9 +2688,9 @@
25102688 {
25112689 ClearSelection(true);
25122690 } else
2513
- if (source == grabItem)
2691
+ if (source == grabItem || source == groupButton)
25142692 {
2515
- group(new cGroup(), true);
2693
+ group(new cGroup(), false); // true);
25162694 } else
25172695 if (source == hideItem)
25182696 {
....@@ -2530,11 +2708,11 @@
25302708 {
25312709 makeSomething(new Camera());
25322710 } else
2533
- if (source == compositeItem)
2711
+ if (source == compositeItem || source == compositeButton)
25342712 {
25352713 group(new Composite());
25362714 } else
2537
- if (source == randomItem)
2715
+ if (source == switchItem || source == switchButton)
25382716 {
25392717 RandomNode random = new RandomNode();
25402718 group(random);
....@@ -2636,7 +2814,7 @@
26362814 {
26372815 group(new cLinker());
26382816 } else
2639
- if (source == textureItem)
2817
+ if (source == textureItem || source == textureButton)
26402818 {
26412819 group(new TextureNode());
26422820 } else
....@@ -2658,15 +2836,28 @@
26582836 } else
26592837 if (source == ungroupItem || source == ungroupButton)
26602838 {
2661
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
26622841 for (int i=0; i<group.selection.size(); i++)
26632842 {
2664
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
26652848 }
26662849
2667
- ClearSelection(false);
2668
-
2669
- 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
+ }
26702861 } else
26712862 if (source == genUVItem)
26722863 {
....@@ -2967,7 +3158,7 @@
29673158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
29683159 {
29693160 obj = (Object3D)e.nextElement();
2970
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
29713162 }
29723163
29733164 refreshContents();
....@@ -2981,6 +3172,31 @@
29813172 obj.SetBumpTexture(obj.GetPigmentTexture());
29823173 }
29833174
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
+
29843200 refreshContents();
29853201 } else
29863202 if (source == flashSelectionButton)
....@@ -3258,6 +3474,12 @@
32583474 } else
32593475 if (source == editItem || source == editButton)
32603476 {
3477
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3478
+ {
3479
+ Object3D child = (Object3D)e.nextElement();
3480
+ child.pinned = true;
3481
+ }
3482
+
32613483 EditSelection(false);
32623484 } else
32633485 if (source == uneditButton)
....@@ -3267,6 +3489,7 @@
32673489 Object3D child = (Object3D)e.nextElement();
32683490 if(child.editWindow != null)
32693491 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3492
+ child.pinned = false;
32703493 child.CloseUI();
32713494 listUI.remove(child);
32723495
....@@ -3283,6 +3506,7 @@
32833506 //copy.ClearUI();
32843507 for (Object3D obj : listUI)
32853508 {
3509
+ obj.pinned = false;
32863510 obj.CloseUI();
32873511 }
32883512 listUI.clear();
....@@ -3292,7 +3516,7 @@
32923516 {
32933517 assert(copy == group);
32943518
3295
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3519
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32963520
32973521 for (Object3D obj : listUI)
32983522 {
....@@ -3341,6 +3565,9 @@
33413565 }
33423566
33433567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
33443571 //Globals.theRenderer.object = group;
33453572 if(!useclient)
33463573 {
....@@ -3367,6 +3594,13 @@
33673594 currentLayout = sevenButton;
33683595 */
33693596 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);
33703604 keepparent = group.parent;
33713605 // PARENT = NULL or not???
33723606 //group.parent = null; // ROOT
....@@ -3380,7 +3614,7 @@
33803614 cameraView.ProtectCamera();
33813615 cameraView.repaint();
33823616 return;
3383
- } else if (event.getSource() == revertCameraItem)
3617
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33843618 {
33853619 cameraView.RevertCamera();
33863620 cameraView.repaint();
....@@ -3959,7 +4193,7 @@
39594193
39604194 try
39614195 {
3962
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
39634197 }
39644198 catch (Exception e)
39654199 {
....@@ -4434,12 +4668,14 @@
44344668 // }
44354669 // }
44364670
4437
- static boolean allparams = true;
4438
-
4439
- static Vector<Object3D> listUI = new Vector<Object3D>();
4440
-
44414671 void EditSelection(boolean newWindow)
44424672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
44434679 // aConstraints.gridy = 0;
44444680 for (int i=0; i<group.selection.size(); i++)
44454681 {
....@@ -4450,12 +4686,7 @@
44504686 Object3D elem = (Object3D)group.selection.elementAt(i);
44514687 if(elem != group || !newWindow)
44524688 {
4453
- // if (!(elem instanceof Composite))
4454
- // newWindow = false;
4455
- listUI.add(elem);
4456
- elem.openEditWindow(this, newWindow); //, false);
4457
- System.out.println("edit : " + elem);
4458
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
44594690 }
44604691 }
44614692 }
....@@ -4530,7 +4761,8 @@
45304761 //new Exception().printStackTrace();
45314762
45324763 freezemodel = true;
4533
-
4764
+ ClearUnpinned();
4765
+
45344766 /**/
45354767 //switch (event.id)
45364768 {
....@@ -4563,7 +4795,7 @@
45634795 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
45644796 // a camera
45654797 {
4566
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4798
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
45674799 {
45684800 CameraPane.camerachangeframe = 0; // don't refuse it
45694801 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4572,6 +4804,13 @@
45724804 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
45734805 }
45744806
4807
+ if (tps != null && tps.length == 1)
4808
+ {
4809
+ EditSelection(false);
4810
+ }
4811
+
4812
+ SetPinStates(tps != null && tps.length > 0);
4813
+
45754814 refreshContents();
45764815 //return true;
45774816 }
....@@ -4581,9 +4820,18 @@
45814820 freezemodel = false;
45824821 }
45834822
4823
+ void SetPinStates(boolean enabled)
4824
+ {
4825
+ editButton.setEnabled(enabled);
4826
+ uneditButton.setEnabled(enabled);
4827
+ unselectButton.setEnabled(enabled);
4828
+ flashSelectionButton.setEnabled(enabled);
4829
+ }
4830
+
45844831 void refreshContents(boolean cp)
45854832 {
4586
- if (!Globals.MOUSEDRAGGED)
4833
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4834
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45874835 {
45884836 objEditor.ClearInfo(); // .GetMaterial());
45894837
....@@ -4682,8 +4930,8 @@
46824930
46834931 if (cut)
46844932 {
4685
- if (Globals.SAVEONMAKE)
4686
- Save();
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
46874935 //int indices[] = jList.getSelectedIndices();
46884936 //for (int i = indices.length - 1; i >= 0; i--)
46894937 //jList.remove(indices[i]);
....@@ -4786,6 +5034,10 @@
47865034
47875035 void paste(boolean expand)
47885036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
47895041 // if (GrafreeD.clipboard == null)
47905042 // return;
47915043 boolean first = true;
....@@ -4845,6 +5097,7 @@
48455097 Grafreed.clipboard.get(0).parent = keepparent;
48465098 }
48475099
5100
+ Globals.REPLACEONMAKE = keep;
48485101 ResetModel();
48495102 refreshContents();
48505103 }
....@@ -4980,6 +5233,10 @@
49805233
49815234 void group(Object3D csg, boolean grab)
49825235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
49835240 if (//false) // why??
49845241 !group.selection.isEmpty())
49855242 {
....@@ -5093,10 +5350,15 @@
50935350 //node.add(csg);
50945351 //makeSomething(node);
50955352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
50965354 }
50975355
50985356 void Ungroup(Object3D g)
50995357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
51005362 if (g instanceof HiddenObject)
51015363 {
51025364 HiddenObject h = (HiddenObject) g;
....@@ -5113,6 +5375,7 @@
51135375 objEditor.makeSomething(g.get(i), false);
51145376 }
51155377 }
5378
+ Globals.REPLACEONMAKE = keep;
51165379 }
51175380
51185381 void ungroup()
....@@ -5401,17 +5664,17 @@
54015664 cButton clearpanelButton;
54025665 cButton unselectButton;
54035666
5404
- cButton minButton;
5405
- cButton maxButton;
5406
- cButton fullButton;
5407
- cButton undoButton;
5408
- cButton redoButton;
5667
+ cButton restoreCameraButton;
5668
+
54095669 cButton saveButton;
54105670 cButton oneStepButton;
54115671
54125672 cButton groupButton;
54135673 cButton ungroupButton;
54145674 cButton compositeButton;
5675
+ cButton switchButton;
5676
+ cButton loopButton;
5677
+ cButton textureButton;
54155678
54165679 cButton gridButton;
54175680 cButton boxButton;
....@@ -5444,7 +5707,7 @@
54445707 //JTree jTree;
54455708 private MenuItem lookAtItem;
54465709 private MenuItem lookFromItem;
5447
- private MenuItem switchItem;
5710
+ private MenuItem switchViewItem;
54485711 private MenuItem cutItem;
54495712 private MenuItem undoItem;
54505713 private MenuItem redoItem;
....@@ -5476,7 +5739,7 @@
54765739 private MenuItem pasteLinkItem;
54775740 private MenuItem pasteCloneItem;
54785741 private MenuItem pasteExpandItem;
5479
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
54805743 private MenuItem clearAllItem;
54815744 private MenuItem genUVItem;
54825745 private MenuItem genNormalsMESHItem;
....@@ -5536,7 +5799,7 @@
55365799 private MenuItem frontItem;
55375800 private MenuItem cameraItem;
55385801 private MenuItem compositeItem;
5539
- private MenuItem randomItem;
5802
+ private MenuItem switchItem;
55405803 private MenuItem physicsItem;
55415804 private MenuItem frameselectorItem;
55425805 private MenuItem scriptNodeItem;
....@@ -5560,6 +5823,8 @@
55605823 private MenuItem attachBumpItem;
55615824 private MenuItem detachBumpItem;
55625825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
55635828
55645829 private MenuItem particleItem;
55655830 private MenuItem ragdollItem;
....@@ -5610,5 +5875,5 @@
56105875
56115876 Menu cameraMenu;
56125877 MenuItem editCameraItem;
5613
- MenuItem revertCameraItem;
5878
+ MenuItem restoreCameraItem;
56145879 }