Normand Briere
2019-07-21 d32f24f147068e6cbecb31c7f98047f68bc8b58a
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"));
....@@ -540,6 +558,7 @@
540558 buildToolsMenu(menu);
541559 }
542560
561
+
543562 void SetupUI2(ObjEditor oe)
544563 {
545564 // June 2019
....@@ -582,53 +601,79 @@
582601 oe.radioPanel.add(dummyButton);
583602 oe.buttonGroup.add(dummyButton);
584603 */
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
607
+
585608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
586609
587610 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588611 //minButton.setToolTipText("Minimize window");
589612 //minButton.addActionListener(this);
590613
591
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- maxButton.setToolTipText("Maximize window");
593
- maxButton.addActionListener(this);
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
594620
595621 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596622 fullButton.setToolTipText("Full-screen window");
597623 fullButton.addActionListener(this);
598624
599
- oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- undoButton.setToolTipText("Undo changes");
601
- undoButton.addActionListener(this);
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
602632
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");
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
609635 saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
610641
611
- oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
612661 liveCB.setToolTipText("Enable animation");
613662 liveCB.addItemListener(this);
614663
615
- oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616665 oneStepButton.setToolTipText("Animate one step forward");
617666 oneStepButton.addActionListener(this);
618667
619
- oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
620669 fastCB.setToolTipText("Fast mode");
621670 fastCB.addItemListener(this);
622671
623
- oe.toolboxPanel.Return();
672
+ //oe.toolboxPanel.Return();
624673
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);
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
632677
633678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
634679 // screenfitpointButton.addActionListener(this);
....@@ -640,33 +685,30 @@
640685 snapobjectButton.setToolTipText("Snap Object");
641686 }
642687
643
- oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
- flashSelectionButton.setToolTipText("Highlight selection");
645
- flashSelectionButton.addActionListener(this);
646
-
647688 //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;
653689
654690 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
655691 fourButton.addActionListener(this);
656692 fourButton.setToolTipText("Show left panel only");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
657699 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658
- sixButton.setToolTipText("2-column layout left");
700
+ sixButton.setToolTipText("Show left and right");
659701 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);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
666708 //
667709
668
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
- rootButton.setToolTipText("Edit selection in new tab");
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
670712 rootButton.addActionListener(this);
671713
672714 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -688,8 +730,6 @@
688730 sphereButton.setToolTipText("Create sphere");
689731 sphereButton.addActionListener(this);
690732
691
- oe.toolboxPanel.Return();
692
-
693733 oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694734 coneButton.setToolTipText("Create cone");
695735 coneButton.addActionListener(this);
....@@ -713,6 +753,28 @@
713753 particlesButton.setToolTipText("Create particle system");
714754 particlesButton.addActionListener(this);
715755
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
716778 oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
717779 overlayButton.setToolTipText("Create overlay");
718780 overlayButton.addActionListener(this);
....@@ -721,17 +783,29 @@
721783 lightButton.setToolTipText("Create light");
722784 lightButton.addActionListener(this);
723785
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
724798 // EDIT panel
725
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
- editButton.setToolTipText("Edit selection");
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
727801 editButton.addActionListener(this);
728802
729
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
731805 uneditButton.addActionListener(this);
732806
733807 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
734
- allParamsButton.setToolTipText("Edit all params");
808
+ allParamsButton.setToolTipText("Show all controle");
735809 allParamsButton.addActionListener(this);
736810
737811 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -742,8 +816,13 @@
742816 unselectButton.setToolTipText("Unselect");
743817 unselectButton.addActionListener(this);
744818
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
822
+
745823 editCommandsPanel.preferredHeight = 1;
746824
825
+ SetPinStates(false);
747826 // oe.treePanel.add(commandsPanel);
748827 // oe.treePanel.Return();
749828
....@@ -768,23 +847,11 @@
768847 oe.treePanel.add(jSPPanel);
769848 oe.treePanel.Return();
770849
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;
786850 oe.treePanel.add(copyOptionsPanel);
787851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
788855
789856 // mainPanel.setDividerLocation(0.5); //1.0);
790857 // mainPanel.setResizeWeight(0.5);
....@@ -807,29 +874,49 @@
807874 dgr.addDragGestureListener(this);
808875 }catch(Exception e) {}
809876 */
810
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
811878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
812879 }
813880
814881 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
815882 {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
816897 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
817898 boxCB.setToolTipText("Display bounding boxes");
818899 boxCB.addItemListener(this);
819900
820901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
821
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
822903 zoomBoxCB.addItemListener(this);
823904
824905 if (true) // Globals.ADVANCED)
825906 {
826
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
827
- supportCB.setToolTipText("Enable rigging");
828
- supportCB.addItemListener(this);
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
829914
830915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
831916 // localCB.addItemListener(this);
832917
918
+ panel.Return();
919
+
833920 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
834921 crowdCB.setToolTipText("Used for crowds");
835922 crowdCB.addItemListener(this);
....@@ -846,6 +933,8 @@
846933 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
847934 // speakerMocapCB.addItemListener(this);
848935
936
+ panel.Return();
937
+
849938 if (false)
850939 {
851940 // handled in scripts
....@@ -860,24 +949,39 @@
860949 //constraints.gridy += 1;
861950 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
862951 smoothfocusCB.addItemListener(this);
952
+ panel.Return();
863953 }
864954
865955 //constraints.gridx += 1;
866956 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
867957 // debugCB.addItemListener(this);
868958
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
869963 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
- oeilCB.setToolTipText("Move camera when tracking target");
964
+ oeilCB.setToolTipText("Move camera when tracking");
871965 oeilCB.addItemListener(this);
872966
873967 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
- shadowCB.setToolTipText("Compute shadows when live");
968
+ shadowCB.setToolTipText("When live compute shadows");
875969 shadowCB.addItemListener(this);
876970
877
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
- autosaveCB.setToolTipText("Auto-save on structure change");
879
- autosaveCB.addItemListener(this);
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
880983
984
+ panel.Return();
881985 if (Globals.ADVANCED)
882986 {
883987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -888,10 +992,15 @@
888992 }
889993
890994 cGridBag fill = new cGridBag();
891
-
892995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
8931000
8941001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
8951004
8961005 }
8971006
....@@ -899,7 +1008,7 @@
8991008 {
9001009 cRadio radioButton = new cRadio(obj.name);
9011010
902
- // Patch to avoid bug with transparency.
1011
+ // June 2019. Patch to avoid bug with transparency.
9031012 radioButton.hadMaterial = obj.material != null;
9041013 if (!radioButton.hadMaterial)
9051014 {
....@@ -907,7 +1016,7 @@
9071016 }
9081017
9091018 radioButton.SetObject(obj);
910
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
9111020 radioButton.SetCamera(cameraView.renderCamera, false);
9121021 radioButton.addActionListener(this);
9131022 radioPanel.add(radioButton);
....@@ -936,7 +1045,9 @@
9361045 cCheckBox slowCB;
9371046 cCheckBox boxCB;
9381047 cCheckBox zoomBoxCB;
939
- cToggleButton trackCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
9401051 cCheckBox smoothfocusCB;
9411052 // JCheckBox speakerMocapCB;
9421053 cCheckBox speakerCameraCB;
....@@ -945,7 +1056,7 @@
9451056
9461057 cCheckBox oeilCB;
9471058 cCheckBox shadowCB;
948
- cCheckBox autosaveCB;
1059
+ cCheckBox autokeepCB;
9491060 cCheckBox lookAtCB;
9501061
9511062 // static int COLOR = 1;
....@@ -1053,9 +1164,13 @@
10531164 {
10541165 Globals.COMPUTESHADOWWHENLIVE ^= true;
10551166 }
1056
- else if(e.getSource() == autosaveCB)
1167
+ else if(e.getSource() == freezeCB)
10571168 {
1058
- Globals.SAVEONMAKE ^= true;
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
10591174 }
10601175 else if(e.getSource() == lookAtCB)
10611176 {
....@@ -1137,8 +1252,6 @@
11371252 }
11381253 }
11391254
1140
- String string = (String) object;
1141
-
11421255 System.out.println("Transfer = " + object + "; drop : " + target);
11431256 // if( object instanceof java.io.File[])
11441257 // {
....@@ -1146,6 +1259,8 @@
11461259 // objEditor.DropFile((java.io.File[]) object, true);
11471260 // return;
11481261 // }
1262
+
1263
+ String string = object.toString();
11491264
11501265 // File path for Mac and Windows
11511266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1191,13 +1306,23 @@
11911306
11921307 assert target == objEditor.jTree;
11931308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
11941310 try {
1195
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11961312 } catch (Exception e) {
11971313 System.out.println("destinationPath : " + destinationPath);
11981314 return;
11991315 }
12001316
1317
+ for (int i=group.selection.size(); --i>=0;)
1318
+ {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
12011326 // june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
12021327 // {
12031328 loadClipboard(true);
....@@ -1312,22 +1437,30 @@
13121437 {
13131438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
13141439 //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);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
13271458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
13281459 kleinItem.addActionListener(this);
1329
- particleItem = menu.add(new MenuItem("Particle system"));
1330
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
13311464 if (Globals.ADVANCED)
13321465 {
13331466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1353,15 +1486,15 @@
13531486 }
13541487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
13551488 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);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
13601493 menu.add("-");
13611494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13621495 //superLoopItem.addActionListener(this);
1363
- loopItem = menu.add(new MenuItem("Loop"));
1364
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
13651498 doubleItem = menu.add(new MenuItem("Fork"));
13661499 doubleItem.addActionListener(this);
13671500 if (Globals.ADVANCED)
....@@ -1377,6 +1510,9 @@
13771510 animationItem.addItemListener(this);
13781511 animationItem.setState(Globals.ANIMATION);
13791512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
13801516 menu.add("-");
13811517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13821518 parseverticesItem.addActionListener(this);
....@@ -1389,6 +1525,8 @@
13891525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13901526 reduce34MorphItem.addActionListener(this);
13911527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
13921530 menu.add(computeAOItem = new MenuItem("Compute AO"));
13931531 computeAOItem.addActionListener(this);
13941532
....@@ -1397,8 +1535,6 @@
13971535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13981536 mirrorItem.addActionListener(this);
13991537 menu.add("-");
1400
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1401
- memoryItem.addActionListener(this);
14021538 menu.add(analyzeItem = new MenuItem("Analyze"));
14031539 analyzeItem.addActionListener(this);
14041540 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1546,6 +1682,30 @@
15461682
15471683 makeSomething(shadow);
15481684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
15491709
15501710 /**
15511711 * applyExample
....@@ -1790,7 +1950,7 @@
17901950 {
17911951 ScreenFit();
17921952 } else
1793
- if (source == switchItem)
1953
+ if (source == switchViewItem)
17941954 {
17951955 cVector v1 = new cVector();
17961956 cVector v2 = new cVector();
....@@ -2020,30 +2180,30 @@
20202180
20212181 group(g);
20222182 } else
2023
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
20242184 {
20252185 Composite csg = new GroupLeaf();
20262186 csg.count = 5;
20272187 group(csg);
2028
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
20292189 csg.addChild(child);
20302190 child.addChild(csg);
20312191 } else
20322192 if (source == doubleItem)
20332193 {
2034
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
20352195 csg.count = 5;
20362196 group(csg);
2037
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
20382198 csg.addChild(child);
20392199 child.addChild(csg);
2040
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
20412201 csg.addChild(child);
20422202 child.addChild(csg);
20432203 } else
20442204 if (source == tripleItem)
20452205 {
2046
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
20472207 csg.count = 4;
20482208 group(csg);
20492209 Composite child = new cGroup();
....@@ -2107,15 +2267,31 @@
21072267 } else
21082268 if (source == undoButton)
21092269 {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
21102273 Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
21112284 } else
21122285 if (source == redoButton)
21132286 {
2287
+ // Go to next version
21142288 Redo();
21152289 } else
21162290 if (source == saveButton)
21172291 {
2118
- Save();
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
21192295 } else
21202296 if (source == oneStepButton)
21212297 {
....@@ -2124,17 +2300,14 @@
21242300 } else
21252301 if (source == screenfitButton)
21262302 {
2127
- //Reload(lastConverter, lastFilename, true);
21282303 ScreenFit();
21292304 } else
21302305 if (source == screenfitpointButton)
21312306 {
2132
- //Reload(lastConverter, lastFilename, true);
21332307 ScreenFitPoint();
21342308 } else
21352309 if (source == snapobjectButton)
21362310 {
2137
- //Reload(lastConverter, lastFilename, true);
21382311 SnapObject();
21392312 } else
21402313 // if (event.getSource() == recompileButton)
....@@ -2498,7 +2671,7 @@
24982671 {
24992672 StepAll();
25002673 } else
2501
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
25022675 {
25032676 //int indices[] = jList.getSelectedIndices();
25042677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2510,9 +2683,9 @@
25102683 {
25112684 ClearSelection(true);
25122685 } else
2513
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
25142687 {
2515
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
25162689 } else
25172690 if (source == hideItem)
25182691 {
....@@ -2530,11 +2703,11 @@
25302703 {
25312704 makeSomething(new Camera());
25322705 } else
2533
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
25342707 {
25352708 group(new Composite());
25362709 } else
2537
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
25382711 {
25392712 RandomNode random = new RandomNode();
25402713 group(random);
....@@ -2636,7 +2809,7 @@
26362809 {
26372810 group(new cLinker());
26382811 } else
2639
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
26402813 {
26412814 group(new TextureNode());
26422815 } else
....@@ -2658,15 +2831,28 @@
26582831 } else
26592832 if (source == ungroupItem || source == ungroupButton)
26602833 {
2661
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
26622836 for (int i=0; i<group.selection.size(); i++)
26632837 {
2664
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
26652843 }
26662844
2667
- ClearSelection(false);
2668
-
2669
- refreshContents();
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
26702856 } else
26712857 if (source == genUVItem)
26722858 {
....@@ -2967,7 +3153,7 @@
29673153 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
29683154 {
29693155 obj = (Object3D)e.nextElement();
2970
- obj.SetBumpTexture(null);
3156
+ obj.ResetBumpTexture();
29713157 }
29723158
29733159 refreshContents();
....@@ -3258,6 +3444,12 @@
32583444 } else
32593445 if (source == editItem || source == editButton)
32603446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
32613453 EditSelection(false);
32623454 } else
32633455 if (source == uneditButton)
....@@ -3267,6 +3459,7 @@
32673459 Object3D child = (Object3D)e.nextElement();
32683460 if(child.editWindow != null)
32693461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
32703463 child.CloseUI();
32713464 listUI.remove(child);
32723465
....@@ -3283,6 +3476,7 @@
32833476 //copy.ClearUI();
32843477 for (Object3D obj : listUI)
32853478 {
3479
+ obj.pinned = false;
32863480 obj.CloseUI();
32873481 }
32883482 listUI.clear();
....@@ -3292,7 +3486,7 @@
32923486 {
32933487 assert(copy == group);
32943488
3295
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32963490
32973491 for (Object3D obj : listUI)
32983492 {
....@@ -3341,6 +3535,9 @@
33413535 }
33423536
33433537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
33443541 //Globals.theRenderer.object = group;
33453542 if(!useclient)
33463543 {
....@@ -3367,6 +3564,13 @@
33673564 currentLayout = sevenButton;
33683565 */
33693566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
33703574 keepparent = group.parent;
33713575 // PARENT = NULL or not???
33723576 //group.parent = null; // ROOT
....@@ -3380,7 +3584,7 @@
33803584 cameraView.ProtectCamera();
33813585 cameraView.repaint();
33823586 return;
3383
- } else if (event.getSource() == revertCameraItem)
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33843588 {
33853589 cameraView.RevertCamera();
33863590 cameraView.repaint();
....@@ -3959,7 +4163,7 @@
39594163
39604164 try
39614165 {
3962
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4166
+ texturedata = Globals.theRenderer.GetTextureData(tex.pigmenttexture, pigment, false, node.texres);
39634167 }
39644168 catch (Exception e)
39654169 {
....@@ -4434,12 +4638,14 @@
44344638 // }
44354639 // }
44364640
4437
- static boolean allparams = true;
4438
-
4439
- static Vector<Object3D> listUI = new Vector<Object3D>();
4440
-
44414641 void EditSelection(boolean newWindow)
44424642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
44434649 // aConstraints.gridy = 0;
44444650 for (int i=0; i<group.selection.size(); i++)
44454651 {
....@@ -4450,12 +4656,7 @@
44504656 Object3D elem = (Object3D)group.selection.elementAt(i);
44514657 if(elem != group || !newWindow)
44524658 {
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
4659
+ EditElement(elem, newWindow); // ? new
44594660 }
44604661 }
44614662 }
....@@ -4530,7 +4731,8 @@
45304731 //new Exception().printStackTrace();
45314732
45324733 freezemodel = true;
4533
-
4734
+ ClearUnpinned();
4735
+
45344736 /**/
45354737 //switch (event.id)
45364738 {
....@@ -4563,7 +4765,7 @@
45634765 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
45644766 // a camera
45654767 {
4566
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
45674769 {
45684770 CameraPane.camerachangeframe = 0; // don't refuse it
45694771 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4572,6 +4774,13 @@
45724774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
45734775 }
45744776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
45754784 refreshContents();
45764785 //return true;
45774786 }
....@@ -4581,9 +4790,18 @@
45814790 freezemodel = false;
45824791 }
45834792
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
45844801 void refreshContents(boolean cp)
45854802 {
4586
- if (!Globals.MOUSEDRAGGED)
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45874805 {
45884806 objEditor.ClearInfo(); // .GetMaterial());
45894807
....@@ -4682,8 +4900,8 @@
46824900
46834901 if (cut)
46844902 {
4685
- if (Globals.SAVEONMAKE)
4686
- Save();
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
46874905 //int indices[] = jList.getSelectedIndices();
46884906 //for (int i = indices.length - 1; i >= 0; i--)
46894907 //jList.remove(indices[i]);
....@@ -4786,6 +5004,10 @@
47865004
47875005 void paste(boolean expand)
47885006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
47895011 // if (GrafreeD.clipboard == null)
47905012 // return;
47915013 boolean first = true;
....@@ -4845,6 +5067,7 @@
48455067 Grafreed.clipboard.get(0).parent = keepparent;
48465068 }
48475069
5070
+ Globals.REPLACEONMAKE = keep;
48485071 ResetModel();
48495072 refreshContents();
48505073 }
....@@ -4980,6 +5203,10 @@
49805203
49815204 void group(Object3D csg, boolean grab)
49825205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
49835210 if (//false) // why??
49845211 !group.selection.isEmpty())
49855212 {
....@@ -5093,10 +5320,15 @@
50935320 //node.add(csg);
50945321 //makeSomething(node);
50955322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
50965324 }
50975325
50985326 void Ungroup(Object3D g)
50995327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
51005332 if (g instanceof HiddenObject)
51015333 {
51025334 HiddenObject h = (HiddenObject) g;
....@@ -5113,6 +5345,7 @@
51135345 objEditor.makeSomething(g.get(i), false);
51145346 }
51155347 }
5348
+ Globals.REPLACEONMAKE = keep;
51165349 }
51175350
51185351 void ungroup()
....@@ -5401,17 +5634,17 @@
54015634 cButton clearpanelButton;
54025635 cButton unselectButton;
54035636
5404
- cButton minButton;
5405
- cButton maxButton;
5406
- cButton fullButton;
5407
- cButton undoButton;
5408
- cButton redoButton;
5637
+ cButton restoreCameraButton;
5638
+
54095639 cButton saveButton;
54105640 cButton oneStepButton;
54115641
54125642 cButton groupButton;
54135643 cButton ungroupButton;
54145644 cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
54155648
54165649 cButton gridButton;
54175650 cButton boxButton;
....@@ -5444,7 +5677,7 @@
54445677 //JTree jTree;
54455678 private MenuItem lookAtItem;
54465679 private MenuItem lookFromItem;
5447
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
54485681 private MenuItem cutItem;
54495682 private MenuItem undoItem;
54505683 private MenuItem redoItem;
....@@ -5476,7 +5709,7 @@
54765709 private MenuItem pasteLinkItem;
54775710 private MenuItem pasteCloneItem;
54785711 private MenuItem pasteExpandItem;
5479
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
54805713 private MenuItem clearAllItem;
54815714 private MenuItem genUVItem;
54825715 private MenuItem genNormalsMESHItem;
....@@ -5536,7 +5769,7 @@
55365769 private MenuItem frontItem;
55375770 private MenuItem cameraItem;
55385771 private MenuItem compositeItem;
5539
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
55405773 private MenuItem physicsItem;
55415774 private MenuItem frameselectorItem;
55425775 private MenuItem scriptNodeItem;
....@@ -5610,5 +5843,5 @@
56105843
56115844 Menu cameraMenu;
56125845 MenuItem editCameraItem;
5613
- MenuItem revertCameraItem;
5846
+ MenuItem restoreCameraItem;
56145847 }