Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
GroupEditor.java
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = 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.SAVEONMAKE = 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"));
....@@ -575,51 +586,66 @@
575586 oe.radioPanel.add(dummyButton);
576587 oe.buttonGroup.add(dummyButton);
577588 */
589
+ cGridBag copyOptionsPanel = new cGridBag();
590
+
591
+ copyOptionsPanel.preferredHeight = 1;
592
+
578593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
579594
580595 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
581596 //minButton.setToolTipText("Minimize window");
582597 //minButton.addActionListener(this);
583598
584
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- maxButton.setToolTipText("Maximize window");
586
- maxButton.addActionListener(this);
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
587605
588
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589607 fullButton.setToolTipText("Full-screen window");
590608 fullButton.addActionListener(this);
591609
592
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
614
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ restoreCameraButton.setToolTipText("Restore viewpoint");
616
+ restoreCameraButton.addActionListener(this);
617
+
618
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
593619 undoButton.setToolTipText("Undo changes");
594620 undoButton.addActionListener(this);
621
+ undoButton.setEnabled(false);
595622
596
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597624 redoButton.setToolTipText("Redo changes");
598625 redoButton.addActionListener(this);
626
+ redoButton.setEnabled(false);
599627
600
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601629 saveButton.setToolTipText("Save changes");
602630 saveButton.addActionListener(this);
603631
604
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
632
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
605633 liveCB.setToolTipText("Enable animation");
606634 liveCB.addItemListener(this);
607635
608
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609637 oneStepButton.setToolTipText("Animate one step forward");
610638 oneStepButton.addActionListener(this);
611639
612
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
640
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
613641 fastCB.setToolTipText("Fast mode");
614642 fastCB.addItemListener(this);
615643
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);
644
+ //oe.toolboxPanel.Return();
645
+
646
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
647
+// trackCB.setToolTipText("Enable tracking");
648
+// trackCB.addItemListener(this);
623649
624650 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
625651 // screenfitpointButton.addActionListener(this);
....@@ -631,65 +657,145 @@
631657 snapobjectButton.setToolTipText("Snap Object");
632658 }
633659
634
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
- flashSelectionButton.setToolTipText("Show selection");
636
- flashSelectionButton.addActionListener(this);
660
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
637661
638
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
639
-
640
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641663 twoButton.setToolTipText("Show center view only");
642664 twoButton.addActionListener(this);
643
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ this.fullscreenLayout = twoButton;
666
+
667
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644668 fourButton.addActionListener(this);
645669 fourButton.setToolTipText("Show left panel only");
646
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647671 sixButton.setToolTipText("2-column layout left");
648672 sixButton.addActionListener(this);
649
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
673
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650674 threeButton.setToolTipText("2-column layout right");
651675 threeButton.addActionListener(this);
652
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653677 sevenButton.setToolTipText("3-column layout");
654678 sevenButton.addActionListener(this);
655679 //
656680
657
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
681
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658682 rootButton.setToolTipText("Edit selection in new tab");
659683 rootButton.addActionListener(this);
660684
661
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
685
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662686 closeButton.setToolTipText("Close tab");
663687 closeButton.addActionListener(this);
664688 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
665689 //clearButton.addActionListener(this);
666
-
667
- cGridBag commandsPanel = new cGridBag();
690
+
691
+ // INSERT
692
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ gridButton.setToolTipText("Create grid");
694
+ gridButton.addActionListener(this);
695
+
696
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ boxButton.setToolTipText("Create box");
698
+ boxButton.addActionListener(this);
699
+
700
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+ sphereButton.setToolTipText("Create sphere");
702
+ sphereButton.addActionListener(this);
703
+
704
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ coneButton.setToolTipText("Create cone");
706
+ coneButton.addActionListener(this);
707
+
708
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ torusButton.setToolTipText("Create torus");
710
+ torusButton.addActionListener(this);
711
+
712
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ superButton.setToolTipText("Create superellipsoid");
714
+ superButton.addActionListener(this);
715
+
716
+ if (Globals.ADVANCED)
717
+ {
718
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ kleinButton.setToolTipText("Create Klein bottle");
720
+ kleinButton.addActionListener(this);
721
+ }
668722
669
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
- editButton.setToolTipText("Edit selection");
723
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ particlesButton.setToolTipText("Create particle system");
725
+ particlesButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.Return();
728
+
729
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ groupButton.setToolTipText("Create group");
731
+ groupButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ compositeButton.setToolTipText("Create composite");
735
+ compositeButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ switchButton.setToolTipText("Create item switcher");
739
+ switchButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ loopButton.setToolTipText("Create loop");
743
+ loopButton.addActionListener(this);
744
+
745
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ textureButton.setToolTipText("Create texture");
747
+ textureButton.addActionListener(this);
748
+
749
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ overlayButton.setToolTipText("Create overlay");
751
+ overlayButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ lightButton.setToolTipText("Create light");
755
+ lightButton.addActionListener(this);
756
+
757
+ for (int i=6; --i>=0;)
758
+ {
759
+ oe.toolboxPanel.Return();
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ oe.toolboxPanel.add(new cGridBag());
763
+ oe.toolboxPanel.add(new cGridBag());
764
+ oe.toolboxPanel.add(new cGridBag());
765
+ oe.toolboxPanel.add(new cGridBag());
766
+ oe.toolboxPanel.add(new cGridBag());
767
+ }
768
+
769
+ // EDIT panel
770
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ editButton.setToolTipText("Pin selection controls");
671772 editButton.addActionListener(this);
672773
673
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- uneditButton.setToolTipText("Unedit selection");
774
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ uneditButton.setToolTipText("Remove selection controls");
675776 uneditButton.addActionListener(this);
676777
677
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
678
- allParamsButton.setToolTipText("Edit all params");
778
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
779
+ allParamsButton.setToolTipText("Show all controle");
679780 allParamsButton.addActionListener(this);
680781
681
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
782
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682783 clearPanelButton.setToolTipText("Clear edit panel");
683784 clearPanelButton.addActionListener(this);
684785
685
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
786
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686787 unselectButton.setToolTipText("Unselect");
687788 unselectButton.addActionListener(this);
688789
689
- commandsPanel.preferredHeight = 1;
790
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
791
+ flashSelectionButton.setToolTipText("Highlight selection");
792
+ flashSelectionButton.addActionListener(this);
690793
691
- oe.treePanel.add(commandsPanel);
692
- oe.treePanel.Return();
794
+ editCommandsPanel.preferredHeight = 1;
795
+
796
+ SetPinStates(false);
797
+// oe.treePanel.add(commandsPanel);
798
+// oe.treePanel.Return();
693799
694800 // oe.aConstraints.gridx += 1;
695801 // oe.aConstraints.weighty = 0;
....@@ -706,27 +812,12 @@
706812
707813 JScrollPane jSP;
708814 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
709
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
815
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
710816 ResetModel();
711817
712818 oe.treePanel.add(jSPPanel);
713819 oe.treePanel.Return();
714820
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;
730821 oe.treePanel.add(copyOptionsPanel);
731822 oe.treePanel.Return();
732823
....@@ -757,23 +848,43 @@
757848
758849 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
759850 {
851
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
852
+ colorCB.setToolTipText("Copy color when dropped");
853
+ colorCB.addItemListener(this);
854
+
855
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
856
+ materialCB.setToolTipText("Copy material when dropped");
857
+ materialCB.addItemListener(this);
858
+
859
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
860
+ textureCB.setToolTipText("Copy texture when dropped");
861
+ textureCB.addItemListener(this);
862
+
863
+ panel.Return();
864
+
760865 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
761866 boxCB.setToolTipText("Display bounding boxes");
762867 boxCB.addItemListener(this);
763868
764869 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
765
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
870
+ zoomBoxCB.setToolTipText("Display only for wheel");
766871 zoomBoxCB.addItemListener(this);
767872
768873 if (true) // Globals.ADVANCED)
769874 {
770
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
771
- supportCB.setToolTipText("Enable rigging");
772
- supportCB.addItemListener(this);
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
773882
774883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
775884 // localCB.addItemListener(this);
776885
886
+ panel.Return();
887
+
777888 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
778889 crowdCB.setToolTipText("Used for crowds");
779890 crowdCB.addItemListener(this);
....@@ -790,6 +901,8 @@
790901 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
791902 // speakerMocapCB.addItemListener(this);
792903
904
+ panel.Return();
905
+
793906 if (false)
794907 {
795908 // handled in scripts
....@@ -804,32 +917,72 @@
804917 //constraints.gridy += 1;
805918 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
806919 smoothfocusCB.addItemListener(this);
920
+ panel.Return();
807921 }
808922
809923 //constraints.gridx += 1;
810924 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
811925 // debugCB.addItemListener(this);
812926
927
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
928
+ trackCB.setToolTipText("Enable tracking target");
929
+ trackCB.addItemListener(this);
930
+
813931 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
932
+ oeilCB.setToolTipText("Move camera when tracking");
814933 oeilCB.addItemListener(this);
815934
935
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
936
+ shadowCB.setToolTipText("When live compute shadows");
937
+ shadowCB.addItemListener(this);
938
+
939
+ panel.Return();
940
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
941
+ toggleTextureCB.setToolTipText("Load textures");
942
+ toggleTextureCB.addItemListener(this);
943
+
944
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
946
+ toggleSwitchCB.addItemListener(this);
947
+
948
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
+ autosaveCB.setToolTipText("On structure change");
950
+ autosaveCB.addItemListener(this);
951
+
952
+ panel.Return();
953
+ if (Globals.ADVANCED)
954
+ {
816955 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
817956 lookAtCB.setToolTipText("Look-at target");
818957 lookAtCB.addItemListener(this);
958
+ }
819959
820960 }
821961
822962 cGridBag fill = new cGridBag();
823
-
824963 fill.preferredHeight = 200;
964
+ cGridBag fill2 = new cGridBag();
965
+ fill2.preferredHeight = 200;
966
+ cGridBag fill3 = new cGridBag();
967
+ fill3.preferredHeight = 200;
825968
826969 panel.add(fill);
970
+ panel.add(fill2);
971
+ panel.add(fill3);
827972
828973 }
829974
830975 void EditObject(Object3D obj)
831976 {
832977 cRadio radioButton = new cRadio(obj.name);
978
+
979
+ // June 2019. Patch to avoid bug with transparency.
980
+ radioButton.hadMaterial = obj.material != null;
981
+ if (!radioButton.hadMaterial)
982
+ {
983
+ obj.material = new cMaterial();
984
+ }
985
+
833986 radioButton.SetObject(obj);
834987 radioButton.layout = sevenButton;
835988 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -851,23 +1004,28 @@
8511004 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8521005 }
8531006
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;
1007
+ cToggleButton liveCB;
1008
+ cCheckBox supportCB;
1009
+ cCheckBox localCB;
1010
+ cCheckBox crowdCB;
1011
+ cCheckBox smoothCB;
1012
+ cToggleButton fastCB;
1013
+ cCheckBox slowCB;
1014
+ cCheckBox boxCB;
1015
+ cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
1017
+ //cToggleButton trackCB;
1018
+ cCheckBox trackCB;
1019
+ cCheckBox smoothfocusCB;
8651020 // JCheckBox speakerMocapCB;
866
- JCheckBox speakerCameraCB;
867
- JCheckBox speakerFocusCB;
868
- JCheckBox debugCB;
869
- JCheckBox oeilCB;
870
- JCheckBox lookAtCB;
1021
+ cCheckBox speakerCameraCB;
1022
+ cCheckBox speakerFocusCB;
1023
+ cCheckBox debugCB;
1024
+
1025
+ cCheckBox oeilCB;
1026
+ cCheckBox shadowCB;
1027
+ cCheckBox autosaveCB;
1028
+ cCheckBox lookAtCB;
8711029
8721030 // static int COLOR = 1;
8731031 // static int MATERIAL = 2;
....@@ -875,9 +1033,9 @@
8751033
8761034 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8771035
878
- JCheckBox colorCB;
879
- JCheckBox materialCB;
880
- JCheckBox textureCB;
1036
+ cCheckBox colorCB;
1037
+ cCheckBox materialCB;
1038
+ cCheckBox textureCB;
8811039
8821040 public void itemStateChanged(ItemEvent e)
8831041 {
....@@ -970,6 +1128,18 @@
9701128 {
9711129 cameraView.ToggleOeil();
9721130 }
1131
+ else if(e.getSource() == shadowCB)
1132
+ {
1133
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1134
+ }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
1139
+ else if(e.getSource() == autosaveCB)
1140
+ {
1141
+ Globals.SAVEONMAKE ^= true;
1142
+ }
9731143 else if(e.getSource() == lookAtCB)
9741144 {
9751145 cameraView.ToggleLookAt();
....@@ -986,7 +1156,8 @@
9861156
9871157 /**/
9881158 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
989
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1159
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1160
+ TreePath path = objEditor.jTree.getSelectionPath();
9901161 if ((path == null) || (path.getPathCount() <= 1)) {
9911162 // We can't move the root node or an empty selection
9921163 return;
....@@ -1049,8 +1220,6 @@
10491220 }
10501221 }
10511222
1052
- String string = (String) object;
1053
-
10541223 System.out.println("Transfer = " + object + "; drop : " + target);
10551224 // if( object instanceof java.io.File[])
10561225 // {
....@@ -1058,6 +1227,8 @@
10581227 // objEditor.DropFile((java.io.File[]) object, true);
10591228 // return;
10601229 // }
1230
+
1231
+ String string = object.toString();
10611232
10621233 // File path for Mac and Windows
10631234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1103,23 +1274,33 @@
11031274
11041275 assert target == objEditor.jTree;
11051276 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1277
+ Object3D destinationLeaf;
11061278 try {
1107
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1279
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11081280 } catch (Exception e) {
11091281 System.out.println("destinationPath : " + destinationPath);
11101282 return;
11111283 }
11121284
1113
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1285
+ for (int i=group.selection.size(); --i>=0;)
11141286 {
1287
+ Object3D child = (Object3D)group.selection.elementAt(i);
1288
+
1289
+ // Cannot move into itself
1290
+ if (child == destinationLeaf)
1291
+ return;
1292
+ }
1293
+
1294
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1295
+// {
11151296 loadClipboard(true);
11161297 objEditor.jTree.setSelectionPath(destinationPath);
11171298 pasteInto(false, false);
1118
- } else {
1119
- loadClipboard(false);
1120
- objEditor.jTree.setSelectionPath(destinationPath);
1121
- pasteInto(false, false); // true); // ???
1122
- }
1299
+// } else {
1300
+// loadClipboard(false);
1301
+// objEditor.jTree.setSelectionPath(destinationPath);
1302
+// pasteInto(false, false); // true); // ???
1303
+// }
11231304 }
11241305 public void dropActionChanged(DropTargetDragEvent dtde)
11251306 // Called if the user has modified the current drop gesture
....@@ -1224,22 +1405,30 @@
12241405 {
12251406 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12261407 //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);
1408
+// gridItem = menu.add(new MenuItem("Grid"));
1409
+// gridItem.addActionListener(this);
1410
+// rectoidItem = menu.add(new MenuItem("Box"));
1411
+// rectoidItem.addActionListener(this);
1412
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1413
+// ellipsoidItem.addActionListener(this);
1414
+// coneItem = menu.add(new MenuItem("Cone"));
1415
+// coneItem.addActionListener(this);
1416
+// torusItem = menu.add(new MenuItem("Torus"));
1417
+// torusItem.addActionListener(this);
1418
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1419
+// superItem.addActionListener(this);
1420
+
1421
+ cameraItem = menu.add(new MenuItem("Camera"));
1422
+ cameraItem.addActionListener(this);
1423
+
1424
+ if (!Globals.ADVANCED)
1425
+ {
12391426 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12401427 kleinItem.addActionListener(this);
1241
- particleItem = menu.add(new MenuItem("Particle system"));
1242
- particleItem.addActionListener(this);
1428
+ }
1429
+
1430
+// particleItem = menu.add(new MenuItem("Particle system"));
1431
+// particleItem.addActionListener(this);
12431432 if (Globals.ADVANCED)
12441433 {
12451434 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1265,15 +1454,15 @@
12651454 }
12661455 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12671456 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);
1457
+// overlayItem = menu.add(new MenuItem("Overlay"));
1458
+// overlayItem.addActionListener(this);
1459
+// lightItem = menu.add(new MenuItem("Light"));
1460
+// lightItem.addActionListener(this);
12721461 menu.add("-");
12731462 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12741463 //superLoopItem.addActionListener(this);
1275
- loopItem = menu.add(new MenuItem("Loop"));
1276
- loopItem.addActionListener(this);
1464
+// loopItem = menu.add(new MenuItem("Loop"));
1465
+// loopItem.addActionListener(this);
12771466 doubleItem = menu.add(new MenuItem("Fork"));
12781467 doubleItem.addActionListener(this);
12791468 if (Globals.ADVANCED)
....@@ -1289,6 +1478,9 @@
12891478 animationItem.addItemListener(this);
12901479 animationItem.setState(Globals.ANIMATION);
12911480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
12921484 menu.add("-");
12931485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12941486 parseverticesItem.addActionListener(this);
....@@ -1301,6 +1493,8 @@
13011493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13021494 reduce34MorphItem.addActionListener(this);
13031495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
13041498 menu.add(computeAOItem = new MenuItem("Compute AO"));
13051499 computeAOItem.addActionListener(this);
13061500
....@@ -1309,8 +1503,6 @@
13091503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13101504 mirrorItem.addActionListener(this);
13111505 menu.add("-");
1312
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1313
- memoryItem.addActionListener(this);
13141506 menu.add(analyzeItem = new MenuItem("Analyze"));
13151507 analyzeItem.addActionListener(this);
13161508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1454,9 +1646,24 @@
14541646 shadow.material = new cMaterial(obj.material);
14551647 shadow.material.diffuse = 0.0001f;
14561648 shadow.material.specular = 0.0001f;
1649
+ //shadow.projectedVertices[1].x = 300;
14571650
14581651 makeSomething(shadow);
14591652 }
1653
+
1654
+ private void ClearUnpinned()
1655
+ {
1656
+ //for (Object3D obj : listUI)
1657
+ for (int i=listUI.size(); --i>=0;)
1658
+ {
1659
+ Object3D obj = listUI.elementAt(i);
1660
+ if (!obj.pinned)
1661
+ {
1662
+ obj.CloseUI();
1663
+ listUI.remove(i);
1664
+ }
1665
+ }
1666
+ }
14601667
14611668 /**
14621669 * applyExample
....@@ -1701,7 +1908,7 @@
17011908 {
17021909 ScreenFit();
17031910 } else
1704
- if (source == switchItem)
1911
+ if (source == switchViewItem)
17051912 {
17061913 cVector v1 = new cVector();
17071914 cVector v2 = new cVector();
....@@ -1710,11 +1917,11 @@
17101917 objEditor.cameraView.renderCamera.setAim(v2, v1);
17111918 objEditor.cameraView.repaint();
17121919 } else
1713
- if (source == rectoidItem)
1920
+ if (source == rectoidItem || source == boxButton)
17141921 {
17151922 makeSomething(new Box());
17161923 } else
1717
- if (source == particleItem)
1924
+ if (source == particleItem || source == particlesButton)
17181925 {
17191926 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17201927 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1793,27 +2000,27 @@
17932000
17942001 makeSomething(obj);
17952002 } else
1796
- if (source == gridItem)
2003
+ if (source == gridItem || source == gridButton)
17972004 {
17982005 makeSomething(new Grid());
17992006 } else
1800
- if (source == ellipsoidItem)
2007
+ if (source == ellipsoidItem || source == sphereButton)
18012008 {
18022009 makeSomething(new Sphere());
18032010 } else
1804
- if (source == coneItem)
2011
+ if (source == coneItem || source == coneButton)
18052012 {
18062013 makeSomething(new Cone());
18072014 } else
1808
- if (source == torusItem)
2015
+ if (source == torusItem || source == torusButton)
18092016 {
18102017 makeSomething(new Torus());
18112018 } else
1812
- if (source == superItem)
2019
+ if (source == superItem || source == superButton)
18132020 {
18142021 makeSomething(new Superellipsoid());
18152022 } else
1816
- if (source == kleinItem)
2023
+ if (source == kleinItem || source == kleinButton)
18172024 {
18182025 makeSomething(new Klein());
18192026 } else
....@@ -1833,7 +2040,7 @@
18332040 {
18342041 makeSomething(new BezierSurface());
18352042 } else
1836
- if (source == overlayItem)
2043
+ if (source == overlayItem || source == overlayButton)
18372044 {
18382045 /*
18392046 Object3D obj = new BezierSurface(5,8);
....@@ -1881,7 +2088,7 @@
18812088 s.setup();
18822089 makeSomething(s);
18832090 } else
1884
- if (source == lightItem)
2091
+ if (source == lightItem || source == lightButton)
18852092 {
18862093 makeSomething(new Light());
18872094 } else
....@@ -1931,30 +2138,30 @@
19312138
19322139 group(g);
19332140 } else
1934
- if (source == loopItem)
2141
+ if (source == loopItem || source == loopButton)
19352142 {
19362143 Composite csg = new GroupLeaf();
19372144 csg.count = 5;
19382145 group(csg);
1939
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
19402147 csg.addChild(child);
19412148 child.addChild(csg);
19422149 } else
19432150 if (source == doubleItem)
19442151 {
1945
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
19462153 csg.count = 5;
19472154 group(csg);
1948
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
19492156 csg.addChild(child);
19502157 child.addChild(csg);
1951
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
19522159 csg.addChild(child);
19532160 child.addChild(csg);
19542161 } else
19552162 if (source == tripleItem)
19562163 {
1957
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
19582165 csg.count = 4;
19592166 group(csg);
19602167 Composite child = new cGroup();
....@@ -2018,7 +2225,8 @@
20182225 } else
20192226 if (source == undoButton)
20202227 {
2021
- Undo();
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
20222230 } else
20232231 if (source == redoButton)
20242232 {
....@@ -2026,7 +2234,8 @@
20262234 } else
20272235 if (source == saveButton)
20282236 {
2029
- Save();
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
20302239 } else
20312240 if (source == oneStepButton)
20322241 {
....@@ -2035,17 +2244,14 @@
20352244 } else
20362245 if (source == screenfitButton)
20372246 {
2038
- //Reload(lastConverter, lastFilename, true);
20392247 ScreenFit();
20402248 } else
20412249 if (source == screenfitpointButton)
20422250 {
2043
- //Reload(lastConverter, lastFilename, true);
20442251 ScreenFitPoint();
20452252 } else
20462253 if (source == snapobjectButton)
20472254 {
2048
- //Reload(lastConverter, lastFilename, true);
20492255 SnapObject();
20502256 } else
20512257 // if (event.getSource() == recompileButton)
....@@ -2421,9 +2627,9 @@
24212627 {
24222628 ClearSelection(true);
24232629 } else
2424
- if (source == grabItem)
2630
+ if (source == grabItem || source == groupButton)
24252631 {
2426
- group(new cGroup(), true);
2632
+ group(new cGroup(), false); // true);
24272633 } else
24282634 if (source == hideItem)
24292635 {
....@@ -2441,11 +2647,11 @@
24412647 {
24422648 makeSomething(new Camera());
24432649 } else
2444
- if (source == compositeItem)
2650
+ if (source == compositeItem || source == compositeButton)
24452651 {
24462652 group(new Composite());
24472653 } else
2448
- if (source == randomItem)
2654
+ if (source == switchItem || source == switchButton)
24492655 {
24502656 RandomNode random = new RandomNode();
24512657 group(random);
....@@ -2547,7 +2753,7 @@
25472753 {
25482754 group(new cLinker());
25492755 } else
2550
- if (source == textureItem)
2756
+ if (source == textureItem || source == textureButton)
25512757 {
25522758 group(new TextureNode());
25532759 } else
....@@ -2567,17 +2773,30 @@
25672773 {
25682774 CastShadow(2);
25692775 } else
2570
- if (source == ungroupItem)
2776
+ if (source == ungroupItem || source == ungroupButton)
25712777 {
2572
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
25732780 for (int i=0; i<group.selection.size(); i++)
25742781 {
2575
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
25762787 }
25772788
2578
- ClearSelection(false);
2579
-
2580
- refreshContents();
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
25812800 } else
25822801 if (source == genUVItem)
25832802 {
....@@ -2905,6 +3124,10 @@
29053124 if (source == twoButton)
29063125 {
29073126 radio.layout = twoButton;
3127
+
3128
+ if (CameraPane.FULLSCREEN)
3129
+ fullscreenLayout = radio.layout;
3130
+
29083131 // bug
29093132 //gridPanel.setDividerLocation(1.0);
29103133 //bigPanel.setDividerLocation(0.0);
....@@ -2960,6 +3183,9 @@
29603183 {
29613184 radio.layout = threeButton;
29623185
3186
+ if (CameraPane.FULLSCREEN)
3187
+ fullscreenLayout = radio.layout;
3188
+
29633189 // bigThree.remove(scenePanel);
29643190 // bigThree.remove(centralPanel);
29653191 // bigThree.remove(XYZPanel);
....@@ -2998,6 +3224,9 @@
29983224 {
29993225 radio.layout = fourButton;
30003226
3227
+ if (CameraPane.FULLSCREEN)
3228
+ fullscreenLayout = radio.layout;
3229
+
30013230 // bigThree.remove(scenePanel);
30023231 // bigThree.remove(centralPanel);
30033232 // bigThree.remove(XYZPanel);
....@@ -3034,6 +3263,9 @@
30343263 if (source == sixButton)
30353264 {
30363265 radio.layout = sixButton;
3266
+
3267
+ if (CameraPane.FULLSCREEN)
3268
+ fullscreenLayout = radio.layout;
30373269
30383270 // bigThree.remove(scenePanel);
30393271 // bigThree.remove(centralPanel);
....@@ -3072,6 +3304,9 @@
30723304 if (source == sevenButton)
30733305 {
30743306 radio.layout = sevenButton;
3307
+
3308
+ if (CameraPane.FULLSCREEN)
3309
+ fullscreenLayout = radio.layout;
30753310
30763311 // bigThree.remove(scenePanel);
30773312 // bigThree.remove(centralPanel);
....@@ -3128,12 +3363,19 @@
31283363 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31293364 {
31303365 ab = (cRadio)e.nextElement();
3131
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3366
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31323367 {
3368
+ // Patch to avoid bug with transparency.
3369
+ if (!ab.hadMaterial)
3370
+ {
3371
+ ab.object.material = null;
3372
+ }
3373
+
31333374 buttonGroup.remove(ab);
31343375 radioPanel.remove(ab);
31353376
3136
- ab.GetObject().editWindow = null;
3377
+ //ab.GetObject().editWindow = null;
3378
+ ab.GetObject().manipWindow = null;
31373379 // ab.GetObject().objectUI = null; // ?????????
31383380
31393381 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3146,6 +3388,12 @@
31463388 } else
31473389 if (source == editItem || source == editButton)
31483390 {
3391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3392
+ {
3393
+ Object3D child = (Object3D)e.nextElement();
3394
+ child.pinned = true;
3395
+ }
3396
+
31493397 EditSelection(false);
31503398 } else
31513399 if (source == uneditButton)
....@@ -3155,6 +3403,7 @@
31553403 Object3D child = (Object3D)e.nextElement();
31563404 if(child.editWindow != null)
31573405 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3406
+ child.pinned = false;
31583407 child.CloseUI();
31593408 listUI.remove(child);
31603409
....@@ -3171,6 +3420,7 @@
31713420 //copy.ClearUI();
31723421 for (Object3D obj : listUI)
31733422 {
3423
+ obj.pinned = false;
31743424 obj.CloseUI();
31753425 }
31763426 listUI.clear();
....@@ -3180,7 +3430,7 @@
31803430 {
31813431 assert(copy == group);
31823432
3183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3433
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31843434
31853435 for (Object3D obj : listUI)
31863436 {
....@@ -3247,6 +3497,7 @@
32473497
32483498 // fix "+" issue
32493499 //group.editWindow = this;
3500
+ group.manipWindow = this;
32503501
32513502 /*
32523503 currentLayout = radio.layout;
....@@ -3254,6 +3505,11 @@
32543505 currentLayout = sevenButton;
32553506 */
32563507 radio.layout.doClick();
3508
+
3509
+ ClearUnpinned();
3510
+ SetPinStates(group.selection.size() > 0);
3511
+ if (group.selection.size() == 1)
3512
+ EditSelection(false);
32573513 keepparent = group.parent;
32583514 // PARENT = NULL or not???
32593515 //group.parent = null; // ROOT
....@@ -3267,7 +3523,7 @@
32673523 cameraView.ProtectCamera();
32683524 cameraView.repaint();
32693525 return;
3270
- } else if (event.getSource() == revertCameraItem)
3526
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32713527 {
32723528 cameraView.RevertCamera();
32733529 cameraView.repaint();
....@@ -4321,10 +4577,6 @@
43214577 // }
43224578 // }
43234579
4324
- static boolean allparams = true;
4325
-
4326
- static Vector<Object3D> listUI = new Vector<Object3D>();
4327
-
43284580 void EditSelection(boolean newWindow)
43294581 {
43304582 // aConstraints.gridy = 0;
....@@ -4332,7 +4584,7 @@
43324584 {
43334585 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43344586 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4335
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4587
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43364588
43374589 Object3D elem = (Object3D)group.selection.elementAt(i);
43384590 if(elem != group || !newWindow)
....@@ -4417,7 +4669,8 @@
44174669 //new Exception().printStackTrace();
44184670
44194671 freezemodel = true;
4420
-
4672
+ ClearUnpinned();
4673
+
44214674 /**/
44224675 //switch (event.id)
44234676 {
....@@ -4450,7 +4703,7 @@
44504703 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44514704 // a camera
44524705 {
4453
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4706
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44544707 {
44554708 CameraPane.camerachangeframe = 0; // don't refuse it
44564709 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4459,6 +4712,13 @@
44594712 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44604713 }
44614714
4715
+ if (tps != null && tps.length == 1)
4716
+ {
4717
+ EditSelection(false);
4718
+ }
4719
+
4720
+ SetPinStates(tps != null && tps.length > 0);
4721
+
44624722 refreshContents();
44634723 //return true;
44644724 }
....@@ -4468,9 +4728,18 @@
44684728 freezemodel = false;
44694729 }
44704730
4731
+ void SetPinStates(boolean enabled)
4732
+ {
4733
+ editButton.setEnabled(enabled);
4734
+ uneditButton.setEnabled(enabled);
4735
+ unselectButton.setEnabled(enabled);
4736
+ flashSelectionButton.setEnabled(enabled);
4737
+ }
4738
+
44714739 void refreshContents(boolean cp)
44724740 {
4473
- if (!Globals.MOUSEDRAGGED)
4741
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44744743 {
44754744 objEditor.ClearInfo(); // .GetMaterial());
44764745
....@@ -4569,7 +4838,8 @@
45694838
45704839 if (cut)
45714840 {
4572
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
45734843 //int indices[] = jList.getSelectedIndices();
45744844 //for (int i = indices.length - 1; i >= 0; i--)
45754845 //jList.remove(indices[i]);
....@@ -4672,6 +4942,10 @@
46724942
46734943 void paste(boolean expand)
46744944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
46754949 // if (GrafreeD.clipboard == null)
46764950 // return;
46774951 boolean first = true;
....@@ -4731,6 +5005,7 @@
47315005 Grafreed.clipboard.get(0).parent = keepparent;
47325006 }
47335007
5008
+ Globals.SAVEONMAKE = keep;
47345009 ResetModel();
47355010 refreshContents();
47365011 }
....@@ -4866,6 +5141,10 @@
48665141
48675142 void group(Object3D csg, boolean grab)
48685143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
48695148 if (//false) // why??
48705149 !group.selection.isEmpty())
48715150 {
....@@ -4979,10 +5258,15 @@
49795258 //node.add(csg);
49805259 //makeSomething(node);
49815260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
49825262 }
49835263
49845264 void Ungroup(Object3D g)
49855265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
49865270 if (g instanceof HiddenObject)
49875271 {
49885272 HiddenObject h = (HiddenObject) g;
....@@ -4999,6 +5283,7 @@
49995283 objEditor.makeSomething(g.get(i), false);
50005284 }
50015285 }
5286
+ Globals.SAVEONMAKE = keep;
50025287 }
50035288
50045289 void ungroup()
....@@ -5287,13 +5572,28 @@
52875572 cButton clearpanelButton;
52885573 cButton unselectButton;
52895574
5290
- cButton minButton;
5291
- cButton maxButton;
5292
- cButton fullButton;
5293
- cButton undoButton;
5294
- cButton redoButton;
5575
+ cButton restoreCameraButton;
5576
+
52955577 cButton saveButton;
52965578 cButton oneStepButton;
5579
+
5580
+ cButton groupButton;
5581
+ cButton ungroupButton;
5582
+ cButton compositeButton;
5583
+ cButton switchButton;
5584
+ cButton loopButton;
5585
+ cButton textureButton;
5586
+
5587
+ cButton gridButton;
5588
+ cButton boxButton;
5589
+ cButton sphereButton;
5590
+ cButton coneButton;
5591
+ cButton torusButton;
5592
+ cButton superButton;
5593
+ cButton kleinButton;
5594
+ cButton particlesButton;
5595
+ cButton overlayButton;
5596
+ cButton lightButton;
52975597
52985598 cButton screenfitButton;
52995599 cButton screenfitpointButton;
....@@ -5315,11 +5615,11 @@
53155615 //JTree jTree;
53165616 private MenuItem lookAtItem;
53175617 private MenuItem lookFromItem;
5318
- private MenuItem switchItem;
5618
+ private MenuItem switchViewItem;
53195619 private MenuItem cutItem;
53205620 private MenuItem undoItem;
53215621 private MenuItem redoItem;
5322
- private MenuItem duplicateItem;
5622
+ private JMenuItem duplicateItem;
53235623 private MenuItem cloneItem;
53245624 private MenuItem cloneSupportItem;
53255625 private MenuItem overwriteGeoItem;
....@@ -5407,7 +5707,7 @@
54075707 private MenuItem frontItem;
54085708 private MenuItem cameraItem;
54095709 private MenuItem compositeItem;
5410
- private MenuItem randomItem;
5710
+ private MenuItem switchItem;
54115711 private MenuItem physicsItem;
54125712 private MenuItem frameselectorItem;
54135713 private MenuItem scriptNodeItem;
....@@ -5481,5 +5781,5 @@
54815781
54825782 Menu cameraMenu;
54835783 MenuItem editCameraItem;
5484
- MenuItem revertCameraItem;
5784
+ MenuItem restoreCameraItem;
54855785 }