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
....@@ -246,7 +252,7 @@
246252
247253 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248254 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
255
+ toggleDebugItem.setState(Globals.DEBUG);
250256
251257 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252258 toggleFrustumItem.addItemListener(this);
....@@ -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,8 +544,21 @@
533544 buildToolsMenu(menu);
534545 }
535546
547
+
536548 void SetupUI2(ObjEditor oe)
537549 {
550
+ // June 2019
551
+ if (oe == null)
552
+ {
553
+ //super.SetupUI2(this);
554
+ //return;
555
+ }
556
+
557
+ if (copy != group)
558
+ {
559
+ //super.SetupUI2(this);
560
+ }
561
+
538562 //new Exception().printStackTrace();
539563
540564 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -563,39 +587,79 @@
563587 oe.radioPanel.add(dummyButton);
564588 oe.buttonGroup.add(dummyButton);
565589 */
590
+ cGridBag copyOptionsPanel = new cGridBag();
591
+
592
+ copyOptionsPanel.preferredHeight = 1;
593
+
566594 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
567595
568
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
- undoButton.setToolTipText("Undo changes");
570
- undoButton.addActionListener(this);
596
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ //minButton.setToolTipText("Minimize window");
598
+ //minButton.addActionListener(this);
571599
572
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
- redoButton.setToolTipText("Redo changes");
574
- redoButton.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
+ }
575606
576
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
- saveButton.setToolTipText("Save changes");
607
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ fullButton.setToolTipText("Full-screen window");
609
+ fullButton.addActionListener(this);
610
+
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);
618
+
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
578621 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);
579627
580
- 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);
581647 liveCB.setToolTipText("Enable animation");
582648 liveCB.addItemListener(this);
583649
584
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585651 oneStepButton.setToolTipText("Animate one step forward");
586652 oneStepButton.addActionListener(this);
587653
588
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
589655 fastCB.setToolTipText("Fast mode");
590656 fastCB.addItemListener(this);
591657
592
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
593
- trackCB.setToolTipText("Enable tracking");
594
- trackCB.addItemListener(this);
595
-
596
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- screenfitButton.setToolTipText("Screen fit");
598
- 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);
599663
600664 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
601665 // screenfitpointButton.addActionListener(this);
....@@ -607,65 +671,145 @@
607671 snapobjectButton.setToolTipText("Snap Object");
608672 }
609673
610
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
- flashSelectionButton.setToolTipText("Show selection");
612
- flashSelectionButton.addActionListener(this);
674
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
613675
614
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
615
-
616
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617677 twoButton.setToolTipText("Show center view only");
618678 twoButton.addActionListener(this);
619
- 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);
620682 fourButton.addActionListener(this);
621683 fourButton.setToolTipText("Show left panel only");
622
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623685 sixButton.setToolTipText("2-column layout left");
624686 sixButton.addActionListener(this);
625
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626688 threeButton.setToolTipText("2-column layout right");
627689 threeButton.addActionListener(this);
628
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629691 sevenButton.setToolTipText("3-column layout");
630692 sevenButton.addActionListener(this);
631693 //
632694
633
- 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);
634696 rootButton.setToolTipText("Edit selection in new tab");
635697 rootButton.addActionListener(this);
636698
637
- 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);
638700 closeButton.setToolTipText("Close tab");
639701 closeButton.addActionListener(this);
640702 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
641703 //clearButton.addActionListener(this);
642
-
643
- 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
+ }
644736
645
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- 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");
647786 editButton.addActionListener(this);
648787
649
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- uneditButton.setToolTipText("Unedit selection");
788
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
789
+ uneditButton.setToolTipText("Remove selection controls");
651790 uneditButton.addActionListener(this);
652791
653
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
654
- allParamsButton.setToolTipText("Edit all params");
792
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
793
+ allParamsButton.setToolTipText("Show all controle");
655794 allParamsButton.addActionListener(this);
656795
657
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
796
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658797 clearPanelButton.setToolTipText("Clear edit panel");
659798 clearPanelButton.addActionListener(this);
660799
661
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662801 unselectButton.setToolTipText("Unselect");
663802 unselectButton.addActionListener(this);
664803
665
- 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);
666807
667
- oe.treePanel.add(commandsPanel);
668
- oe.treePanel.Return();
808
+ editCommandsPanel.preferredHeight = 1;
809
+
810
+ SetPinStates(false);
811
+// oe.treePanel.add(commandsPanel);
812
+// oe.treePanel.Return();
669813
670814 // oe.aConstraints.gridx += 1;
671815 // oe.aConstraints.weighty = 0;
....@@ -682,29 +826,17 @@
682826
683827 JScrollPane jSP;
684828 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
685
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
829
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
686830 ResetModel();
687831
688832 oe.treePanel.add(jSPPanel);
689833 oe.treePanel.Return();
690834
691
- cGridBag copyOptionsPanel = new cGridBag();
692
-
693
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
694
- colorCB.setToolTipText("Copy color when dropped");
695
- colorCB.addItemListener(this);
696
-
697
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
698
- materialCB.setToolTipText("Copy material when dropped");
699
- materialCB.addItemListener(this);
700
-
701
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
702
- textureCB.setToolTipText("Copy texture when dropped");
703
- textureCB.addItemListener(this);
704
-
705
- copyOptionsPanel.preferredHeight = 1;
706835 oe.treePanel.add(copyOptionsPanel);
707836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
708840
709841 // mainPanel.setDividerLocation(0.5); //1.0);
710842 // mainPanel.setResizeWeight(0.5);
....@@ -733,23 +865,43 @@
733865
734866 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
735867 {
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
+
736882 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
737883 boxCB.setToolTipText("Display bounding boxes");
738884 boxCB.addItemListener(this);
739885
740886 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
741
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
887
+ zoomBoxCB.setToolTipText("Display only for wheel");
742888 zoomBoxCB.addItemListener(this);
743889
744890 if (true) // Globals.ADVANCED)
745891 {
746
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
747
- supportCB.setToolTipText("Enable rigging");
748
- 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);
749899
750900 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
751901 // localCB.addItemListener(this);
752902
903
+ panel.Return();
904
+
753905 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
754906 crowdCB.setToolTipText("Used for crowds");
755907 crowdCB.addItemListener(this);
....@@ -766,6 +918,8 @@
766918 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
767919 // speakerMocapCB.addItemListener(this);
768920
921
+ panel.Return();
922
+
769923 if (false)
770924 {
771925 // handled in scripts
....@@ -780,32 +934,72 @@
780934 //constraints.gridy += 1;
781935 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
782936 smoothfocusCB.addItemListener(this);
937
+ panel.Return();
783938 }
784939
785940 //constraints.gridx += 1;
786941 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
787942 // debugCB.addItemListener(this);
788943
944
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
945
+ trackCB.setToolTipText("Enable tracking target");
946
+ trackCB.addItemListener(this);
947
+
789948 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
949
+ oeilCB.setToolTipText("Move camera when tracking");
790950 oeilCB.addItemListener(this);
791951
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
+ {
792972 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
793973 lookAtCB.setToolTipText("Look-at target");
794974 lookAtCB.addItemListener(this);
975
+ }
795976
796977 }
797978
798979 cGridBag fill = new cGridBag();
799
-
800980 fill.preferredHeight = 200;
981
+ cGridBag fill2 = new cGridBag();
982
+ fill2.preferredHeight = 200;
983
+ cGridBag fill3 = new cGridBag();
984
+ fill3.preferredHeight = 200;
801985
802986 panel.add(fill);
987
+ panel.add(fill2);
988
+ panel.add(fill3);
803989
804990 }
805991
806992 void EditObject(Object3D obj)
807993 {
808994 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
+
8091003 radioButton.SetObject(obj);
8101004 radioButton.layout = sevenButton;
8111005 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -817,6 +1011,8 @@
8171011
8181012 void SetupViews(ObjEditor oe)
8191013 {
1014
+ theFrame = this;
1015
+
8201016 oe.SetupViews();
8211017
8221018 System.out.println("SetupViews");
....@@ -825,23 +1021,28 @@
8251021 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8261022 }
8271023
828
- JCheckBox liveCB;
829
- JCheckBox supportCB;
830
- JCheckBox localCB;
831
- JCheckBox crowdCB;
832
- JCheckBox smoothCB;
833
- JCheckBox fastCB;
834
- JCheckBox slowCB;
835
- JCheckBox boxCB;
836
- JCheckBox zoomBoxCB;
837
- JCheckBox trackCB;
838
- 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;
8391037 // JCheckBox speakerMocapCB;
840
- JCheckBox speakerCameraCB;
841
- JCheckBox speakerFocusCB;
842
- JCheckBox debugCB;
843
- JCheckBox oeilCB;
844
- JCheckBox lookAtCB;
1038
+ cCheckBox speakerCameraCB;
1039
+ cCheckBox speakerFocusCB;
1040
+ cCheckBox debugCB;
1041
+
1042
+ cCheckBox oeilCB;
1043
+ cCheckBox shadowCB;
1044
+ cCheckBox autokeepCB;
1045
+ cCheckBox lookAtCB;
8451046
8461047 // static int COLOR = 1;
8471048 // static int MATERIAL = 2;
....@@ -849,9 +1050,9 @@
8491050
8501051 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8511052
852
- JCheckBox colorCB;
853
- JCheckBox materialCB;
854
- JCheckBox textureCB;
1053
+ cCheckBox colorCB;
1054
+ cCheckBox materialCB;
1055
+ cCheckBox textureCB;
8551056
8561057 public void itemStateChanged(ItemEvent e)
8571058 {
....@@ -944,6 +1145,18 @@
9441145 {
9451146 cameraView.ToggleOeil();
9461147 }
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
+ }
9471160 else if(e.getSource() == lookAtCB)
9481161 {
9491162 cameraView.ToggleLookAt();
....@@ -960,7 +1173,8 @@
9601173
9611174 /**/
9621175 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
963
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1176
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1177
+ TreePath path = objEditor.jTree.getSelectionPath();
9641178 if ((path == null) || (path.getPathCount() <= 1)) {
9651179 // We can't move the root node or an empty selection
9661180 return;
....@@ -1023,8 +1237,6 @@
10231237 }
10241238 }
10251239
1026
- String string = (String) object;
1027
-
10281240 System.out.println("Transfer = " + object + "; drop : " + target);
10291241 // if( object instanceof java.io.File[])
10301242 // {
....@@ -1032,6 +1244,8 @@
10321244 // objEditor.DropFile((java.io.File[]) object, true);
10331245 // return;
10341246 // }
1247
+
1248
+ String string = object.toString();
10351249
10361250 // File path for Mac and Windows
10371251 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1077,23 +1291,33 @@
10771291
10781292 assert target == objEditor.jTree;
10791293 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1294
+ Object3D destinationLeaf;
10801295 try {
1081
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1296
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10821297 } catch (Exception e) {
10831298 System.out.println("destinationPath : " + destinationPath);
10841299 return;
10851300 }
10861301
1087
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1302
+ for (int i=group.selection.size(); --i>=0;)
10881303 {
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
+// {
10891313 loadClipboard(true);
10901314 objEditor.jTree.setSelectionPath(destinationPath);
10911315 pasteInto(false, false);
1092
- } else {
1093
- loadClipboard(false);
1094
- objEditor.jTree.setSelectionPath(destinationPath);
1095
- pasteInto(false, false); // true); // ???
1096
- }
1316
+// } else {
1317
+// loadClipboard(false);
1318
+// objEditor.jTree.setSelectionPath(destinationPath);
1319
+// pasteInto(false, false); // true); // ???
1320
+// }
10971321 }
10981322 public void dropActionChanged(DropTargetDragEvent dtde)
10991323 // Called if the user has modified the current drop gesture
....@@ -1198,22 +1422,30 @@
11981422 {
11991423 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12001424 //heightFieldItem.addActionListener(this);
1201
- gridItem = menu.add(new MenuItem("Grid"));
1202
- gridItem.addActionListener(this);
1203
- rectoidItem = menu.add(new MenuItem("Box"));
1204
- rectoidItem.addActionListener(this);
1205
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1206
- ellipsoidItem.addActionListener(this);
1207
- coneItem = menu.add(new MenuItem("Cone"));
1208
- coneItem.addActionListener(this);
1209
- torusItem = menu.add(new MenuItem("Torus"));
1210
- torusItem.addActionListener(this);
1211
- superItem = menu.add(new MenuItem("Superellipsoid"));
1212
- 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
+ {
12131443 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12141444 kleinItem.addActionListener(this);
1215
- particleItem = menu.add(new MenuItem("Particle system"));
1216
- particleItem.addActionListener(this);
1445
+ }
1446
+
1447
+// particleItem = menu.add(new MenuItem("Particle system"));
1448
+// particleItem.addActionListener(this);
12171449 if (Globals.ADVANCED)
12181450 {
12191451 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1239,15 +1471,15 @@
12391471 }
12401472 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12411473 bezierItem.addActionListener(this);
1242
- overlayItem = menu.add(new MenuItem("Overlay"));
1243
- overlayItem.addActionListener(this);
1244
- lightItem = menu.add(new MenuItem("Light"));
1245
- 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);
12461478 menu.add("-");
12471479 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12481480 //superLoopItem.addActionListener(this);
1249
- loopItem = menu.add(new MenuItem("Loop"));
1250
- loopItem.addActionListener(this);
1481
+// loopItem = menu.add(new MenuItem("Loop"));
1482
+// loopItem.addActionListener(this);
12511483 doubleItem = menu.add(new MenuItem("Fork"));
12521484 doubleItem.addActionListener(this);
12531485 if (Globals.ADVANCED)
....@@ -1263,6 +1495,9 @@
12631495 animationItem.addItemListener(this);
12641496 animationItem.setState(Globals.ANIMATION);
12651497
1498
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1499
+ archiveItem.addActionListener(this);
1500
+
12661501 menu.add("-");
12671502 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12681503 parseverticesItem.addActionListener(this);
....@@ -1275,6 +1510,8 @@
12751510 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12761511 reduce34MorphItem.addActionListener(this);
12771512 menu.add("-");
1513
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1514
+ memoryItem.addActionListener(this);
12781515 menu.add(computeAOItem = new MenuItem("Compute AO"));
12791516 computeAOItem.addActionListener(this);
12801517
....@@ -1283,8 +1520,6 @@
12831520 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12841521 mirrorItem.addActionListener(this);
12851522 menu.add("-");
1286
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1287
- memoryItem.addActionListener(this);
12881523 menu.add(analyzeItem = new MenuItem("Analyze"));
12891524 analyzeItem.addActionListener(this);
12901525 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1428,9 +1663,24 @@
14281663 shadow.material = new cMaterial(obj.material);
14291664 shadow.material.diffuse = 0.0001f;
14301665 shadow.material.specular = 0.0001f;
1666
+ //shadow.projectedVertices[1].x = 300;
14311667
14321668 makeSomething(shadow);
14331669 }
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
+ }
14341684
14351685 /**
14361686 * applyExample
....@@ -1675,7 +1925,7 @@
16751925 {
16761926 ScreenFit();
16771927 } else
1678
- if (source == switchItem)
1928
+ if (source == switchViewItem)
16791929 {
16801930 cVector v1 = new cVector();
16811931 cVector v2 = new cVector();
....@@ -1684,11 +1934,11 @@
16841934 objEditor.cameraView.renderCamera.setAim(v2, v1);
16851935 objEditor.cameraView.repaint();
16861936 } else
1687
- if (source == rectoidItem)
1937
+ if (source == rectoidItem || source == boxButton)
16881938 {
16891939 makeSomething(new Box());
16901940 } else
1691
- if (source == particleItem)
1941
+ if (source == particleItem || source == particlesButton)
16921942 {
16931943 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16941944 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1767,27 +2017,27 @@
17672017
17682018 makeSomething(obj);
17692019 } else
1770
- if (source == gridItem)
2020
+ if (source == gridItem || source == gridButton)
17712021 {
17722022 makeSomething(new Grid());
17732023 } else
1774
- if (source == ellipsoidItem)
2024
+ if (source == ellipsoidItem || source == sphereButton)
17752025 {
17762026 makeSomething(new Sphere());
17772027 } else
1778
- if (source == coneItem)
2028
+ if (source == coneItem || source == coneButton)
17792029 {
17802030 makeSomething(new Cone());
17812031 } else
1782
- if (source == torusItem)
2032
+ if (source == torusItem || source == torusButton)
17832033 {
17842034 makeSomething(new Torus());
17852035 } else
1786
- if (source == superItem)
2036
+ if (source == superItem || source == superButton)
17872037 {
17882038 makeSomething(new Superellipsoid());
17892039 } else
1790
- if (source == kleinItem)
2040
+ if (source == kleinItem || source == kleinButton)
17912041 {
17922042 makeSomething(new Klein());
17932043 } else
....@@ -1807,7 +2057,7 @@
18072057 {
18082058 makeSomething(new BezierSurface());
18092059 } else
1810
- if (source == overlayItem)
2060
+ if (source == overlayItem || source == overlayButton)
18112061 {
18122062 /*
18132063 Object3D obj = new BezierSurface(5,8);
....@@ -1855,7 +2105,7 @@
18552105 s.setup();
18562106 makeSomething(s);
18572107 } else
1858
- if (source == lightItem)
2108
+ if (source == lightItem || source == lightButton)
18592109 {
18602110 makeSomething(new Light());
18612111 } else
....@@ -1905,30 +2155,30 @@
19052155
19062156 group(g);
19072157 } else
1908
- if (source == loopItem)
2158
+ if (source == loopItem || source == loopButton)
19092159 {
19102160 Composite csg = new GroupLeaf();
19112161 csg.count = 5;
19122162 group(csg);
1913
- Composite child = new cGroup();
2163
+ Composite child = new cGroup("Branch");
19142164 csg.addChild(child);
19152165 child.addChild(csg);
19162166 } else
19172167 if (source == doubleItem)
19182168 {
1919
- Composite csg = new GroupLeaf();
2169
+ Composite csg = new GroupLeaf("Fork");
19202170 csg.count = 5;
19212171 group(csg);
1922
- Composite child = new cGroup();
2172
+ Composite child = new cGroup("Branch A");
19232173 csg.addChild(child);
19242174 child.addChild(csg);
1925
- child = new cGroup();
2175
+ child = new cGroup("Branch B");
19262176 csg.addChild(child);
19272177 child.addChild(csg);
19282178 } else
19292179 if (source == tripleItem)
19302180 {
1931
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Trident");
19322182 csg.count = 4;
19332183 group(csg);
19342184 Composite child = new cGroup();
....@@ -1978,17 +2228,45 @@
19782228 {
19792229 DumpObject();
19802230 } else
2231
+ if (source == minButton)
2232
+ {
2233
+ Minimize();
2234
+ } else
2235
+ if (source == maxButton)
2236
+ {
2237
+ Maximize();
2238
+ } else
2239
+ if (source == fullButton)
2240
+ {
2241
+ ToggleFullScreen();
2242
+ } else
19812243 if (source == undoButton)
19822244 {
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
19832248 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();
19842259 } else
19852260 if (source == redoButton)
19862261 {
2262
+ // Go to next version
19872263 Redo();
19882264 } else
19892265 if (source == saveButton)
19902266 {
1991
- Save();
2267
+ // Save a new version
2268
+ if (!Save(true))
2269
+ java.awt.Toolkit.getDefaultToolkit().beep();
19922270 } else
19932271 if (source == oneStepButton)
19942272 {
....@@ -1997,17 +2275,14 @@
19972275 } else
19982276 if (source == screenfitButton)
19992277 {
2000
- //Reload(lastConverter, lastFilename, true);
20012278 ScreenFit();
20022279 } else
20032280 if (source == screenfitpointButton)
20042281 {
2005
- //Reload(lastConverter, lastFilename, true);
20062282 ScreenFitPoint();
20072283 } else
20082284 if (source == snapobjectButton)
20092285 {
2010
- //Reload(lastConverter, lastFilename, true);
20112286 SnapObject();
20122287 } else
20132288 // if (event.getSource() == recompileButton)
....@@ -2383,9 +2658,9 @@
23832658 {
23842659 ClearSelection(true);
23852660 } else
2386
- if (source == grabItem)
2661
+ if (source == grabItem || source == groupButton)
23872662 {
2388
- group(new cGroup(), true);
2663
+ group(new cGroup(), false); // true);
23892664 } else
23902665 if (source == hideItem)
23912666 {
....@@ -2403,11 +2678,11 @@
24032678 {
24042679 makeSomething(new Camera());
24052680 } else
2406
- if (source == compositeItem)
2681
+ if (source == compositeItem || source == compositeButton)
24072682 {
24082683 group(new Composite());
24092684 } else
2410
- if (source == randomItem)
2685
+ if (source == switchItem || source == switchButton)
24112686 {
24122687 RandomNode random = new RandomNode();
24132688 group(random);
....@@ -2509,7 +2784,7 @@
25092784 {
25102785 group(new cLinker());
25112786 } else
2512
- if (source == textureItem)
2787
+ if (source == textureItem || source == textureButton)
25132788 {
25142789 group(new TextureNode());
25152790 } else
....@@ -2529,17 +2804,30 @@
25292804 {
25302805 CastShadow(2);
25312806 } else
2532
- if (source == ungroupItem)
2807
+ if (source == ungroupItem || source == ungroupButton)
25332808 {
2534
- //ungroup();
2809
+ boolean hasRoot = false;
2810
+
25352811 for (int i=0; i<group.selection.size(); i++)
25362812 {
2537
- Ungroup(group.selection.get(i));
2813
+ if (group.selection.get(i) == group)
2814
+ {
2815
+ hasRoot = true;
2816
+ break;
2817
+ }
25382818 }
25392819
2540
- ClearSelection(false);
2541
-
2542
- 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
+ }
25432831 } else
25442832 if (source == genUVItem)
25452833 {
....@@ -2867,6 +3155,10 @@
28673155 if (source == twoButton)
28683156 {
28693157 radio.layout = twoButton;
3158
+
3159
+ if (CameraPane.FULLSCREEN)
3160
+ fullscreenLayout = radio.layout;
3161
+
28703162 // bug
28713163 //gridPanel.setDividerLocation(1.0);
28723164 //bigPanel.setDividerLocation(0.0);
....@@ -2899,10 +3191,31 @@
28993191 bigThree.ClearUI();
29003192 bigThree.add(centralPanel);
29013193 bigThree.FlushUI();
3194
+
3195
+ cameraView.requestFocusInWindow();
3196
+
3197
+// refreshContents(true);
3198
+//
3199
+// try
3200
+// {
3201
+// java.awt.Robot bot = new java.awt.Robot();
3202
+// int mask = InputEvent.BUTTON1_MASK;
3203
+// bot.mouseMove(100, 100);
3204
+// bot.mousePress(mask);
3205
+// bot.mouseRelease(mask);
3206
+// }
3207
+// catch (Exception e)
3208
+// {
3209
+//
3210
+// }
3211
+
29023212 } else
29033213 if (source == threeButton)
29043214 {
29053215 radio.layout = threeButton;
3216
+
3217
+ if (CameraPane.FULLSCREEN)
3218
+ fullscreenLayout = radio.layout;
29063219
29073220 // bigThree.remove(scenePanel);
29083221 // bigThree.remove(centralPanel);
....@@ -2935,10 +3248,15 @@
29353248 bigThree.add(centralPanel);
29363249 bigThree.add(XYZPanel);
29373250 bigThree.FlushUI();
3251
+
3252
+ cameraView.requestFocusInWindow();
29383253 } else
29393254 if (source == fourButton)
29403255 {
29413256 radio.layout = fourButton;
3257
+
3258
+ if (CameraPane.FULLSCREEN)
3259
+ fullscreenLayout = radio.layout;
29423260
29433261 // bigThree.remove(scenePanel);
29443262 // bigThree.remove(centralPanel);
....@@ -2970,10 +3288,15 @@
29703288 bigThree.ClearUI();
29713289 bigThree.add(scenePanel);
29723290 bigThree.FlushUI();
3291
+
3292
+ cameraView.requestFocusInWindow();
29733293 } else
29743294 if (source == sixButton)
29753295 {
29763296 radio.layout = sixButton;
3297
+
3298
+ if (CameraPane.FULLSCREEN)
3299
+ fullscreenLayout = radio.layout;
29773300
29783301 // bigThree.remove(scenePanel);
29793302 // bigThree.remove(centralPanel);
....@@ -3006,10 +3329,15 @@
30063329 bigThree.add(scenePanel);
30073330 bigThree.add(centralPanel);
30083331 bigThree.FlushUI();
3332
+
3333
+ cameraView.requestFocusInWindow();
30093334 } else
30103335 if (source == sevenButton)
30113336 {
30123337 radio.layout = sevenButton;
3338
+
3339
+ if (CameraPane.FULLSCREEN)
3340
+ fullscreenLayout = radio.layout;
30133341
30143342 // bigThree.remove(scenePanel);
30153343 // bigThree.remove(centralPanel);
....@@ -3043,6 +3371,8 @@
30433371 bigThree.add(centralPanel);
30443372 bigThree.add(XYZPanel);
30453373 bigThree.FlushUI();
3374
+
3375
+ cameraView.requestFocusInWindow();
30463376 } else
30473377 if (source == rootButton)
30483378 {
....@@ -3054,6 +3384,7 @@
30543384 EditObject(obj);
30553385 }
30563386
3387
+ cameraView.requestFocusInWindow();
30573388 refreshContents(true);
30583389 } else
30593390 if (source == closeButton)
....@@ -3063,22 +3394,37 @@
30633394 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30643395 {
30653396 ab = (cRadio)e.nextElement();
3066
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3397
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30673398 {
3399
+ // Patch to avoid bug with transparency.
3400
+ if (!ab.hadMaterial)
3401
+ {
3402
+ ab.object.material = null;
3403
+ }
3404
+
30683405 buttonGroup.remove(ab);
30693406 radioPanel.remove(ab);
30703407
3071
- ab.GetObject().editWindow = null;
3408
+ //ab.GetObject().editWindow = null;
3409
+ ab.GetObject().manipWindow = null;
30723410 // ab.GetObject().objectUI = null; // ?????????
30733411
30743412 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30753413 break;
30763414 }
30773415 }
3416
+
3417
+ cameraView.requestFocusInWindow();
30783418 refreshContents(true);
30793419 } else
30803420 if (source == editItem || source == editButton)
30813421 {
3422
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3423
+ {
3424
+ Object3D child = (Object3D)e.nextElement();
3425
+ child.pinned = true;
3426
+ }
3427
+
30823428 EditSelection(false);
30833429 } else
30843430 if (source == uneditButton)
....@@ -3088,6 +3434,7 @@
30883434 Object3D child = (Object3D)e.nextElement();
30893435 if(child.editWindow != null)
30903436 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3437
+ child.pinned = false;
30913438 child.CloseUI();
30923439 listUI.remove(child);
30933440
....@@ -3104,6 +3451,7 @@
31043451 //copy.ClearUI();
31053452 for (Object3D obj : listUI)
31063453 {
3454
+ obj.pinned = false;
31073455 obj.CloseUI();
31083456 }
31093457 listUI.clear();
....@@ -3113,7 +3461,7 @@
31133461 {
31143462 assert(copy == group);
31153463
3116
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3464
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31173465
31183466 for (Object3D obj : listUI)
31193467 {
....@@ -3162,6 +3510,9 @@
31623510 }
31633511
31643512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
31653516 //Globals.theRenderer.object = group;
31663517 if(!useclient)
31673518 {
....@@ -3179,7 +3530,8 @@
31793530 }
31803531
31813532 // fix "+" issue
3182
- group.editWindow = this;
3533
+ //group.editWindow = this;
3534
+ group.manipWindow = this;
31833535
31843536 /*
31853537 currentLayout = radio.layout;
....@@ -3187,18 +3539,25 @@
31873539 currentLayout = sevenButton;
31883540 */
31893541 radio.layout.doClick();
3542
+
3543
+ ClearUnpinned();
3544
+ SetPinStates(group.selection.size() > 0);
3545
+ if (group.selection.size() == 1)
3546
+ EditSelection(false);
31903547 keepparent = group.parent;
31913548 // PARENT = NULL or not???
31923549 //group.parent = null; // ROOT
31933550 //group.attributes = -1;
31943551 ResetModel();
3552
+
3553
+ cameraView.requestFocusInWindow();
31953554 refreshContents(true);
31963555 } else if (event.getSource() == editCameraItem)
31973556 {
31983557 cameraView.ProtectCamera();
31993558 cameraView.repaint();
32003559 return;
3201
- } else if (event.getSource() == revertCameraItem)
3560
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32023561 {
32033562 cameraView.RevertCamera();
32043563 cameraView.repaint();
....@@ -3215,7 +3574,6 @@
32153574 }
32163575
32173576 boolean useclient = false;
3218
- cRadio radio;
32193577
32203578 void ToggleRoot()
32213579 {
....@@ -4253,10 +4611,6 @@
42534611 // }
42544612 // }
42554613
4256
- static boolean allparams = true;
4257
-
4258
- static Vector<Object3D> listUI = new Vector<Object3D>();
4259
-
42604614 void EditSelection(boolean newWindow)
42614615 {
42624616 // aConstraints.gridy = 0;
....@@ -4264,7 +4618,7 @@
42644618 {
42654619 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42664620 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4267
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4621
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42684622
42694623 Object3D elem = (Object3D)group.selection.elementAt(i);
42704624 if(elem != group || !newWindow)
....@@ -4349,7 +4703,8 @@
43494703 //new Exception().printStackTrace();
43504704
43514705 freezemodel = true;
4352
-
4706
+ ClearUnpinned();
4707
+
43534708 /**/
43544709 //switch (event.id)
43554710 {
....@@ -4382,7 +4737,7 @@
43824737 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43834738 // a camera
43844739 {
4385
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4740
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43864741 {
43874742 CameraPane.camerachangeframe = 0; // don't refuse it
43884743 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4391,6 +4746,13 @@
43914746 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43924747 }
43934748
4749
+ if (tps != null && tps.length == 1)
4750
+ {
4751
+ EditSelection(false);
4752
+ }
4753
+
4754
+ SetPinStates(tps != null && tps.length > 0);
4755
+
43944756 refreshContents();
43954757 //return true;
43964758 }
....@@ -4400,9 +4762,18 @@
44004762 freezemodel = false;
44014763 }
44024764
4765
+ void SetPinStates(boolean enabled)
4766
+ {
4767
+ editButton.setEnabled(enabled);
4768
+ uneditButton.setEnabled(enabled);
4769
+ unselectButton.setEnabled(enabled);
4770
+ flashSelectionButton.setEnabled(enabled);
4771
+ }
4772
+
44034773 void refreshContents(boolean cp)
44044774 {
4405
- if (!Globals.MOUSEDRAGGED)
4775
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4776
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44064777 {
44074778 objEditor.ClearInfo(); // .GetMaterial());
44084779
....@@ -4501,7 +4872,8 @@
45014872
45024873 if (cut)
45034874 {
4504
- Save();
4875
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4876
+// Save();
45054877 //int indices[] = jList.getSelectedIndices();
45064878 //for (int i = indices.length - 1; i >= 0; i--)
45074879 //jList.remove(indices[i]);
....@@ -4604,6 +4976,10 @@
46044976
46054977 void paste(boolean expand)
46064978 {
4979
+ if (Globals.REPLACEONMAKE)
4980
+ Save();
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
46074983 // if (GrafreeD.clipboard == null)
46084984 // return;
46094985 boolean first = true;
....@@ -4663,6 +5039,7 @@
46635039 Grafreed.clipboard.get(0).parent = keepparent;
46645040 }
46655041
5042
+ Globals.REPLACEONMAKE = keep;
46665043 ResetModel();
46675044 refreshContents();
46685045 }
....@@ -4798,6 +5175,10 @@
47985175
47995176 void group(Object3D csg, boolean grab)
48005177 {
5178
+ if (Globals.REPLACEONMAKE)
5179
+ Save();
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
48015182 if (//false) // why??
48025183 !group.selection.isEmpty())
48035184 {
....@@ -4911,10 +5292,15 @@
49115292 //node.add(csg);
49125293 //makeSomething(node);
49135294 makeSomething(csg);
5295
+ Globals.REPLACEONMAKE = keep;
49145296 }
49155297
49165298 void Ungroup(Object3D g)
49175299 {
5300
+ if (Globals.REPLACEONMAKE)
5301
+ Save();
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
49185304 if (g instanceof HiddenObject)
49195305 {
49205306 HiddenObject h = (HiddenObject) g;
....@@ -4931,6 +5317,7 @@
49315317 objEditor.makeSomething(g.get(i), false);
49325318 }
49335319 }
5320
+ Globals.REPLACEONMAKE = keep;
49345321 }
49355322
49365323 void ungroup()
....@@ -5219,10 +5606,28 @@
52195606 cButton clearpanelButton;
52205607 cButton unselectButton;
52215608
5609
+ cButton restoreCameraButton;
5610
+
52225611 cButton saveButton;
5223
- cButton undoButton;
5224
- cButton redoButton;
52255612 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;
52265631
52275632 cButton screenfitButton;
52285633 cButton screenfitpointButton;
....@@ -5235,14 +5640,6 @@
52355640
52365641 cButton setsupportButton;
52375642
5238
- cButton twoButton;
5239
- cButton sixButton;
5240
- cButton threeButton;
5241
- cButton sevenButton;
5242
- cButton fourButton; // full panel
5243
- cButton oneButton; // full XYZ
5244
- //cButton currentLayout;
5245
-
52465643 //
52475644 //Composite
52485645 Object3D // to do !!
....@@ -5252,11 +5649,11 @@
52525649 //JTree jTree;
52535650 private MenuItem lookAtItem;
52545651 private MenuItem lookFromItem;
5255
- private MenuItem switchItem;
5652
+ private MenuItem switchViewItem;
52565653 private MenuItem cutItem;
52575654 private MenuItem undoItem;
52585655 private MenuItem redoItem;
5259
- private MenuItem duplicateItem;
5656
+ private JMenuItem duplicateItem;
52605657 private MenuItem cloneItem;
52615658 private MenuItem cloneSupportItem;
52625659 private MenuItem overwriteGeoItem;
....@@ -5344,7 +5741,7 @@
53445741 private MenuItem frontItem;
53455742 private MenuItem cameraItem;
53465743 private MenuItem compositeItem;
5347
- private MenuItem randomItem;
5744
+ private MenuItem switchItem;
53485745 private MenuItem physicsItem;
53495746 private MenuItem frameselectorItem;
53505747 private MenuItem scriptNodeItem;
....@@ -5418,5 +5815,5 @@
54185815
54195816 Menu cameraMenu;
54205817 MenuItem editCameraItem;
5421
- MenuItem revertCameraItem;
5818
+ MenuItem restoreCameraItem;
54225819 }