Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.REPLACEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +98,7 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.REPLACEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
....@@ -150,6 +155,8 @@
150155
151156 void SetupMenu2(GroupEditor oe)
152157 {
158
+ oe.jTree = new cTree();
159
+
153160 Menu menu;
154161 oe.menuBar.add(menu = new Menu("Edit"));
155162 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +167,7 @@
160167 // redoItem = menu.add(new MenuItem("Redo"));
161168 // redoItem.addActionListener(this);
162169 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
170
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164171 duplicateItem.addActionListener(this);
165172 cloneItem = menu.add(new MenuItem("Clone"));
166173 cloneItem.addActionListener(this);
....@@ -202,23 +209,23 @@
202209 //zBufferItem.addActionListener(this);
203210 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204211 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
207214
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
215
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
216
+// toggleFullScreenItem.addItemListener(this);
217
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
218
+// cameraMenu.add("-");
219
+//
220
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
221
+// toggleTextureItem.addItemListener(this);
222
+// toggleTextureItem.setState(CameraPane.textureon);
223
+//
224
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
225
+// toggleSwitchItem.addItemListener(this);
226
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212227
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"));
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222229 toggleHandleItem.addItemListener(this);
223230 toggleHandleItem.setState(CameraPane.HANDLES);
224231
....@@ -273,7 +280,7 @@
273280 {
274281 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275282 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277284 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278285 oe.cameraMenu.add("-");
279286 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +288,7 @@
281288 editLeafItem.addActionListener(this);
282289 lookAtItem.addActionListener(this);
283290 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
291
+ //switchViewItem.addActionListener(this);
285292 }
286293
287294 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +333,29 @@
326333 }
327334
328335 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
331338 backItem = menu.add(new MenuItem("Back"));
332339 backItem.addActionListener(this);
333340 frontItem = menu.add(new MenuItem("Front"));
334341 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
337347 hideItem = menu.add(new MenuItem("Hidden Group"));
338348 hideItem.addActionListener(this);
349
+ }
339350 ungroupItem = menu.add(new MenuItem("Ungroup"));
340351 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
352
+
353
+// menu.add("-");
354
+//
355
+// switchItem = menu.add(new MenuItem("Switch node"));
356
+// switchItem.addActionListener(this);
357
+ if (Globals.ADVANCED)
358
+ {
344359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345360 switchGeoItem.addActionListener(this);
346361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +363,6 @@
348363 morphItem = menu.add(new MenuItem("Morph Group"));
349364 morphItem.addActionListener(this);
350365
351
- if (Globals.ADVANCED)
352
- {
353366 menu.add("-");
354367 physicsItem = menu.add(new MenuItem("Physics"));
355368 physicsItem.addActionListener(this);
....@@ -357,13 +370,11 @@
357370 frameselectorItem.addActionListener(this);
358371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359372 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362373 }
363374
364375 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
367378 billboardItem = menu.add(new MenuItem("Billboard"));
368379 billboardItem.addActionListener(this);
369380 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +385,14 @@
374385 shadowYItem.addActionListener(this);
375386 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
377391 if (Globals.ADVANCED)
378392 {
379393 menu.add("-");
380394 linkerItem = menu.add(new MenuItem("Linker"));
381395 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384396 templateItem = menu.add(new MenuItem("Template"));
385397 templateItem.addActionListener(this);
386398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -532,6 +544,7 @@
532544 buildToolsMenu(menu);
533545 }
534546
547
+
535548 void SetupUI2(ObjEditor oe)
536549 {
537550 // June 2019
....@@ -574,51 +587,79 @@
574587 oe.radioPanel.add(dummyButton);
575588 oe.buttonGroup.add(dummyButton);
576589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
577594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578595
579596 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580597 //minButton.setToolTipText("Minimize window");
581598 //minButton.addActionListener(this);
582599
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
600
+ if (Globals.ADVANCED)
601
+ {
602
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ maxButton.setToolTipText("Maximize window");
604
+ maxButton.addActionListener(this);
605
+ }
586606
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588608 fullButton.setToolTipText("Full-screen window");
589609 fullButton.addActionListener(this);
590610
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
611
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ screenfitButton.setToolTipText("Screen fit");
613
+ screenfitButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
+ restoreCameraButton.setToolTipText("Restore viewpoint");
617
+ restoreCameraButton.addActionListener(this);
594618
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
601621 saveButton.addActionListener(this);
622
+
623
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ undoButton.setToolTipText("Previous version");
625
+ undoButton.addActionListener(this);
626
+ undoButton.setEnabled(false);
602627
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
641
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ redoButton.setToolTipText("Next version");
643
+ redoButton.addActionListener(this);
644
+ redoButton.setEnabled(false);
645
+
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604647 liveCB.setToolTipText("Enable animation");
605648 liveCB.addItemListener(this);
606649
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608651 oneStepButton.setToolTipText("Animate one step forward");
609652 oneStepButton.addActionListener(this);
610653
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612655 fastCB.setToolTipText("Fast mode");
613656 fastCB.addItemListener(this);
614657
615
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
658
+ //oe.toolboxPanel.Return();
659
+
660
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
661
+// trackCB.setToolTipText("Enable tracking");
662
+// trackCB.addItemListener(this);
622663
623664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624665 // screenfitpointButton.addActionListener(this);
....@@ -630,15 +671,13 @@
630671 snapobjectButton.setToolTipText("Snap Object");
631672 }
632673
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
636
-
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638675
639676 oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640677 twoButton.setToolTipText("Show center view only");
641678 twoButton.addActionListener(this);
679
+ this.fullscreenLayout = twoButton;
680
+
642681 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643682 fourButton.addActionListener(this);
644683 fourButton.setToolTipText("Show left panel only");
....@@ -653,26 +692,105 @@
653692 sevenButton.addActionListener(this);
654693 //
655694
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657696 rootButton.setToolTipText("Edit selection in new tab");
658697 rootButton.addActionListener(this);
659698
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661700 closeButton.setToolTipText("Close tab");
662701 closeButton.addActionListener(this);
663702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664703 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
704
+
705
+ // INSERT
706
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ gridButton.setToolTipText("Create grid");
708
+ gridButton.addActionListener(this);
709
+
710
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ boxButton.setToolTipText("Create box");
712
+ boxButton.addActionListener(this);
713
+
714
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
715
+ sphereButton.setToolTipText("Create sphere");
716
+ sphereButton.addActionListener(this);
717
+
718
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ coneButton.setToolTipText("Create cone");
720
+ coneButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ torusButton.setToolTipText("Create torus");
724
+ torusButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ superButton.setToolTipText("Create superellipsoid");
728
+ superButton.addActionListener(this);
729
+
730
+ if (Globals.ADVANCED)
731
+ {
732
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ kleinButton.setToolTipText("Create Klein bottle");
734
+ kleinButton.addActionListener(this);
735
+ }
736
+
737
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ particlesButton.setToolTipText("Create particle system");
739
+ particlesButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.Return();
742
+
743
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ groupButton.setToolTipText("Create group");
745
+ groupButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ compositeButton.setToolTipText("Create composite");
749
+ compositeButton.addActionListener(this);
750
+
751
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
+ switchButton.setToolTipText("Create item switcher");
753
+ switchButton.addActionListener(this);
754
+
755
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ loopButton.setToolTipText("Create loop");
757
+ loopButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ textureButton.setToolTipText("Create texture");
761
+ textureButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ overlayButton.setToolTipText("Create overlay");
765
+ overlayButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ lightButton.setToolTipText("Create light");
769
+ lightButton.addActionListener(this);
770
+
771
+ for (int i=6; --i>=0;)
772
+ {
773
+ oe.toolboxPanel.Return();
774
+ oe.toolboxPanel.add(new cGridBag());
775
+ oe.toolboxPanel.add(new cGridBag());
776
+ oe.toolboxPanel.add(new cGridBag());
777
+ oe.toolboxPanel.add(new cGridBag());
778
+ oe.toolboxPanel.add(new cGridBag());
779
+ oe.toolboxPanel.add(new cGridBag());
780
+ oe.toolboxPanel.add(new cGridBag());
781
+ }
782
+
783
+ // EDIT panel
784
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ editButton.setToolTipText("Pin selection controls");
668786 editButton.addActionListener(this);
669787
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
672790 uneditButton.addActionListener(this);
673791
674792 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
793
+ allParamsButton.setToolTipText("Show all controle");
676794 allParamsButton.addActionListener(this);
677795
678796 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +801,13 @@
683801 unselectButton.setToolTipText("Unselect");
684802 unselectButton.addActionListener(this);
685803
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
807
+
686808 editCommandsPanel.preferredHeight = 1;
687809
810
+ SetPinStates(false);
688811 // oe.treePanel.add(commandsPanel);
689812 // oe.treePanel.Return();
690813
....@@ -703,29 +826,17 @@
703826
704827 JScrollPane jSP;
705828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707830 ResetModel();
708831
709832 oe.treePanel.add(jSPPanel);
710833 oe.treePanel.Return();
711834
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;
727835 oe.treePanel.add(copyOptionsPanel);
728836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
729840
730841 // mainPanel.setDividerLocation(0.5); //1.0);
731842 // mainPanel.setResizeWeight(0.5);
....@@ -754,23 +865,43 @@
754865
755866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756867 {
868
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
869
+ colorCB.setToolTipText("Copy color when dropped");
870
+ colorCB.addItemListener(this);
871
+
872
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
873
+ materialCB.setToolTipText("Copy material when dropped");
874
+ materialCB.addItemListener(this);
875
+
876
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
877
+ textureCB.setToolTipText("Copy texture when dropped");
878
+ textureCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
757882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758883 boxCB.setToolTipText("Display bounding boxes");
759884 boxCB.addItemListener(this);
760885
761886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
763888 zoomBoxCB.addItemListener(this);
764889
765890 if (true) // Globals.ADVANCED)
766891 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
892
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
893
+// supportCB.setToolTipText("Enable rigging");
894
+// supportCB.addItemListener(this);
895
+
896
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
897
+ freezeCB.setToolTipText("Fast moving camera");
898
+ freezeCB.addItemListener(this);
770899
771900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772901 // localCB.addItemListener(this);
773902
903
+ panel.Return();
904
+
774905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775906 crowdCB.setToolTipText("Used for crowds");
776907 crowdCB.addItemListener(this);
....@@ -787,6 +918,8 @@
787918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788919 // speakerMocapCB.addItemListener(this);
789920
921
+ panel.Return();
922
+
790923 if (false)
791924 {
792925 // handled in scripts
....@@ -801,20 +934,39 @@
801934 //constraints.gridy += 1;
802935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
804938 }
805939
806940 //constraints.gridx += 1;
807941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808942 // debugCB.addItemListener(this);
809943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
810948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
949
+ oeilCB.setToolTipText("Move camera when tracking");
812950 oeilCB.addItemListener(this);
813951
814952 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
953
+ shadowCB.setToolTipText("When live compute shadows");
816954 shadowCB.addItemListener(this);
817955
956
+ panel.Return();
957
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
958
+ toggleTextureCB.setToolTipText("Load textures");
959
+ toggleTextureCB.addItemListener(this);
960
+
961
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
962
+ toggleSwitchCB.setToolTipText("Choose a single item");
963
+ toggleSwitchCB.addItemListener(this);
964
+
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
968
+
969
+ panel.Return();
818970 if (Globals.ADVANCED)
819971 {
820972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -825,10 +977,15 @@
825977 }
826978
827979 cGridBag fill = new cGridBag();
828
-
829980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
830985
831986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
832989
833990 }
834991
....@@ -836,7 +993,7 @@
836993 {
837994 cRadio radioButton = new cRadio(obj.name);
838995
839
- // Patch to avoid bug with transparency.
996
+ // June 2019. Patch to avoid bug with transparency.
840997 radioButton.hadMaterial = obj.material != null;
841998 if (!radioButton.hadMaterial)
842999 {
....@@ -864,25 +1021,28 @@
8641021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8651022 }
8661023
867
- JCheckBox liveCB;
868
- JCheckBox supportCB;
869
- JCheckBox localCB;
870
- JCheckBox crowdCB;
871
- JCheckBox smoothCB;
872
- JCheckBox fastCB;
873
- JCheckBox slowCB;
874
- JCheckBox boxCB;
875
- JCheckBox zoomBoxCB;
876
- JCheckBox trackCB;
877
- JCheckBox smoothfocusCB;
1024
+ cToggleButton liveCB;
1025
+ cCheckBox supportCB;
1026
+ cCheckBox localCB;
1027
+ cCheckBox crowdCB;
1028
+ cCheckBox smoothCB;
1029
+ cToggleButton fastCB;
1030
+ cCheckBox slowCB;
1031
+ cCheckBox boxCB;
1032
+ cCheckBox zoomBoxCB;
1033
+ cCheckBox freezeCB;
1034
+ //cToggleButton trackCB;
1035
+ cCheckBox trackCB;
1036
+ cCheckBox smoothfocusCB;
8781037 // JCheckBox speakerMocapCB;
879
- JCheckBox speakerCameraCB;
880
- JCheckBox speakerFocusCB;
881
- JCheckBox debugCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
8821041
883
- JCheckBox oeilCB;
884
- JCheckBox shadowCB;
885
- JCheckBox lookAtCB;
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
8861046
8871047 // static int COLOR = 1;
8881048 // static int MATERIAL = 2;
....@@ -890,9 +1050,9 @@
8901050
8911051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8921052
893
- JCheckBox colorCB;
894
- JCheckBox materialCB;
895
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
8961056
8971057 public void itemStateChanged(ItemEvent e)
8981058 {
....@@ -989,6 +1149,14 @@
9891149 {
9901150 Globals.COMPUTESHADOWWHENLIVE ^= true;
9911151 }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
9921160 else if(e.getSource() == lookAtCB)
9931161 {
9941162 cameraView.ToggleLookAt();
....@@ -1005,7 +1173,8 @@
10051173
10061174 /**/
10071175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1008
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
10091178 if ((path == null) || (path.getPathCount() <= 1)) {
10101179 // We can't move the root node or an empty selection
10111180 return;
....@@ -1068,8 +1237,6 @@
10681237 }
10691238 }
10701239
1071
- String string = (String) object;
1072
-
10731240 System.out.println("Transfer = " + object + "; drop : " + target);
10741241 // if( object instanceof java.io.File[])
10751242 // {
....@@ -1077,6 +1244,8 @@
10771244 // objEditor.DropFile((java.io.File[]) object, true);
10781245 // return;
10791246 // }
1247
+
1248
+ String string = object.toString();
10801249
10811250 // File path for Mac and Windows
10821251 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1122,23 +1291,33 @@
11221291
11231292 assert target == objEditor.jTree;
11241293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
11251295 try {
1126
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11271297 } catch (Exception e) {
11281298 System.out.println("destinationPath : " + destinationPath);
11291299 return;
11301300 }
11311301
1132
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
11331303 {
1304
+ Object3D child = (Object3D)group.selection.elementAt(i);
1305
+
1306
+ // Cannot move into itself
1307
+ if (child == destinationLeaf)
1308
+ return;
1309
+ }
1310
+
1311
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1312
+// {
11341313 loadClipboard(true);
11351314 objEditor.jTree.setSelectionPath(destinationPath);
11361315 pasteInto(false, false);
1137
- } else {
1138
- loadClipboard(false);
1139
- objEditor.jTree.setSelectionPath(destinationPath);
1140
- pasteInto(false, false); // true); // ???
1141
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
11421321 }
11431322 public void dropActionChanged(DropTargetDragEvent dtde)
11441323 // Called if the user has modified the current drop gesture
....@@ -1243,22 +1422,30 @@
12431422 {
12441423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12451424 //heightFieldItem.addActionListener(this);
1246
- gridItem = menu.add(new MenuItem("Grid"));
1247
- gridItem.addActionListener(this);
1248
- rectoidItem = menu.add(new MenuItem("Box"));
1249
- rectoidItem.addActionListener(this);
1250
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1251
- ellipsoidItem.addActionListener(this);
1252
- coneItem = menu.add(new MenuItem("Cone"));
1253
- coneItem.addActionListener(this);
1254
- torusItem = menu.add(new MenuItem("Torus"));
1255
- torusItem.addActionListener(this);
1256
- superItem = menu.add(new MenuItem("Superellipsoid"));
1257
- superItem.addActionListener(this);
1425
+// gridItem = menu.add(new MenuItem("Grid"));
1426
+// gridItem.addActionListener(this);
1427
+// rectoidItem = menu.add(new MenuItem("Box"));
1428
+// rectoidItem.addActionListener(this);
1429
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1430
+// ellipsoidItem.addActionListener(this);
1431
+// coneItem = menu.add(new MenuItem("Cone"));
1432
+// coneItem.addActionListener(this);
1433
+// torusItem = menu.add(new MenuItem("Torus"));
1434
+// torusItem.addActionListener(this);
1435
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1436
+// superItem.addActionListener(this);
1437
+
1438
+ cameraItem = menu.add(new MenuItem("Camera"));
1439
+ cameraItem.addActionListener(this);
1440
+
1441
+ if (!Globals.ADVANCED)
1442
+ {
12581443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12591444 kleinItem.addActionListener(this);
1260
- particleItem = menu.add(new MenuItem("Particle system"));
1261
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
12621449 if (Globals.ADVANCED)
12631450 {
12641451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1284,15 +1471,15 @@
12841471 }
12851472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12861473 bezierItem.addActionListener(this);
1287
- overlayItem = menu.add(new MenuItem("Overlay"));
1288
- overlayItem.addActionListener(this);
1289
- lightItem = menu.add(new MenuItem("Light"));
1290
- lightItem.addActionListener(this);
1474
+// overlayItem = menu.add(new MenuItem("Overlay"));
1475
+// overlayItem.addActionListener(this);
1476
+// lightItem = menu.add(new MenuItem("Light"));
1477
+// lightItem.addActionListener(this);
12911478 menu.add("-");
12921479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12931480 //superLoopItem.addActionListener(this);
1294
- loopItem = menu.add(new MenuItem("Loop"));
1295
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
12961483 doubleItem = menu.add(new MenuItem("Fork"));
12971484 doubleItem.addActionListener(this);
12981485 if (Globals.ADVANCED)
....@@ -1308,6 +1495,9 @@
13081495 animationItem.addItemListener(this);
13091496 animationItem.setState(Globals.ANIMATION);
13101497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
13111501 menu.add("-");
13121502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13131503 parseverticesItem.addActionListener(this);
....@@ -1320,6 +1510,8 @@
13201510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13211511 reduce34MorphItem.addActionListener(this);
13221512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
13231515 menu.add(computeAOItem = new MenuItem("Compute AO"));
13241516 computeAOItem.addActionListener(this);
13251517
....@@ -1328,8 +1520,6 @@
13281520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13291521 mirrorItem.addActionListener(this);
13301522 menu.add("-");
1331
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1332
- memoryItem.addActionListener(this);
13331523 menu.add(analyzeItem = new MenuItem("Analyze"));
13341524 analyzeItem.addActionListener(this);
13351525 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1477,6 +1667,20 @@
14771667
14781668 makeSomething(shadow);
14791669 }
1670
+
1671
+ private void ClearUnpinned()
1672
+ {
1673
+ //for (Object3D obj : listUI)
1674
+ for (int i=listUI.size(); --i>=0;)
1675
+ {
1676
+ Object3D obj = listUI.elementAt(i);
1677
+ if (!obj.pinned)
1678
+ {
1679
+ obj.CloseUI();
1680
+ listUI.remove(i);
1681
+ }
1682
+ }
1683
+ }
14801684
14811685 /**
14821686 * applyExample
....@@ -1721,7 +1925,7 @@
17211925 {
17221926 ScreenFit();
17231927 } else
1724
- if (source == switchItem)
1928
+ if (source == switchViewItem)
17251929 {
17261930 cVector v1 = new cVector();
17271931 cVector v2 = new cVector();
....@@ -1730,11 +1934,11 @@
17301934 objEditor.cameraView.renderCamera.setAim(v2, v1);
17311935 objEditor.cameraView.repaint();
17321936 } else
1733
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
17341938 {
17351939 makeSomething(new Box());
17361940 } else
1737
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
17381942 {
17391943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17401944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1813,27 +2017,27 @@
18132017
18142018 makeSomething(obj);
18152019 } else
1816
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
18172021 {
18182022 makeSomething(new Grid());
18192023 } else
1820
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
18212025 {
18222026 makeSomething(new Sphere());
18232027 } else
1824
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
18252029 {
18262030 makeSomething(new Cone());
18272031 } else
1828
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
18292033 {
18302034 makeSomething(new Torus());
18312035 } else
1832
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
18332037 {
18342038 makeSomething(new Superellipsoid());
18352039 } else
1836
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
18372041 {
18382042 makeSomething(new Klein());
18392043 } else
....@@ -1853,7 +2057,7 @@
18532057 {
18542058 makeSomething(new BezierSurface());
18552059 } else
1856
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
18572061 {
18582062 /*
18592063 Object3D obj = new BezierSurface(5,8);
....@@ -1901,7 +2105,7 @@
19012105 s.setup();
19022106 makeSomething(s);
19032107 } else
1904
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
19052109 {
19062110 makeSomething(new Light());
19072111 } else
....@@ -1951,30 +2155,30 @@
19512155
19522156 group(g);
19532157 } else
1954
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
19552159 {
19562160 Composite csg = new GroupLeaf();
19572161 csg.count = 5;
19582162 group(csg);
1959
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
19602164 csg.addChild(child);
19612165 child.addChild(csg);
19622166 } else
19632167 if (source == doubleItem)
19642168 {
1965
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
19662170 csg.count = 5;
19672171 group(csg);
1968
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
19692173 csg.addChild(child);
19702174 child.addChild(csg);
1971
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
19722176 csg.addChild(child);
19732177 child.addChild(csg);
19742178 } else
19752179 if (source == tripleItem)
19762180 {
1977
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
19782182 csg.count = 4;
19792183 group(csg);
19802184 Composite child = new cGroup();
....@@ -2038,15 +2242,31 @@
20382242 } else
20392243 if (source == undoButton)
20402244 {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20412248 Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
20422259 } else
20432260 if (source == redoButton)
20442261 {
2262
+ // Go to next version
20452263 Redo();
20462264 } else
20472265 if (source == saveButton)
20482266 {
2049
- Save();
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
20502270 } else
20512271 if (source == oneStepButton)
20522272 {
....@@ -2055,17 +2275,14 @@
20552275 } else
20562276 if (source == screenfitButton)
20572277 {
2058
- //Reload(lastConverter, lastFilename, true);
20592278 ScreenFit();
20602279 } else
20612280 if (source == screenfitpointButton)
20622281 {
2063
- //Reload(lastConverter, lastFilename, true);
20642282 ScreenFitPoint();
20652283 } else
20662284 if (source == snapobjectButton)
20672285 {
2068
- //Reload(lastConverter, lastFilename, true);
20692286 SnapObject();
20702287 } else
20712288 // if (event.getSource() == recompileButton)
....@@ -2441,9 +2658,9 @@
24412658 {
24422659 ClearSelection(true);
24432660 } else
2444
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
24452662 {
2446
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
24472664 } else
24482665 if (source == hideItem)
24492666 {
....@@ -2461,11 +2678,11 @@
24612678 {
24622679 makeSomething(new Camera());
24632680 } else
2464
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
24652682 {
24662683 group(new Composite());
24672684 } else
2468
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
24692686 {
24702687 RandomNode random = new RandomNode();
24712688 group(random);
....@@ -2567,7 +2784,7 @@
25672784 {
25682785 group(new cLinker());
25692786 } else
2570
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
25712788 {
25722789 group(new TextureNode());
25732790 } else
....@@ -2587,17 +2804,30 @@
25872804 {
25882805 CastShadow(2);
25892806 } else
2590
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
25912808 {
2592
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
25932811 for (int i=0; i<group.selection.size(); i++)
25942812 {
2595
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
25962818 }
25972819
2598
- ClearSelection(false);
2599
-
2600
- refreshContents();
2820
+ if (!hasRoot)
2821
+ {
2822
+ for (int i=0; i<group.selection.size(); i++)
2823
+ {
2824
+ Ungroup(group.selection.get(i));
2825
+ }
2826
+
2827
+ ClearSelection(false);
2828
+
2829
+ refreshContents();
2830
+ }
26012831 } else
26022832 if (source == genUVItem)
26032833 {
....@@ -2925,6 +3155,10 @@
29253155 if (source == twoButton)
29263156 {
29273157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
29283162 // bug
29293163 //gridPanel.setDividerLocation(1.0);
29303164 //bigPanel.setDividerLocation(0.0);
....@@ -2980,6 +3214,9 @@
29803214 {
29813215 radio.layout = threeButton;
29823216
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
3219
+
29833220 // bigThree.remove(scenePanel);
29843221 // bigThree.remove(centralPanel);
29853222 // bigThree.remove(XYZPanel);
....@@ -3018,6 +3255,9 @@
30183255 {
30193256 radio.layout = fourButton;
30203257
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
3260
+
30213261 // bigThree.remove(scenePanel);
30223262 // bigThree.remove(centralPanel);
30233263 // bigThree.remove(XYZPanel);
....@@ -3054,6 +3294,9 @@
30543294 if (source == sixButton)
30553295 {
30563296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
30573300
30583301 // bigThree.remove(scenePanel);
30593302 // bigThree.remove(centralPanel);
....@@ -3092,6 +3335,9 @@
30923335 if (source == sevenButton)
30933336 {
30943337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
30953341
30963342 // bigThree.remove(scenePanel);
30973343 // bigThree.remove(centralPanel);
....@@ -3159,7 +3405,8 @@
31593405 buttonGroup.remove(ab);
31603406 radioPanel.remove(ab);
31613407
3162
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
31633410 // ab.GetObject().objectUI = null; // ?????????
31643411
31653412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3172,6 +3419,12 @@
31723419 } else
31733420 if (source == editItem || source == editButton)
31743421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
31753428 EditSelection(false);
31763429 } else
31773430 if (source == uneditButton)
....@@ -3181,6 +3434,7 @@
31813434 Object3D child = (Object3D)e.nextElement();
31823435 if(child.editWindow != null)
31833436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
31843438 child.CloseUI();
31853439 listUI.remove(child);
31863440
....@@ -3197,6 +3451,7 @@
31973451 //copy.ClearUI();
31983452 for (Object3D obj : listUI)
31993453 {
3454
+ obj.pinned = false;
32003455 obj.CloseUI();
32013456 }
32023457 listUI.clear();
....@@ -3206,7 +3461,7 @@
32063461 {
32073462 assert(copy == group);
32083463
3209
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32103465
32113466 for (Object3D obj : listUI)
32123467 {
....@@ -3255,6 +3510,9 @@
32553510 }
32563511
32573512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
32583516 //Globals.theRenderer.object = group;
32593517 if(!useclient)
32603518 {
....@@ -3273,6 +3531,7 @@
32733531
32743532 // fix "+" issue
32753533 //group.editWindow = this;
3534
+ group.manipWindow = this;
32763535
32773536 /*
32783537 currentLayout = radio.layout;
....@@ -3280,6 +3539,11 @@
32803539 currentLayout = sevenButton;
32813540 */
32823541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
32833547 keepparent = group.parent;
32843548 // PARENT = NULL or not???
32853549 //group.parent = null; // ROOT
....@@ -3293,7 +3557,7 @@
32933557 cameraView.ProtectCamera();
32943558 cameraView.repaint();
32953559 return;
3296
- } else if (event.getSource() == revertCameraItem)
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32973561 {
32983562 cameraView.RevertCamera();
32993563 cameraView.repaint();
....@@ -4347,10 +4611,6 @@
43474611 // }
43484612 // }
43494613
4350
- static boolean allparams = true;
4351
-
4352
- static Vector<Object3D> listUI = new Vector<Object3D>();
4353
-
43544614 void EditSelection(boolean newWindow)
43554615 {
43564616 // aConstraints.gridy = 0;
....@@ -4358,7 +4618,7 @@
43584618 {
43594619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43604620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4361
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43624622
43634623 Object3D elem = (Object3D)group.selection.elementAt(i);
43644624 if(elem != group || !newWindow)
....@@ -4443,7 +4703,8 @@
44434703 //new Exception().printStackTrace();
44444704
44454705 freezemodel = true;
4446
-
4706
+ ClearUnpinned();
4707
+
44474708 /**/
44484709 //switch (event.id)
44494710 {
....@@ -4476,7 +4737,7 @@
44764737 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44774738 // a camera
44784739 {
4479
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44804741 {
44814742 CameraPane.camerachangeframe = 0; // don't refuse it
44824743 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4485,6 +4746,13 @@
44854746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44864747 }
44874748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
44884756 refreshContents();
44894757 //return true;
44904758 }
....@@ -4494,9 +4762,18 @@
44944762 freezemodel = false;
44954763 }
44964764
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
44974773 void refreshContents(boolean cp)
44984774 {
4499
- if (!Globals.MOUSEDRAGGED)
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45004777 {
45014778 objEditor.ClearInfo(); // .GetMaterial());
45024779
....@@ -4595,7 +4872,8 @@
45954872
45964873 if (cut)
45974874 {
4598
- Save();
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
45994877 //int indices[] = jList.getSelectedIndices();
46004878 //for (int i = indices.length - 1; i >= 0; i--)
46014879 //jList.remove(indices[i]);
....@@ -4698,6 +4976,10 @@
46984976
46994977 void paste(boolean expand)
47004978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
47014983 // if (GrafreeD.clipboard == null)
47024984 // return;
47034985 boolean first = true;
....@@ -4757,6 +5039,7 @@
47575039 Grafreed.clipboard.get(0).parent = keepparent;
47585040 }
47595041
5042
+ Globals.REPLACEONMAKE = keep;
47605043 ResetModel();
47615044 refreshContents();
47625045 }
....@@ -4892,6 +5175,10 @@
48925175
48935176 void group(Object3D csg, boolean grab)
48945177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
48955182 if (//false) // why??
48965183 !group.selection.isEmpty())
48975184 {
....@@ -5005,10 +5292,15 @@
50055292 //node.add(csg);
50065293 //makeSomething(node);
50075294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
50085296 }
50095297
50105298 void Ungroup(Object3D g)
50115299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
50125304 if (g instanceof HiddenObject)
50135305 {
50145306 HiddenObject h = (HiddenObject) g;
....@@ -5025,6 +5317,7 @@
50255317 objEditor.makeSomething(g.get(i), false);
50265318 }
50275319 }
5320
+ Globals.REPLACEONMAKE = keep;
50285321 }
50295322
50305323 void ungroup()
....@@ -5313,13 +5606,28 @@
53135606 cButton clearpanelButton;
53145607 cButton unselectButton;
53155608
5316
- cButton minButton;
5317
- cButton maxButton;
5318
- cButton fullButton;
5319
- cButton undoButton;
5320
- cButton redoButton;
5609
+ cButton restoreCameraButton;
5610
+
53215611 cButton saveButton;
53225612 cButton oneStepButton;
5613
+
5614
+ cButton groupButton;
5615
+ cButton ungroupButton;
5616
+ cButton compositeButton;
5617
+ cButton switchButton;
5618
+ cButton loopButton;
5619
+ cButton textureButton;
5620
+
5621
+ cButton gridButton;
5622
+ cButton boxButton;
5623
+ cButton sphereButton;
5624
+ cButton coneButton;
5625
+ cButton torusButton;
5626
+ cButton superButton;
5627
+ cButton kleinButton;
5628
+ cButton particlesButton;
5629
+ cButton overlayButton;
5630
+ cButton lightButton;
53235631
53245632 cButton screenfitButton;
53255633 cButton screenfitpointButton;
....@@ -5341,11 +5649,11 @@
53415649 //JTree jTree;
53425650 private MenuItem lookAtItem;
53435651 private MenuItem lookFromItem;
5344
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
53455653 private MenuItem cutItem;
53465654 private MenuItem undoItem;
53475655 private MenuItem redoItem;
5348
- private MenuItem duplicateItem;
5656
+ private JMenuItem duplicateItem;
53495657 private MenuItem cloneItem;
53505658 private MenuItem cloneSupportItem;
53515659 private MenuItem overwriteGeoItem;
....@@ -5433,7 +5741,7 @@
54335741 private MenuItem frontItem;
54345742 private MenuItem cameraItem;
54355743 private MenuItem compositeItem;
5436
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
54375745 private MenuItem physicsItem;
54385746 private MenuItem frameselectorItem;
54395747 private MenuItem scriptNodeItem;
....@@ -5507,5 +5815,5 @@
55075815
55085816 Menu cameraMenu;
55095817 MenuItem editCameraItem;
5510
- MenuItem revertCameraItem;
5818
+ MenuItem restoreCameraItem;
55115819 }