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);
....@@ -176,7 +183,6 @@
176183 copyItem.addActionListener(this);
177184 pasteItem = menu.add(new MenuItem("Paste"));
178185 pasteItem.addActionListener(this);
179
- menu.add("-");
180186
181187 menu.add("-");
182188 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -203,23 +209,23 @@
203209 //zBufferItem.addActionListener(this);
204210 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205211 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
212
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
213
+ restoreCameraItem.addActionListener(this);
208214
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- 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);
213227
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223229 toggleHandleItem.addItemListener(this);
224230 toggleHandleItem.setState(CameraPane.HANDLES);
225231
....@@ -274,7 +280,7 @@
274280 {
275281 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276282 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
283
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278284 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279285 oe.cameraMenu.add("-");
280286 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +288,7 @@
282288 editLeafItem.addActionListener(this);
283289 lookAtItem.addActionListener(this);
284290 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
291
+ //switchViewItem.addActionListener(this);
286292 }
287293
288294 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +333,29 @@
327333 }
328334
329335 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
336
+// grabItem = menu.add(new MenuItem("Grab"));
337
+// grabItem.addActionListener(this);
332338 backItem = menu.add(new MenuItem("Back"));
333339 backItem.addActionListener(this);
334340 frontItem = menu.add(new MenuItem("Front"));
335341 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
342
+// compositeItem = menu.add(new MenuItem("Composite"));
343
+// compositeItem.addActionListener(this);
344
+
345
+ if (Globals.ADVANCED)
346
+ {
338347 hideItem = menu.add(new MenuItem("Hidden Group"));
339348 hideItem.addActionListener(this);
349
+ }
340350 ungroupItem = menu.add(new MenuItem("Ungroup"));
341351 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- 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
+ {
345359 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346360 switchGeoItem.addActionListener(this);
347361 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +363,6 @@
349363 morphItem = menu.add(new MenuItem("Morph Group"));
350364 morphItem.addActionListener(this);
351365
352
- if (Globals.ADVANCED)
353
- {
354366 menu.add("-");
355367 physicsItem = menu.add(new MenuItem("Physics"));
356368 physicsItem.addActionListener(this);
....@@ -358,30 +370,29 @@
358370 frameselectorItem.addActionListener(this);
359371 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360372 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363373 }
364374
365375 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
376
+// textureItem = menu.add(new MenuItem("Texture"));
377
+// textureItem.addActionListener(this);
368378 billboardItem = menu.add(new MenuItem("Billboard"));
369379 billboardItem.addActionListener(this);
370380 csgItem = menu.add(new MenuItem("CSG"));
371381 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
382
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373383 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
384
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375385 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
386
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
378391 if (Globals.ADVANCED)
379392 {
380393 menu.add("-");
381394 linkerItem = menu.add(new MenuItem("Linker"));
382395 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385396 templateItem = menu.add(new MenuItem("Template"));
386397 templateItem.addActionListener(this);
387398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -533,6 +544,7 @@
533544 buildToolsMenu(menu);
534545 }
535546
547
+
536548 void SetupUI2(ObjEditor oe)
537549 {
538550 // June 2019
....@@ -575,51 +587,79 @@
575587 oe.radioPanel.add(dummyButton);
576588 oe.buttonGroup.add(dummyButton);
577589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
578594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
579595
580596 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
581597 //minButton.setToolTipText("Minimize window");
582598 //minButton.addActionListener(this);
583599
584
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- maxButton.setToolTipText("Maximize window");
586
- 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
+ }
587606
588
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589608 fullButton.setToolTipText("Full-screen window");
590609 fullButton.addActionListener(this);
591610
592
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
593
- undoButton.setToolTipText("Undo changes");
594
- 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);
595618
596
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- redoButton.setToolTipText("Redo changes");
598
- redoButton.addActionListener(this);
599
-
600
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
- saveButton.setToolTipText("Save changes");
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
602621 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);
603627
604
- 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);
605647 liveCB.setToolTipText("Enable animation");
606648 liveCB.addItemListener(this);
607649
608
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609651 oneStepButton.setToolTipText("Animate one step forward");
610652 oneStepButton.addActionListener(this);
611653
612
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
613655 fastCB.setToolTipText("Fast mode");
614656 fastCB.addItemListener(this);
615657
616
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
617
- trackCB.setToolTipText("Enable tracking");
618
- trackCB.addItemListener(this);
619
-
620
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- screenfitButton.setToolTipText("Screen fit");
622
- 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);
623663
624664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
625665 // screenfitpointButton.addActionListener(this);
....@@ -631,65 +671,145 @@
631671 snapobjectButton.setToolTipText("Snap Object");
632672 }
633673
634
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
- flashSelectionButton.setToolTipText("Show selection");
636
- flashSelectionButton.addActionListener(this);
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
637675
638
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
639
-
640
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641677 twoButton.setToolTipText("Show center view only");
642678 twoButton.addActionListener(this);
643
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ this.fullscreenLayout = twoButton;
680
+
681
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644682 fourButton.addActionListener(this);
645683 fourButton.setToolTipText("Show left panel only");
646
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647685 sixButton.setToolTipText("2-column layout left");
648686 sixButton.addActionListener(this);
649
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650688 threeButton.setToolTipText("2-column layout right");
651689 threeButton.addActionListener(this);
652
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653691 sevenButton.setToolTipText("3-column layout");
654692 sevenButton.addActionListener(this);
655693 //
656694
657
- 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);
658696 rootButton.setToolTipText("Edit selection in new tab");
659697 rootButton.addActionListener(this);
660698
661
- 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);
662700 closeButton.setToolTipText("Close tab");
663701 closeButton.addActionListener(this);
664702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
665703 //clearButton.addActionListener(this);
666
-
667
- cGridBag commandsPanel = new cGridBag();
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
+ }
668736
669
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
- editButton.setToolTipText("Edit selection");
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");
671786 editButton.addActionListener(this);
672787
673
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
675790 uneditButton.addActionListener(this);
676791
677
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
678
- allParamsButton.setToolTipText("Edit all params");
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
679794 allParamsButton.addActionListener(this);
680795
681
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682797 clearPanelButton.setToolTipText("Clear edit panel");
683798 clearPanelButton.addActionListener(this);
684799
685
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686801 unselectButton.setToolTipText("Unselect");
687802 unselectButton.addActionListener(this);
688803
689
- commandsPanel.preferredHeight = 1;
804
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ flashSelectionButton.setToolTipText("Highlight selection");
806
+ flashSelectionButton.addActionListener(this);
690807
691
- oe.treePanel.add(commandsPanel);
692
- oe.treePanel.Return();
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
693813
694814 // oe.aConstraints.gridx += 1;
695815 // oe.aConstraints.weighty = 0;
....@@ -706,29 +826,17 @@
706826
707827 JScrollPane jSP;
708828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
709
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
710830 ResetModel();
711831
712832 oe.treePanel.add(jSPPanel);
713833 oe.treePanel.Return();
714834
715
- cGridBag copyOptionsPanel = new cGridBag();
716
-
717
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
718
- colorCB.setToolTipText("Copy color when dropped");
719
- colorCB.addItemListener(this);
720
-
721
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
722
- materialCB.setToolTipText("Copy material when dropped");
723
- materialCB.addItemListener(this);
724
-
725
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
726
- textureCB.setToolTipText("Copy texture when dropped");
727
- textureCB.addItemListener(this);
728
-
729
- copyOptionsPanel.preferredHeight = 1;
730835 oe.treePanel.add(copyOptionsPanel);
731836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
732840
733841 // mainPanel.setDividerLocation(0.5); //1.0);
734842 // mainPanel.setResizeWeight(0.5);
....@@ -757,23 +865,43 @@
757865
758866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
759867 {
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
+
760882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
761883 boxCB.setToolTipText("Display bounding boxes");
762884 boxCB.addItemListener(this);
763885
764886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
765
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
766888 zoomBoxCB.addItemListener(this);
767889
768890 if (true) // Globals.ADVANCED)
769891 {
770
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
771
- supportCB.setToolTipText("Enable rigging");
772
- 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);
773899
774900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
775901 // localCB.addItemListener(this);
776902
903
+ panel.Return();
904
+
777905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
778906 crowdCB.setToolTipText("Used for crowds");
779907 crowdCB.addItemListener(this);
....@@ -790,6 +918,8 @@
790918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
791919 // speakerMocapCB.addItemListener(this);
792920
921
+ panel.Return();
922
+
793923 if (false)
794924 {
795925 // handled in scripts
....@@ -804,32 +934,72 @@
804934 //constraints.gridy += 1;
805935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
806936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
807938 }
808939
809940 //constraints.gridx += 1;
810941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
811942 // debugCB.addItemListener(this);
812943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
813948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
814950 oeilCB.addItemListener(this);
815951
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
+ {
816972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
817973 lookAtCB.setToolTipText("Look-at target");
818974 lookAtCB.addItemListener(this);
975
+ }
819976
820977 }
821978
822979 cGridBag fill = new cGridBag();
823
-
824980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
825985
826986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
827989
828990 }
829991
830992 void EditObject(Object3D obj)
831993 {
832994 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
+
8331003 radioButton.SetObject(obj);
8341004 radioButton.layout = sevenButton;
8351005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -851,23 +1021,28 @@
8511021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8521022 }
8531023
854
- JCheckBox liveCB;
855
- JCheckBox supportCB;
856
- JCheckBox localCB;
857
- JCheckBox crowdCB;
858
- JCheckBox smoothCB;
859
- JCheckBox fastCB;
860
- JCheckBox slowCB;
861
- JCheckBox boxCB;
862
- JCheckBox zoomBoxCB;
863
- JCheckBox trackCB;
864
- 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;
8651037 // JCheckBox speakerMocapCB;
866
- JCheckBox speakerCameraCB;
867
- JCheckBox speakerFocusCB;
868
- JCheckBox debugCB;
869
- JCheckBox oeilCB;
870
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
8711046
8721047 // static int COLOR = 1;
8731048 // static int MATERIAL = 2;
....@@ -875,9 +1050,9 @@
8751050
8761051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8771052
878
- JCheckBox colorCB;
879
- JCheckBox materialCB;
880
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
8811056
8821057 public void itemStateChanged(ItemEvent e)
8831058 {
....@@ -970,6 +1145,18 @@
9701145 {
9711146 cameraView.ToggleOeil();
9721147 }
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
+ }
9731160 else if(e.getSource() == lookAtCB)
9741161 {
9751162 cameraView.ToggleLookAt();
....@@ -986,7 +1173,8 @@
9861173
9871174 /**/
9881175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
989
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
9901178 if ((path == null) || (path.getPathCount() <= 1)) {
9911179 // We can't move the root node or an empty selection
9921180 return;
....@@ -1049,8 +1237,6 @@
10491237 }
10501238 }
10511239
1052
- String string = (String) object;
1053
-
10541240 System.out.println("Transfer = " + object + "; drop : " + target);
10551241 // if( object instanceof java.io.File[])
10561242 // {
....@@ -1058,6 +1244,8 @@
10581244 // objEditor.DropFile((java.io.File[]) object, true);
10591245 // return;
10601246 // }
1247
+
1248
+ String string = object.toString();
10611249
10621250 // File path for Mac and Windows
10631251 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1103,23 +1291,33 @@
11031291
11041292 assert target == objEditor.jTree;
11051293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
11061295 try {
1107
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11081297 } catch (Exception e) {
11091298 System.out.println("destinationPath : " + destinationPath);
11101299 return;
11111300 }
11121301
1113
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
11141303 {
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
+// {
11151313 loadClipboard(true);
11161314 objEditor.jTree.setSelectionPath(destinationPath);
11171315 pasteInto(false, false);
1118
- } else {
1119
- loadClipboard(false);
1120
- objEditor.jTree.setSelectionPath(destinationPath);
1121
- pasteInto(false, false); // true); // ???
1122
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
11231321 }
11241322 public void dropActionChanged(DropTargetDragEvent dtde)
11251323 // Called if the user has modified the current drop gesture
....@@ -1224,22 +1422,30 @@
12241422 {
12251423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12261424 //heightFieldItem.addActionListener(this);
1227
- gridItem = menu.add(new MenuItem("Grid"));
1228
- gridItem.addActionListener(this);
1229
- rectoidItem = menu.add(new MenuItem("Box"));
1230
- rectoidItem.addActionListener(this);
1231
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1232
- ellipsoidItem.addActionListener(this);
1233
- coneItem = menu.add(new MenuItem("Cone"));
1234
- coneItem.addActionListener(this);
1235
- torusItem = menu.add(new MenuItem("Torus"));
1236
- torusItem.addActionListener(this);
1237
- superItem = menu.add(new MenuItem("Superellipsoid"));
1238
- 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
+ {
12391443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12401444 kleinItem.addActionListener(this);
1241
- particleItem = menu.add(new MenuItem("Particle system"));
1242
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
12431449 if (Globals.ADVANCED)
12441450 {
12451451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1265,15 +1471,15 @@
12651471 }
12661472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12671473 bezierItem.addActionListener(this);
1268
- overlayItem = menu.add(new MenuItem("Overlay"));
1269
- overlayItem.addActionListener(this);
1270
- lightItem = menu.add(new MenuItem("Light"));
1271
- 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);
12721478 menu.add("-");
12731479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12741480 //superLoopItem.addActionListener(this);
1275
- loopItem = menu.add(new MenuItem("Loop"));
1276
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
12771483 doubleItem = menu.add(new MenuItem("Fork"));
12781484 doubleItem.addActionListener(this);
12791485 if (Globals.ADVANCED)
....@@ -1289,6 +1495,9 @@
12891495 animationItem.addItemListener(this);
12901496 animationItem.setState(Globals.ANIMATION);
12911497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
12921501 menu.add("-");
12931502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12941503 parseverticesItem.addActionListener(this);
....@@ -1301,6 +1510,8 @@
13011510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13021511 reduce34MorphItem.addActionListener(this);
13031512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
13041515 menu.add(computeAOItem = new MenuItem("Compute AO"));
13051516 computeAOItem.addActionListener(this);
13061517
....@@ -1309,8 +1520,6 @@
13091520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13101521 mirrorItem.addActionListener(this);
13111522 menu.add("-");
1312
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1313
- memoryItem.addActionListener(this);
13141523 menu.add(analyzeItem = new MenuItem("Analyze"));
13151524 analyzeItem.addActionListener(this);
13161525 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1454,9 +1663,24 @@
14541663 shadow.material = new cMaterial(obj.material);
14551664 shadow.material.diffuse = 0.0001f;
14561665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
14571667
14581668 makeSomething(shadow);
14591669 }
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
+ }
14601684
14611685 /**
14621686 * applyExample
....@@ -1701,7 +1925,7 @@
17011925 {
17021926 ScreenFit();
17031927 } else
1704
- if (source == switchItem)
1928
+ if (source == switchViewItem)
17051929 {
17061930 cVector v1 = new cVector();
17071931 cVector v2 = new cVector();
....@@ -1710,11 +1934,11 @@
17101934 objEditor.cameraView.renderCamera.setAim(v2, v1);
17111935 objEditor.cameraView.repaint();
17121936 } else
1713
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
17141938 {
17151939 makeSomething(new Box());
17161940 } else
1717
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
17181942 {
17191943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17201944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1793,27 +2017,27 @@
17932017
17942018 makeSomething(obj);
17952019 } else
1796
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
17972021 {
17982022 makeSomething(new Grid());
17992023 } else
1800
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
18012025 {
18022026 makeSomething(new Sphere());
18032027 } else
1804
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
18052029 {
18062030 makeSomething(new Cone());
18072031 } else
1808
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
18092033 {
18102034 makeSomething(new Torus());
18112035 } else
1812
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
18132037 {
18142038 makeSomething(new Superellipsoid());
18152039 } else
1816
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
18172041 {
18182042 makeSomething(new Klein());
18192043 } else
....@@ -1833,7 +2057,7 @@
18332057 {
18342058 makeSomething(new BezierSurface());
18352059 } else
1836
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
18372061 {
18382062 /*
18392063 Object3D obj = new BezierSurface(5,8);
....@@ -1881,7 +2105,7 @@
18812105 s.setup();
18822106 makeSomething(s);
18832107 } else
1884
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
18852109 {
18862110 makeSomething(new Light());
18872111 } else
....@@ -1931,30 +2155,30 @@
19312155
19322156 group(g);
19332157 } else
1934
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
19352159 {
19362160 Composite csg = new GroupLeaf();
19372161 csg.count = 5;
19382162 group(csg);
1939
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
19402164 csg.addChild(child);
19412165 child.addChild(csg);
19422166 } else
19432167 if (source == doubleItem)
19442168 {
1945
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
19462170 csg.count = 5;
19472171 group(csg);
1948
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
19492173 csg.addChild(child);
19502174 child.addChild(csg);
1951
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
19522176 csg.addChild(child);
19532177 child.addChild(csg);
19542178 } else
19552179 if (source == tripleItem)
19562180 {
1957
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
19582182 csg.count = 4;
19592183 group(csg);
19602184 Composite child = new cGroup();
....@@ -2018,15 +2242,31 @@
20182242 } else
20192243 if (source == undoButton)
20202244 {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20212248 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();
20222259 } else
20232260 if (source == redoButton)
20242261 {
2262
+ // Go to next version
20252263 Redo();
20262264 } else
20272265 if (source == saveButton)
20282266 {
2029
- Save();
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
20302270 } else
20312271 if (source == oneStepButton)
20322272 {
....@@ -2035,17 +2275,14 @@
20352275 } else
20362276 if (source == screenfitButton)
20372277 {
2038
- //Reload(lastConverter, lastFilename, true);
20392278 ScreenFit();
20402279 } else
20412280 if (source == screenfitpointButton)
20422281 {
2043
- //Reload(lastConverter, lastFilename, true);
20442282 ScreenFitPoint();
20452283 } else
20462284 if (source == snapobjectButton)
20472285 {
2048
- //Reload(lastConverter, lastFilename, true);
20492286 SnapObject();
20502287 } else
20512288 // if (event.getSource() == recompileButton)
....@@ -2421,9 +2658,9 @@
24212658 {
24222659 ClearSelection(true);
24232660 } else
2424
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
24252662 {
2426
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
24272664 } else
24282665 if (source == hideItem)
24292666 {
....@@ -2441,11 +2678,11 @@
24412678 {
24422679 makeSomething(new Camera());
24432680 } else
2444
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
24452682 {
24462683 group(new Composite());
24472684 } else
2448
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
24492686 {
24502687 RandomNode random = new RandomNode();
24512688 group(random);
....@@ -2547,7 +2784,7 @@
25472784 {
25482785 group(new cLinker());
25492786 } else
2550
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
25512788 {
25522789 group(new TextureNode());
25532790 } else
....@@ -2567,17 +2804,30 @@
25672804 {
25682805 CastShadow(2);
25692806 } else
2570
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
25712808 {
2572
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
25732811 for (int i=0; i<group.selection.size(); i++)
25742812 {
2575
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
25762818 }
25772819
2578
- ClearSelection(false);
2579
-
2580
- 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
+ }
25812831 } else
25822832 if (source == genUVItem)
25832833 {
....@@ -2905,6 +3155,10 @@
29053155 if (source == twoButton)
29063156 {
29073157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
29083162 // bug
29093163 //gridPanel.setDividerLocation(1.0);
29103164 //bigPanel.setDividerLocation(0.0);
....@@ -2960,6 +3214,9 @@
29603214 {
29613215 radio.layout = threeButton;
29623216
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
3219
+
29633220 // bigThree.remove(scenePanel);
29643221 // bigThree.remove(centralPanel);
29653222 // bigThree.remove(XYZPanel);
....@@ -2998,6 +3255,9 @@
29983255 {
29993256 radio.layout = fourButton;
30003257
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
3260
+
30013261 // bigThree.remove(scenePanel);
30023262 // bigThree.remove(centralPanel);
30033263 // bigThree.remove(XYZPanel);
....@@ -3034,6 +3294,9 @@
30343294 if (source == sixButton)
30353295 {
30363296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
30373300
30383301 // bigThree.remove(scenePanel);
30393302 // bigThree.remove(centralPanel);
....@@ -3072,6 +3335,9 @@
30723335 if (source == sevenButton)
30733336 {
30743337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
30753341
30763342 // bigThree.remove(scenePanel);
30773343 // bigThree.remove(centralPanel);
....@@ -3128,12 +3394,19 @@
31283394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31293395 {
31303396 ab = (cRadio)e.nextElement();
3131
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31323398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
31333405 buttonGroup.remove(ab);
31343406 radioPanel.remove(ab);
31353407
3136
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
31373410 // ab.GetObject().objectUI = null; // ?????????
31383411
31393412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3146,6 +3419,12 @@
31463419 } else
31473420 if (source == editItem || source == editButton)
31483421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
31493428 EditSelection(false);
31503429 } else
31513430 if (source == uneditButton)
....@@ -3155,6 +3434,7 @@
31553434 Object3D child = (Object3D)e.nextElement();
31563435 if(child.editWindow != null)
31573436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
31583438 child.CloseUI();
31593439 listUI.remove(child);
31603440
....@@ -3171,6 +3451,7 @@
31713451 //copy.ClearUI();
31723452 for (Object3D obj : listUI)
31733453 {
3454
+ obj.pinned = false;
31743455 obj.CloseUI();
31753456 }
31763457 listUI.clear();
....@@ -3180,7 +3461,7 @@
31803461 {
31813462 assert(copy == group);
31823463
3183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31843465
31853466 for (Object3D obj : listUI)
31863467 {
....@@ -3229,6 +3510,9 @@
32293510 }
32303511
32313512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
32323516 //Globals.theRenderer.object = group;
32333517 if(!useclient)
32343518 {
....@@ -3247,6 +3531,7 @@
32473531
32483532 // fix "+" issue
32493533 //group.editWindow = this;
3534
+ group.manipWindow = this;
32503535
32513536 /*
32523537 currentLayout = radio.layout;
....@@ -3254,6 +3539,11 @@
32543539 currentLayout = sevenButton;
32553540 */
32563541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
32573547 keepparent = group.parent;
32583548 // PARENT = NULL or not???
32593549 //group.parent = null; // ROOT
....@@ -3267,7 +3557,7 @@
32673557 cameraView.ProtectCamera();
32683558 cameraView.repaint();
32693559 return;
3270
- } else if (event.getSource() == revertCameraItem)
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32713561 {
32723562 cameraView.RevertCamera();
32733563 cameraView.repaint();
....@@ -4321,10 +4611,6 @@
43214611 // }
43224612 // }
43234613
4324
- static boolean allparams = true;
4325
-
4326
- static Vector<Object3D> listUI = new Vector<Object3D>();
4327
-
43284614 void EditSelection(boolean newWindow)
43294615 {
43304616 // aConstraints.gridy = 0;
....@@ -4332,7 +4618,7 @@
43324618 {
43334619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43344620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4335
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43364622
43374623 Object3D elem = (Object3D)group.selection.elementAt(i);
43384624 if(elem != group || !newWindow)
....@@ -4417,7 +4703,8 @@
44174703 //new Exception().printStackTrace();
44184704
44194705 freezemodel = true;
4420
-
4706
+ ClearUnpinned();
4707
+
44214708 /**/
44224709 //switch (event.id)
44234710 {
....@@ -4450,7 +4737,7 @@
44504737 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44514738 // a camera
44524739 {
4453
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44544741 {
44554742 CameraPane.camerachangeframe = 0; // don't refuse it
44564743 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4459,6 +4746,13 @@
44594746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44604747 }
44614748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
44624756 refreshContents();
44634757 //return true;
44644758 }
....@@ -4468,9 +4762,18 @@
44684762 freezemodel = false;
44694763 }
44704764
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
44714773 void refreshContents(boolean cp)
44724774 {
4473
- if (!Globals.MOUSEDRAGGED)
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44744777 {
44754778 objEditor.ClearInfo(); // .GetMaterial());
44764779
....@@ -4569,7 +4872,8 @@
45694872
45704873 if (cut)
45714874 {
4572
- Save();
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
45734877 //int indices[] = jList.getSelectedIndices();
45744878 //for (int i = indices.length - 1; i >= 0; i--)
45754879 //jList.remove(indices[i]);
....@@ -4672,6 +4976,10 @@
46724976
46734977 void paste(boolean expand)
46744978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
46754983 // if (GrafreeD.clipboard == null)
46764984 // return;
46774985 boolean first = true;
....@@ -4731,6 +5039,7 @@
47315039 Grafreed.clipboard.get(0).parent = keepparent;
47325040 }
47335041
5042
+ Globals.REPLACEONMAKE = keep;
47345043 ResetModel();
47355044 refreshContents();
47365045 }
....@@ -4866,6 +5175,10 @@
48665175
48675176 void group(Object3D csg, boolean grab)
48685177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
48695182 if (//false) // why??
48705183 !group.selection.isEmpty())
48715184 {
....@@ -4979,10 +5292,15 @@
49795292 //node.add(csg);
49805293 //makeSomething(node);
49815294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
49825296 }
49835297
49845298 void Ungroup(Object3D g)
49855299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
49865304 if (g instanceof HiddenObject)
49875305 {
49885306 HiddenObject h = (HiddenObject) g;
....@@ -4999,6 +5317,7 @@
49995317 objEditor.makeSomething(g.get(i), false);
50005318 }
50015319 }
5320
+ Globals.REPLACEONMAKE = keep;
50025321 }
50035322
50045323 void ungroup()
....@@ -5287,13 +5606,28 @@
52875606 cButton clearpanelButton;
52885607 cButton unselectButton;
52895608
5290
- cButton minButton;
5291
- cButton maxButton;
5292
- cButton fullButton;
5293
- cButton undoButton;
5294
- cButton redoButton;
5609
+ cButton restoreCameraButton;
5610
+
52955611 cButton saveButton;
52965612 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;
52975631
52985632 cButton screenfitButton;
52995633 cButton screenfitpointButton;
....@@ -5315,11 +5649,11 @@
53155649 //JTree jTree;
53165650 private MenuItem lookAtItem;
53175651 private MenuItem lookFromItem;
5318
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
53195653 private MenuItem cutItem;
53205654 private MenuItem undoItem;
53215655 private MenuItem redoItem;
5322
- private MenuItem duplicateItem;
5656
+ private JMenuItem duplicateItem;
53235657 private MenuItem cloneItem;
53245658 private MenuItem cloneSupportItem;
53255659 private MenuItem overwriteGeoItem;
....@@ -5407,7 +5741,7 @@
54075741 private MenuItem frontItem;
54085742 private MenuItem cameraItem;
54095743 private MenuItem compositeItem;
5410
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
54115745 private MenuItem physicsItem;
54125746 private MenuItem frameselectorItem;
54135747 private MenuItem scriptNodeItem;
....@@ -5481,5 +5815,5 @@
54815815
54825816 Menu cameraMenu;
54835817 MenuItem editCameraItem;
5484
- MenuItem revertCameraItem;
5818
+ MenuItem restoreCameraItem;
54855819 }