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,32 +934,72 @@
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);
949
+ oeilCB.setToolTipText("Move camera when tracking");
811950 oeilCB.addItemListener(this);
812951
952
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
953
+ shadowCB.setToolTipText("When live compute shadows");
954
+ shadowCB.addItemListener(this);
955
+
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();
970
+ if (Globals.ADVANCED)
971
+ {
813972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
814973 lookAtCB.setToolTipText("Look-at target");
815974 lookAtCB.addItemListener(this);
975
+ }
816976
817977 }
818978
819979 cGridBag fill = new cGridBag();
820
-
821980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
822985
823986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
824989
825990 }
826991
827992 void EditObject(Object3D obj)
828993 {
829994 cRadio radioButton = new cRadio(obj.name);
995
+
996
+ // June 2019. Patch to avoid bug with transparency.
997
+ radioButton.hadMaterial = obj.material != null;
998
+ if (!radioButton.hadMaterial)
999
+ {
1000
+ obj.material = new cMaterial();
1001
+ }
1002
+
8301003 radioButton.SetObject(obj);
8311004 radioButton.layout = sevenButton;
8321005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -848,23 +1021,28 @@
8481021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8491022 }
8501023
851
- JCheckBox liveCB;
852
- JCheckBox supportCB;
853
- JCheckBox localCB;
854
- JCheckBox crowdCB;
855
- JCheckBox smoothCB;
856
- JCheckBox fastCB;
857
- JCheckBox slowCB;
858
- JCheckBox boxCB;
859
- JCheckBox zoomBoxCB;
860
- JCheckBox trackCB;
861
- 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;
8621037 // JCheckBox speakerMocapCB;
863
- JCheckBox speakerCameraCB;
864
- JCheckBox speakerFocusCB;
865
- JCheckBox debugCB;
866
- JCheckBox oeilCB;
867
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
8681046
8691047 // static int COLOR = 1;
8701048 // static int MATERIAL = 2;
....@@ -872,9 +1050,9 @@
8721050
8731051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8741052
875
- JCheckBox colorCB;
876
- JCheckBox materialCB;
877
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
8781056
8791057 public void itemStateChanged(ItemEvent e)
8801058 {
....@@ -967,6 +1145,18 @@
9671145 {
9681146 cameraView.ToggleOeil();
9691147 }
1148
+ else if(e.getSource() == shadowCB)
1149
+ {
1150
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1151
+ }
1152
+ else if(e.getSource() == freezeCB)
1153
+ {
1154
+ Globals.FREEZEONMOVE ^= true;
1155
+ }
1156
+ else if(e.getSource() == autokeepCB)
1157
+ {
1158
+ Globals.REPLACEONMAKE ^= true;
1159
+ }
9701160 else if(e.getSource() == lookAtCB)
9711161 {
9721162 cameraView.ToggleLookAt();
....@@ -983,7 +1173,8 @@
9831173
9841174 /**/
9851175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
986
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
9871178 if ((path == null) || (path.getPathCount() <= 1)) {
9881179 // We can't move the root node or an empty selection
9891180 return;
....@@ -1046,8 +1237,6 @@
10461237 }
10471238 }
10481239
1049
- String string = (String) object;
1050
-
10511240 System.out.println("Transfer = " + object + "; drop : " + target);
10521241 // if( object instanceof java.io.File[])
10531242 // {
....@@ -1055,6 +1244,8 @@
10551244 // objEditor.DropFile((java.io.File[]) object, true);
10561245 // return;
10571246 // }
1247
+
1248
+ String string = object.toString();
10581249
10591250 // File path for Mac and Windows
10601251 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1100,23 +1291,33 @@
11001291
11011292 assert target == objEditor.jTree;
11021293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
11031295 try {
1104
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11051297 } catch (Exception e) {
11061298 System.out.println("destinationPath : " + destinationPath);
11071299 return;
11081300 }
11091301
1110
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
11111303 {
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
+// {
11121313 loadClipboard(true);
11131314 objEditor.jTree.setSelectionPath(destinationPath);
11141315 pasteInto(false, false);
1115
- } else {
1116
- loadClipboard(false);
1117
- objEditor.jTree.setSelectionPath(destinationPath);
1118
- pasteInto(false, false); // true); // ???
1119
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
11201321 }
11211322 public void dropActionChanged(DropTargetDragEvent dtde)
11221323 // Called if the user has modified the current drop gesture
....@@ -1221,22 +1422,30 @@
12211422 {
12221423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12231424 //heightFieldItem.addActionListener(this);
1224
- gridItem = menu.add(new MenuItem("Grid"));
1225
- gridItem.addActionListener(this);
1226
- rectoidItem = menu.add(new MenuItem("Box"));
1227
- rectoidItem.addActionListener(this);
1228
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1229
- ellipsoidItem.addActionListener(this);
1230
- coneItem = menu.add(new MenuItem("Cone"));
1231
- coneItem.addActionListener(this);
1232
- torusItem = menu.add(new MenuItem("Torus"));
1233
- torusItem.addActionListener(this);
1234
- superItem = menu.add(new MenuItem("Superellipsoid"));
1235
- 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
+ {
12361443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12371444 kleinItem.addActionListener(this);
1238
- particleItem = menu.add(new MenuItem("Particle system"));
1239
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
12401449 if (Globals.ADVANCED)
12411450 {
12421451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1262,15 +1471,15 @@
12621471 }
12631472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12641473 bezierItem.addActionListener(this);
1265
- overlayItem = menu.add(new MenuItem("Overlay"));
1266
- overlayItem.addActionListener(this);
1267
- lightItem = menu.add(new MenuItem("Light"));
1268
- 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);
12691478 menu.add("-");
12701479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12711480 //superLoopItem.addActionListener(this);
1272
- loopItem = menu.add(new MenuItem("Loop"));
1273
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
12741483 doubleItem = menu.add(new MenuItem("Fork"));
12751484 doubleItem.addActionListener(this);
12761485 if (Globals.ADVANCED)
....@@ -1286,6 +1495,9 @@
12861495 animationItem.addItemListener(this);
12871496 animationItem.setState(Globals.ANIMATION);
12881497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
12891501 menu.add("-");
12901502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12911503 parseverticesItem.addActionListener(this);
....@@ -1298,6 +1510,8 @@
12981510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12991511 reduce34MorphItem.addActionListener(this);
13001512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
13011515 menu.add(computeAOItem = new MenuItem("Compute AO"));
13021516 computeAOItem.addActionListener(this);
13031517
....@@ -1306,8 +1520,6 @@
13061520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13071521 mirrorItem.addActionListener(this);
13081522 menu.add("-");
1309
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1310
- memoryItem.addActionListener(this);
13111523 menu.add(analyzeItem = new MenuItem("Analyze"));
13121524 analyzeItem.addActionListener(this);
13131525 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1455,6 +1667,20 @@
14551667
14561668 makeSomething(shadow);
14571669 }
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
+ }
14581684
14591685 /**
14601686 * applyExample
....@@ -1699,7 +1925,7 @@
16991925 {
17001926 ScreenFit();
17011927 } else
1702
- if (source == switchItem)
1928
+ if (source == switchViewItem)
17031929 {
17041930 cVector v1 = new cVector();
17051931 cVector v2 = new cVector();
....@@ -1708,11 +1934,11 @@
17081934 objEditor.cameraView.renderCamera.setAim(v2, v1);
17091935 objEditor.cameraView.repaint();
17101936 } else
1711
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
17121938 {
17131939 makeSomething(new Box());
17141940 } else
1715
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
17161942 {
17171943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17181944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1791,27 +2017,27 @@
17912017
17922018 makeSomething(obj);
17932019 } else
1794
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
17952021 {
17962022 makeSomething(new Grid());
17972023 } else
1798
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
17992025 {
18002026 makeSomething(new Sphere());
18012027 } else
1802
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
18032029 {
18042030 makeSomething(new Cone());
18052031 } else
1806
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
18072033 {
18082034 makeSomething(new Torus());
18092035 } else
1810
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
18112037 {
18122038 makeSomething(new Superellipsoid());
18132039 } else
1814
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
18152041 {
18162042 makeSomething(new Klein());
18172043 } else
....@@ -1831,7 +2057,7 @@
18312057 {
18322058 makeSomething(new BezierSurface());
18332059 } else
1834
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
18352061 {
18362062 /*
18372063 Object3D obj = new BezierSurface(5,8);
....@@ -1879,7 +2105,7 @@
18792105 s.setup();
18802106 makeSomething(s);
18812107 } else
1882
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
18832109 {
18842110 makeSomething(new Light());
18852111 } else
....@@ -1929,30 +2155,30 @@
19292155
19302156 group(g);
19312157 } else
1932
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
19332159 {
19342160 Composite csg = new GroupLeaf();
19352161 csg.count = 5;
19362162 group(csg);
1937
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
19382164 csg.addChild(child);
19392165 child.addChild(csg);
19402166 } else
19412167 if (source == doubleItem)
19422168 {
1943
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
19442170 csg.count = 5;
19452171 group(csg);
1946
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
19472173 csg.addChild(child);
19482174 child.addChild(csg);
1949
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
19502176 csg.addChild(child);
19512177 child.addChild(csg);
19522178 } else
19532179 if (source == tripleItem)
19542180 {
1955
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
19562182 csg.count = 4;
19572183 group(csg);
19582184 Composite child = new cGroup();
....@@ -2016,15 +2242,31 @@
20162242 } else
20172243 if (source == undoButton)
20182244 {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20192248 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();
20202259 } else
20212260 if (source == redoButton)
20222261 {
2262
+ // Go to next version
20232263 Redo();
20242264 } else
20252265 if (source == saveButton)
20262266 {
2027
- Save();
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
20282270 } else
20292271 if (source == oneStepButton)
20302272 {
....@@ -2033,17 +2275,14 @@
20332275 } else
20342276 if (source == screenfitButton)
20352277 {
2036
- //Reload(lastConverter, lastFilename, true);
20372278 ScreenFit();
20382279 } else
20392280 if (source == screenfitpointButton)
20402281 {
2041
- //Reload(lastConverter, lastFilename, true);
20422282 ScreenFitPoint();
20432283 } else
20442284 if (source == snapobjectButton)
20452285 {
2046
- //Reload(lastConverter, lastFilename, true);
20472286 SnapObject();
20482287 } else
20492288 // if (event.getSource() == recompileButton)
....@@ -2419,9 +2658,9 @@
24192658 {
24202659 ClearSelection(true);
24212660 } else
2422
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
24232662 {
2424
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
24252664 } else
24262665 if (source == hideItem)
24272666 {
....@@ -2439,11 +2678,11 @@
24392678 {
24402679 makeSomething(new Camera());
24412680 } else
2442
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
24432682 {
24442683 group(new Composite());
24452684 } else
2446
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
24472686 {
24482687 RandomNode random = new RandomNode();
24492688 group(random);
....@@ -2545,7 +2784,7 @@
25452784 {
25462785 group(new cLinker());
25472786 } else
2548
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
25492788 {
25502789 group(new TextureNode());
25512790 } else
....@@ -2565,17 +2804,30 @@
25652804 {
25662805 CastShadow(2);
25672806 } else
2568
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
25692808 {
2570
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
25712811 for (int i=0; i<group.selection.size(); i++)
25722812 {
2573
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
25742818 }
25752819
2576
- ClearSelection(false);
2577
-
2578
- 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
+ }
25792831 } else
25802832 if (source == genUVItem)
25812833 {
....@@ -2903,6 +3155,10 @@
29033155 if (source == twoButton)
29043156 {
29053157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
29063162 // bug
29073163 //gridPanel.setDividerLocation(1.0);
29083164 //bigPanel.setDividerLocation(0.0);
....@@ -2958,6 +3214,9 @@
29583214 {
29593215 radio.layout = threeButton;
29603216
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
3219
+
29613220 // bigThree.remove(scenePanel);
29623221 // bigThree.remove(centralPanel);
29633222 // bigThree.remove(XYZPanel);
....@@ -2996,6 +3255,9 @@
29963255 {
29973256 radio.layout = fourButton;
29983257
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
3260
+
29993261 // bigThree.remove(scenePanel);
30003262 // bigThree.remove(centralPanel);
30013263 // bigThree.remove(XYZPanel);
....@@ -3032,6 +3294,9 @@
30323294 if (source == sixButton)
30333295 {
30343296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
30353300
30363301 // bigThree.remove(scenePanel);
30373302 // bigThree.remove(centralPanel);
....@@ -3070,6 +3335,9 @@
30703335 if (source == sevenButton)
30713336 {
30723337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
30733341
30743342 // bigThree.remove(scenePanel);
30753343 // bigThree.remove(centralPanel);
....@@ -3126,12 +3394,19 @@
31263394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31273395 {
31283396 ab = (cRadio)e.nextElement();
3129
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31303398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
31313405 buttonGroup.remove(ab);
31323406 radioPanel.remove(ab);
31333407
3134
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
31353410 // ab.GetObject().objectUI = null; // ?????????
31363411
31373412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3144,6 +3419,12 @@
31443419 } else
31453420 if (source == editItem || source == editButton)
31463421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
31473428 EditSelection(false);
31483429 } else
31493430 if (source == uneditButton)
....@@ -3153,6 +3434,7 @@
31533434 Object3D child = (Object3D)e.nextElement();
31543435 if(child.editWindow != null)
31553436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
31563438 child.CloseUI();
31573439 listUI.remove(child);
31583440
....@@ -3169,6 +3451,7 @@
31693451 //copy.ClearUI();
31703452 for (Object3D obj : listUI)
31713453 {
3454
+ obj.pinned = false;
31723455 obj.CloseUI();
31733456 }
31743457 listUI.clear();
....@@ -3178,7 +3461,7 @@
31783461 {
31793462 assert(copy == group);
31803463
3181
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31823465
31833466 for (Object3D obj : listUI)
31843467 {
....@@ -3227,6 +3510,9 @@
32273510 }
32283511
32293512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
32303516 //Globals.theRenderer.object = group;
32313517 if(!useclient)
32323518 {
....@@ -3245,6 +3531,7 @@
32453531
32463532 // fix "+" issue
32473533 //group.editWindow = this;
3534
+ group.manipWindow = this;
32483535
32493536 /*
32503537 currentLayout = radio.layout;
....@@ -3252,6 +3539,11 @@
32523539 currentLayout = sevenButton;
32533540 */
32543541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
32553547 keepparent = group.parent;
32563548 // PARENT = NULL or not???
32573549 //group.parent = null; // ROOT
....@@ -3265,7 +3557,7 @@
32653557 cameraView.ProtectCamera();
32663558 cameraView.repaint();
32673559 return;
3268
- } else if (event.getSource() == revertCameraItem)
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32693561 {
32703562 cameraView.RevertCamera();
32713563 cameraView.repaint();
....@@ -4319,10 +4611,6 @@
43194611 // }
43204612 // }
43214613
4322
- static boolean allparams = true;
4323
-
4324
- static Vector<Object3D> listUI = new Vector<Object3D>();
4325
-
43264614 void EditSelection(boolean newWindow)
43274615 {
43284616 // aConstraints.gridy = 0;
....@@ -4330,7 +4618,7 @@
43304618 {
43314619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43324620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4333
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43344622
43354623 Object3D elem = (Object3D)group.selection.elementAt(i);
43364624 if(elem != group || !newWindow)
....@@ -4415,7 +4703,8 @@
44154703 //new Exception().printStackTrace();
44164704
44174705 freezemodel = true;
4418
-
4706
+ ClearUnpinned();
4707
+
44194708 /**/
44204709 //switch (event.id)
44214710 {
....@@ -4448,7 +4737,7 @@
44484737 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44494738 // a camera
44504739 {
4451
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44524741 {
44534742 CameraPane.camerachangeframe = 0; // don't refuse it
44544743 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4457,6 +4746,13 @@
44574746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44584747 }
44594748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
44604756 refreshContents();
44614757 //return true;
44624758 }
....@@ -4466,9 +4762,18 @@
44664762 freezemodel = false;
44674763 }
44684764
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
44694773 void refreshContents(boolean cp)
44704774 {
4471
- if (!Globals.MOUSEDRAGGED)
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44724777 {
44734778 objEditor.ClearInfo(); // .GetMaterial());
44744779
....@@ -4567,7 +4872,8 @@
45674872
45684873 if (cut)
45694874 {
4570
- Save();
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
45714877 //int indices[] = jList.getSelectedIndices();
45724878 //for (int i = indices.length - 1; i >= 0; i--)
45734879 //jList.remove(indices[i]);
....@@ -4670,6 +4976,10 @@
46704976
46714977 void paste(boolean expand)
46724978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
46734983 // if (GrafreeD.clipboard == null)
46744984 // return;
46754985 boolean first = true;
....@@ -4729,6 +5039,7 @@
47295039 Grafreed.clipboard.get(0).parent = keepparent;
47305040 }
47315041
5042
+ Globals.REPLACEONMAKE = keep;
47325043 ResetModel();
47335044 refreshContents();
47345045 }
....@@ -4864,6 +5175,10 @@
48645175
48655176 void group(Object3D csg, boolean grab)
48665177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
48675182 if (//false) // why??
48685183 !group.selection.isEmpty())
48695184 {
....@@ -4977,10 +5292,15 @@
49775292 //node.add(csg);
49785293 //makeSomething(node);
49795294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
49805296 }
49815297
49825298 void Ungroup(Object3D g)
49835299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
49845304 if (g instanceof HiddenObject)
49855305 {
49865306 HiddenObject h = (HiddenObject) g;
....@@ -4997,6 +5317,7 @@
49975317 objEditor.makeSomething(g.get(i), false);
49985318 }
49995319 }
5320
+ Globals.REPLACEONMAKE = keep;
50005321 }
50015322
50025323 void ungroup()
....@@ -5285,13 +5606,28 @@
52855606 cButton clearpanelButton;
52865607 cButton unselectButton;
52875608
5288
- cButton minButton;
5289
- cButton maxButton;
5290
- cButton fullButton;
5291
- cButton undoButton;
5292
- cButton redoButton;
5609
+ cButton restoreCameraButton;
5610
+
52935611 cButton saveButton;
52945612 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;
52955631
52965632 cButton screenfitButton;
52975633 cButton screenfitpointButton;
....@@ -5313,11 +5649,11 @@
53135649 //JTree jTree;
53145650 private MenuItem lookAtItem;
53155651 private MenuItem lookFromItem;
5316
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
53175653 private MenuItem cutItem;
53185654 private MenuItem undoItem;
53195655 private MenuItem redoItem;
5320
- private MenuItem duplicateItem;
5656
+ private JMenuItem duplicateItem;
53215657 private MenuItem cloneItem;
53225658 private MenuItem cloneSupportItem;
53235659 private MenuItem overwriteGeoItem;
....@@ -5405,7 +5741,7 @@
54055741 private MenuItem frontItem;
54065742 private MenuItem cameraItem;
54075743 private MenuItem compositeItem;
5408
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
54095745 private MenuItem physicsItem;
54105746 private MenuItem frameselectorItem;
54115747 private MenuItem scriptNodeItem;
....@@ -5479,5 +5815,5 @@
54795815
54805816 Menu cameraMenu;
54815817 MenuItem editCameraItem;
5482
- MenuItem revertCameraItem;
5818
+ MenuItem restoreCameraItem;
54835819 }