Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
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 }
....@@ -74,6 +80,12 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
7789 SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +110,7 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
....@@ -150,6 +167,8 @@
150167
151168 void SetupMenu2(GroupEditor oe)
152169 {
170
+ oe.jTree = new cTree();
171
+
153172 Menu menu;
154173 oe.menuBar.add(menu = new Menu("Edit"));
155174 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +179,7 @@
160179 // redoItem = menu.add(new MenuItem("Redo"));
161180 // redoItem.addActionListener(this);
162181 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164183 duplicateItem.addActionListener(this);
165184 cloneItem = menu.add(new MenuItem("Clone"));
166185 cloneItem.addActionListener(this);
....@@ -202,23 +221,23 @@
202221 //zBufferItem.addActionListener(this);
203222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204223 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
207226
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212239
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222241 toggleHandleItem.addItemListener(this);
223242 toggleHandleItem.setState(CameraPane.HANDLES);
224243
....@@ -273,7 +292,7 @@
273292 {
274293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278297 oe.cameraMenu.add("-");
279298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +300,7 @@
281300 editLeafItem.addActionListener(this);
282301 lookAtItem.addActionListener(this);
283302 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
285304 }
286305
287306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +345,29 @@
326345 }
327346
328347 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
331350 backItem = menu.add(new MenuItem("Back"));
332351 backItem.addActionListener(this);
333352 frontItem = menu.add(new MenuItem("Front"));
334353 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
337359 hideItem = menu.add(new MenuItem("Hidden Group"));
338360 hideItem.addActionListener(this);
361
+ }
339362 ungroupItem = menu.add(new MenuItem("Ungroup"));
340363 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
344371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345372 switchGeoItem.addActionListener(this);
346373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +375,6 @@
348375 morphItem = menu.add(new MenuItem("Morph Group"));
349376 morphItem.addActionListener(this);
350377
351
- if (Globals.ADVANCED)
352
- {
353378 menu.add("-");
354379 physicsItem = menu.add(new MenuItem("Physics"));
355380 physicsItem.addActionListener(this);
....@@ -357,13 +382,11 @@
357382 frameselectorItem.addActionListener(this);
358383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359384 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362385 }
363386
364387 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
367390 billboardItem = menu.add(new MenuItem("Billboard"));
368391 billboardItem.addActionListener(this);
369392 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +397,14 @@
374397 shadowYItem.addActionListener(this);
375398 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
377403 if (Globals.ADVANCED)
378404 {
379405 menu.add("-");
380406 linkerItem = menu.add(new MenuItem("Linker"));
381407 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384408 templateItem = menu.add(new MenuItem("Template"));
385409 templateItem.addActionListener(this);
386410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -532,6 +556,7 @@
532556 buildToolsMenu(menu);
533557 }
534558
559
+
535560 void SetupUI2(ObjEditor oe)
536561 {
537562 // June 2019
....@@ -574,51 +599,79 @@
574599 oe.radioPanel.add(dummyButton);
575600 oe.buttonGroup.add(dummyButton);
576601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
577606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578607
579608 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580609 //minButton.setToolTipText("Minimize window");
581610 //minButton.addActionListener(this);
582611
583
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
586618
587619 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588620 fullButton.setToolTipText("Full-screen window");
589621 fullButton.addActionListener(this);
590622
591
- oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
594630
595
- oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
601633 saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
602639
603
- oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604659 liveCB.setToolTipText("Enable animation");
605660 liveCB.addItemListener(this);
606661
607
- oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
608
- fastCB.setToolTipText("Fast mode");
609
- fastCB.addItemListener(this);
610
-
611662 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612663 oneStepButton.setToolTipText("Animate one step forward");
613664 oneStepButton.addActionListener(this);
614665
615
- oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
667
+ fastCB.setToolTipText("Fast mode");
668
+ fastCB.addItemListener(this);
669
+
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
622675
623676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624677 // screenfitpointButton.addActionListener(this);
....@@ -630,15 +683,13 @@
630683 snapobjectButton.setToolTipText("Snap Object");
631684 }
632685
633
- oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Highlight selection");
635
- flashSelectionButton.addActionListener(this);
636
-
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638687
639688 oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640689 twoButton.setToolTipText("Show center view only");
641690 twoButton.addActionListener(this);
691
+ this.fullscreenLayout = twoButton;
692
+
642693 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643694 fourButton.addActionListener(this);
644695 fourButton.setToolTipText("Show left panel only");
....@@ -653,26 +704,105 @@
653704 sevenButton.addActionListener(this);
654705 //
655706
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657708 rootButton.setToolTipText("Edit selection in new tab");
658709 rootButton.addActionListener(this);
659710
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661712 closeButton.setToolTipText("Close tab");
662713 closeButton.addActionListener(this);
663714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664715 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
716
+
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
748
+
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
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
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
668798 editButton.addActionListener(this);
669799
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
672802 uneditButton.addActionListener(this);
673803
674804 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
805
+ allParamsButton.setToolTipText("Show all controle");
676806 allParamsButton.addActionListener(this);
677807
678808 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +813,13 @@
683813 unselectButton.setToolTipText("Unselect");
684814 unselectButton.addActionListener(this);
685815
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
819
+
686820 editCommandsPanel.preferredHeight = 1;
687821
822
+ SetPinStates(false);
688823 // oe.treePanel.add(commandsPanel);
689824 // oe.treePanel.Return();
690825
....@@ -703,29 +838,17 @@
703838
704839 JScrollPane jSP;
705840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707842 ResetModel();
708843
709844 oe.treePanel.add(jSPPanel);
710845 oe.treePanel.Return();
711846
712
- cGridBag copyOptionsPanel = new cGridBag();
713
-
714
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
- colorCB.setToolTipText("Copy color when dropped");
716
- colorCB.addItemListener(this);
717
-
718
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
- materialCB.setToolTipText("Copy material when dropped");
720
- materialCB.addItemListener(this);
721
-
722
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
- textureCB.setToolTipText("Copy texture when dropped");
724
- textureCB.addItemListener(this);
725
-
726
- copyOptionsPanel.preferredHeight = 1;
727847 oe.treePanel.add(copyOptionsPanel);
728848 oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
729852
730853 // mainPanel.setDividerLocation(0.5); //1.0);
731854 // mainPanel.setResizeWeight(0.5);
....@@ -754,23 +877,43 @@
754877
755878 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756879 {
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
883
+
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
757894 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758895 boxCB.setToolTipText("Display bounding boxes");
759896 boxCB.addItemListener(this);
760897
761898 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
763900 zoomBoxCB.addItemListener(this);
764901
765902 if (true) // Globals.ADVANCED)
766903 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
770911
771912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772913 // localCB.addItemListener(this);
773914
915
+ panel.Return();
916
+
774917 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775918 crowdCB.setToolTipText("Used for crowds");
776919 crowdCB.addItemListener(this);
....@@ -787,6 +930,8 @@
787930 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788931 // speakerMocapCB.addItemListener(this);
789932
933
+ panel.Return();
934
+
790935 if (false)
791936 {
792937 // handled in scripts
....@@ -801,24 +946,39 @@
801946 //constraints.gridy += 1;
802947 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803948 smoothfocusCB.addItemListener(this);
949
+ panel.Return();
804950 }
805951
806952 //constraints.gridx += 1;
807953 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808954 // debugCB.addItemListener(this);
809955
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
810960 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
961
+ oeilCB.setToolTipText("Move camera when tracking");
812962 oeilCB.addItemListener(this);
813963
814964 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
965
+ shadowCB.setToolTipText("When live compute shadows");
816966 shadowCB.addItemListener(this);
817967
818
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
- autosaveCB.setToolTipText("Auto-save on structure change");
820
- autosaveCB.addItemListener(this);
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
821980
981
+ panel.Return();
822982 if (Globals.ADVANCED)
823983 {
824984 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -829,10 +989,15 @@
829989 }
830990
831991 cGridBag fill = new cGridBag();
832
-
833992 fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
834997
835998 panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
8361001
8371002 }
8381003
....@@ -840,7 +1005,7 @@
8401005 {
8411006 cRadio radioButton = new cRadio(obj.name);
8421007
843
- // Patch to avoid bug with transparency.
1008
+ // June 2019. Patch to avoid bug with transparency.
8441009 radioButton.hadMaterial = obj.material != null;
8451010 if (!radioButton.hadMaterial)
8461011 {
....@@ -868,15 +1033,17 @@
8681033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8691034 }
8701035
871
- cCheckBox liveCB;
1036
+ cToggleButton liveCB;
8721037 cCheckBox supportCB;
8731038 cCheckBox localCB;
8741039 cCheckBox crowdCB;
8751040 cCheckBox smoothCB;
876
- cCheckBox fastCB;
1041
+ cToggleButton fastCB;
8771042 cCheckBox slowCB;
8781043 cCheckBox boxCB;
8791044 cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
8801047 cCheckBox trackCB;
8811048 cCheckBox smoothfocusCB;
8821049 // JCheckBox speakerMocapCB;
....@@ -886,7 +1053,7 @@
8861053
8871054 cCheckBox oeilCB;
8881055 cCheckBox shadowCB;
889
- cCheckBox autosaveCB;
1056
+ cCheckBox autokeepCB;
8901057 cCheckBox lookAtCB;
8911058
8921059 // static int COLOR = 1;
....@@ -994,9 +1161,13 @@
9941161 {
9951162 Globals.COMPUTESHADOWWHENLIVE ^= true;
9961163 }
997
- else if(e.getSource() == autosaveCB)
1164
+ else if(e.getSource() == freezeCB)
9981165 {
999
- Globals.SAVEONMAKE ^= true;
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
10001171 }
10011172 else if(e.getSource() == lookAtCB)
10021173 {
....@@ -1014,7 +1185,8 @@
10141185
10151186 /**/
10161187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1017
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
10181190 if ((path == null) || (path.getPathCount() <= 1)) {
10191191 // We can't move the root node or an empty selection
10201192 return;
....@@ -1077,8 +1249,6 @@
10771249 }
10781250 }
10791251
1080
- String string = (String) object;
1081
-
10821252 System.out.println("Transfer = " + object + "; drop : " + target);
10831253 // if( object instanceof java.io.File[])
10841254 // {
....@@ -1086,6 +1256,8 @@
10861256 // objEditor.DropFile((java.io.File[]) object, true);
10871257 // return;
10881258 // }
1259
+
1260
+ String string = object.toString();
10891261
10901262 // File path for Mac and Windows
10911263 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1131,23 +1303,33 @@
11311303
11321304 assert target == objEditor.jTree;
11331305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
11341307 try {
1135
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11361309 } catch (Exception e) {
11371310 System.out.println("destinationPath : " + destinationPath);
11381311 return;
11391312 }
11401313
1141
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
11421315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
11431325 loadClipboard(true);
11441326 objEditor.jTree.setSelectionPath(destinationPath);
11451327 pasteInto(false, false);
1146
- } else {
1147
- loadClipboard(false);
1148
- objEditor.jTree.setSelectionPath(destinationPath);
1149
- pasteInto(false, false); // true); // ???
1150
- }
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
11511333 }
11521334 public void dropActionChanged(DropTargetDragEvent dtde)
11531335 // Called if the user has modified the current drop gesture
....@@ -1252,22 +1434,30 @@
12521434 {
12531435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12541436 //heightFieldItem.addActionListener(this);
1255
- gridItem = menu.add(new MenuItem("Grid"));
1256
- gridItem.addActionListener(this);
1257
- rectoidItem = menu.add(new MenuItem("Box"));
1258
- rectoidItem.addActionListener(this);
1259
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1260
- ellipsoidItem.addActionListener(this);
1261
- coneItem = menu.add(new MenuItem("Cone"));
1262
- coneItem.addActionListener(this);
1263
- torusItem = menu.add(new MenuItem("Torus"));
1264
- torusItem.addActionListener(this);
1265
- superItem = menu.add(new MenuItem("Superellipsoid"));
1266
- superItem.addActionListener(this);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
12671455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12681456 kleinItem.addActionListener(this);
1269
- particleItem = menu.add(new MenuItem("Particle system"));
1270
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
12711461 if (Globals.ADVANCED)
12721462 {
12731463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1293,15 +1483,15 @@
12931483 }
12941484 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12951485 bezierItem.addActionListener(this);
1296
- overlayItem = menu.add(new MenuItem("Overlay"));
1297
- overlayItem.addActionListener(this);
1298
- lightItem = menu.add(new MenuItem("Light"));
1299
- lightItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
13001490 menu.add("-");
13011491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13021492 //superLoopItem.addActionListener(this);
1303
- loopItem = menu.add(new MenuItem("Loop"));
1304
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
13051495 doubleItem = menu.add(new MenuItem("Fork"));
13061496 doubleItem.addActionListener(this);
13071497 if (Globals.ADVANCED)
....@@ -1317,6 +1507,9 @@
13171507 animationItem.addItemListener(this);
13181508 animationItem.setState(Globals.ANIMATION);
13191509
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
1512
+
13201513 menu.add("-");
13211514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13221515 parseverticesItem.addActionListener(this);
....@@ -1329,6 +1522,8 @@
13291522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13301523 reduce34MorphItem.addActionListener(this);
13311524 menu.add("-");
1525
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1526
+ memoryItem.addActionListener(this);
13321527 menu.add(computeAOItem = new MenuItem("Compute AO"));
13331528 computeAOItem.addActionListener(this);
13341529
....@@ -1337,8 +1532,6 @@
13371532 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13381533 mirrorItem.addActionListener(this);
13391534 menu.add("-");
1340
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1341
- memoryItem.addActionListener(this);
13421535 menu.add(analyzeItem = new MenuItem("Analyze"));
13431536 analyzeItem.addActionListener(this);
13441537 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1486,6 +1679,20 @@
14861679
14871680 makeSomething(shadow);
14881681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
14891696
14901697 /**
14911698 * applyExample
....@@ -1730,7 +1937,7 @@
17301937 {
17311938 ScreenFit();
17321939 } else
1733
- if (source == switchItem)
1940
+ if (source == switchViewItem)
17341941 {
17351942 cVector v1 = new cVector();
17361943 cVector v2 = new cVector();
....@@ -1739,11 +1946,11 @@
17391946 objEditor.cameraView.renderCamera.setAim(v2, v1);
17401947 objEditor.cameraView.repaint();
17411948 } else
1742
- if (source == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
17431950 {
17441951 makeSomething(new Box());
17451952 } else
1746
- if (source == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
17471954 {
17481955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17491956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1822,27 +2029,27 @@
18222029
18232030 makeSomething(obj);
18242031 } else
1825
- if (source == gridItem)
2032
+ if (source == gridItem || source == gridButton)
18262033 {
18272034 makeSomething(new Grid());
18282035 } else
1829
- if (source == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
18302037 {
18312038 makeSomething(new Sphere());
18322039 } else
1833
- if (source == coneItem)
2040
+ if (source == coneItem || source == coneButton)
18342041 {
18352042 makeSomething(new Cone());
18362043 } else
1837
- if (source == torusItem)
2044
+ if (source == torusItem || source == torusButton)
18382045 {
18392046 makeSomething(new Torus());
18402047 } else
1841
- if (source == superItem)
2048
+ if (source == superItem || source == superButton)
18422049 {
18432050 makeSomething(new Superellipsoid());
18442051 } else
1845
- if (source == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
18462053 {
18472054 makeSomething(new Klein());
18482055 } else
....@@ -1862,7 +2069,7 @@
18622069 {
18632070 makeSomething(new BezierSurface());
18642071 } else
1865
- if (source == overlayItem)
2072
+ if (source == overlayItem || source == overlayButton)
18662073 {
18672074 /*
18682075 Object3D obj = new BezierSurface(5,8);
....@@ -1910,7 +2117,7 @@
19102117 s.setup();
19112118 makeSomething(s);
19122119 } else
1913
- if (source == lightItem)
2120
+ if (source == lightItem || source == lightButton)
19142121 {
19152122 makeSomething(new Light());
19162123 } else
....@@ -1960,30 +2167,30 @@
19602167
19612168 group(g);
19622169 } else
1963
- if (source == loopItem)
2170
+ if (source == loopItem || source == loopButton)
19642171 {
19652172 Composite csg = new GroupLeaf();
19662173 csg.count = 5;
19672174 group(csg);
1968
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
19692176 csg.addChild(child);
19702177 child.addChild(csg);
19712178 } else
19722179 if (source == doubleItem)
19732180 {
1974
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
19752182 csg.count = 5;
19762183 group(csg);
1977
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
19782185 csg.addChild(child);
19792186 child.addChild(csg);
1980
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
19812188 csg.addChild(child);
19822189 child.addChild(csg);
19832190 } else
19842191 if (source == tripleItem)
19852192 {
1986
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
19872194 csg.count = 4;
19882195 group(csg);
19892196 Composite child = new cGroup();
....@@ -2047,15 +2254,31 @@
20472254 } else
20482255 if (source == undoButton)
20492256 {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20502260 Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
20512271 } else
20522272 if (source == redoButton)
20532273 {
2274
+ // Go to next version
20542275 Redo();
20552276 } else
20562277 if (source == saveButton)
20572278 {
2058
- Save();
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
20592282 } else
20602283 if (source == oneStepButton)
20612284 {
....@@ -2064,17 +2287,14 @@
20642287 } else
20652288 if (source == screenfitButton)
20662289 {
2067
- //Reload(lastConverter, lastFilename, true);
20682290 ScreenFit();
20692291 } else
20702292 if (source == screenfitpointButton)
20712293 {
2072
- //Reload(lastConverter, lastFilename, true);
20732294 ScreenFitPoint();
20742295 } else
20752296 if (source == snapobjectButton)
20762297 {
2077
- //Reload(lastConverter, lastFilename, true);
20782298 SnapObject();
20792299 } else
20802300 // if (event.getSource() == recompileButton)
....@@ -2450,9 +2670,9 @@
24502670 {
24512671 ClearSelection(true);
24522672 } else
2453
- if (source == grabItem)
2673
+ if (source == grabItem || source == groupButton)
24542674 {
2455
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
24562676 } else
24572677 if (source == hideItem)
24582678 {
....@@ -2470,11 +2690,11 @@
24702690 {
24712691 makeSomething(new Camera());
24722692 } else
2473
- if (source == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
24742694 {
24752695 group(new Composite());
24762696 } else
2477
- if (source == randomItem)
2697
+ if (source == switchItem || source == switchButton)
24782698 {
24792699 RandomNode random = new RandomNode();
24802700 group(random);
....@@ -2576,7 +2796,7 @@
25762796 {
25772797 group(new cLinker());
25782798 } else
2579
- if (source == textureItem)
2799
+ if (source == textureItem || source == textureButton)
25802800 {
25812801 group(new TextureNode());
25822802 } else
....@@ -2596,17 +2816,30 @@
25962816 {
25972817 CastShadow(2);
25982818 } else
2599
- if (source == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
26002820 {
2601
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
26022823 for (int i=0; i<group.selection.size(); i++)
26032824 {
2604
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
26052830 }
26062831
2607
- ClearSelection(false);
2608
-
2609
- refreshContents();
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
26102843 } else
26112844 if (source == genUVItem)
26122845 {
....@@ -2934,6 +3167,10 @@
29343167 if (source == twoButton)
29353168 {
29363169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
29373174 // bug
29383175 //gridPanel.setDividerLocation(1.0);
29393176 //bigPanel.setDividerLocation(0.0);
....@@ -2989,6 +3226,9 @@
29893226 {
29903227 radio.layout = threeButton;
29913228
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
3231
+
29923232 // bigThree.remove(scenePanel);
29933233 // bigThree.remove(centralPanel);
29943234 // bigThree.remove(XYZPanel);
....@@ -3027,6 +3267,9 @@
30273267 {
30283268 radio.layout = fourButton;
30293269
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
3272
+
30303273 // bigThree.remove(scenePanel);
30313274 // bigThree.remove(centralPanel);
30323275 // bigThree.remove(XYZPanel);
....@@ -3063,6 +3306,9 @@
30633306 if (source == sixButton)
30643307 {
30653308 radio.layout = sixButton;
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
30663312
30673313 // bigThree.remove(scenePanel);
30683314 // bigThree.remove(centralPanel);
....@@ -3101,6 +3347,9 @@
31013347 if (source == sevenButton)
31023348 {
31033349 radio.layout = sevenButton;
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
31043353
31053354 // bigThree.remove(scenePanel);
31063355 // bigThree.remove(centralPanel);
....@@ -3182,6 +3431,12 @@
31823431 } else
31833432 if (source == editItem || source == editButton)
31843433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
31853440 EditSelection(false);
31863441 } else
31873442 if (source == uneditButton)
....@@ -3191,6 +3446,7 @@
31913446 Object3D child = (Object3D)e.nextElement();
31923447 if(child.editWindow != null)
31933448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
31943450 child.CloseUI();
31953451 listUI.remove(child);
31963452
....@@ -3207,6 +3463,7 @@
32073463 //copy.ClearUI();
32083464 for (Object3D obj : listUI)
32093465 {
3466
+ obj.pinned = false;
32103467 obj.CloseUI();
32113468 }
32123469 listUI.clear();
....@@ -3216,7 +3473,7 @@
32163473 {
32173474 assert(copy == group);
32183475
3219
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32203477
32213478 for (Object3D obj : listUI)
32223479 {
....@@ -3265,6 +3522,9 @@
32653522 }
32663523
32673524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
32683528 //Globals.theRenderer.object = group;
32693529 if(!useclient)
32703530 {
....@@ -3291,6 +3551,13 @@
32913551 currentLayout = sevenButton;
32923552 */
32933553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
32943561 keepparent = group.parent;
32953562 // PARENT = NULL or not???
32963563 //group.parent = null; // ROOT
....@@ -3304,7 +3571,7 @@
33043571 cameraView.ProtectCamera();
33053572 cameraView.repaint();
33063573 return;
3307
- } else if (event.getSource() == revertCameraItem)
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33083575 {
33093576 cameraView.RevertCamera();
33103577 cameraView.repaint();
....@@ -4358,10 +4625,6 @@
43584625 // }
43594626 // }
43604627
4361
- static boolean allparams = true;
4362
-
4363
- static Vector<Object3D> listUI = new Vector<Object3D>();
4364
-
43654628 void EditSelection(boolean newWindow)
43664629 {
43674630 // aConstraints.gridy = 0;
....@@ -4369,7 +4632,7 @@
43694632 {
43704633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43714634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4372
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43734636
43744637 Object3D elem = (Object3D)group.selection.elementAt(i);
43754638 if(elem != group || !newWindow)
....@@ -4454,7 +4717,8 @@
44544717 //new Exception().printStackTrace();
44554718
44564719 freezemodel = true;
4457
-
4720
+ ClearUnpinned();
4721
+
44584722 /**/
44594723 //switch (event.id)
44604724 {
....@@ -4487,7 +4751,7 @@
44874751 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44884752 // a camera
44894753 {
4490
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44914755 {
44924756 CameraPane.camerachangeframe = 0; // don't refuse it
44934757 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4496,6 +4760,13 @@
44964760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44974761 }
44984762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
44994770 refreshContents();
45004771 //return true;
45014772 }
....@@ -4505,9 +4776,18 @@
45054776 freezemodel = false;
45064777 }
45074778
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
45084787 void refreshContents(boolean cp)
45094788 {
4510
- if (!Globals.MOUSEDRAGGED)
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45114791 {
45124792 objEditor.ClearInfo(); // .GetMaterial());
45134793
....@@ -4606,8 +4886,8 @@
46064886
46074887 if (cut)
46084888 {
4609
- if (Globals.SAVEONMAKE)
4610
- Save();
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
46114891 //int indices[] = jList.getSelectedIndices();
46124892 //for (int i = indices.length - 1; i >= 0; i--)
46134893 //jList.remove(indices[i]);
....@@ -4710,6 +4990,10 @@
47104990
47114991 void paste(boolean expand)
47124992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
47134997 // if (GrafreeD.clipboard == null)
47144998 // return;
47154999 boolean first = true;
....@@ -4769,6 +5053,7 @@
47695053 Grafreed.clipboard.get(0).parent = keepparent;
47705054 }
47715055
5056
+ Globals.REPLACEONMAKE = keep;
47725057 ResetModel();
47735058 refreshContents();
47745059 }
....@@ -4904,6 +5189,10 @@
49045189
49055190 void group(Object3D csg, boolean grab)
49065191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
49075196 if (//false) // why??
49085197 !group.selection.isEmpty())
49095198 {
....@@ -5017,10 +5306,15 @@
50175306 //node.add(csg);
50185307 //makeSomething(node);
50195308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
50205310 }
50215311
50225312 void Ungroup(Object3D g)
50235313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
50245318 if (g instanceof HiddenObject)
50255319 {
50265320 HiddenObject h = (HiddenObject) g;
....@@ -5037,6 +5331,7 @@
50375331 objEditor.makeSomething(g.get(i), false);
50385332 }
50395333 }
5334
+ Globals.REPLACEONMAKE = keep;
50405335 }
50415336
50425337 void ungroup()
....@@ -5325,13 +5620,28 @@
53255620 cButton clearpanelButton;
53265621 cButton unselectButton;
53275622
5328
- cButton minButton;
5329
- cButton maxButton;
5330
- cButton fullButton;
5331
- cButton undoButton;
5332
- cButton redoButton;
5623
+ cButton restoreCameraButton;
5624
+
53335625 cButton saveButton;
53345626 cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
53355645
53365646 cButton screenfitButton;
53375647 cButton screenfitpointButton;
....@@ -5353,11 +5663,11 @@
53535663 //JTree jTree;
53545664 private MenuItem lookAtItem;
53555665 private MenuItem lookFromItem;
5356
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
53575667 private MenuItem cutItem;
53585668 private MenuItem undoItem;
53595669 private MenuItem redoItem;
5360
- private MenuItem duplicateItem;
5670
+ private JMenuItem duplicateItem;
53615671 private MenuItem cloneItem;
53625672 private MenuItem cloneSupportItem;
53635673 private MenuItem overwriteGeoItem;
....@@ -5445,7 +5755,7 @@
54455755 private MenuItem frontItem;
54465756 private MenuItem cameraItem;
54475757 private MenuItem compositeItem;
5448
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
54495759 private MenuItem physicsItem;
54505760 private MenuItem frameselectorItem;
54515761 private MenuItem scriptNodeItem;
....@@ -5519,5 +5829,5 @@
55195829
55205830 Menu cameraMenu;
55215831 MenuItem editCameraItem;
5522
- MenuItem revertCameraItem;
5832
+ MenuItem restoreCameraItem;
55235833 }