Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,6 +80,12 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
7789 SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +110,7 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
....@@ -150,6 +167,8 @@
150167
151168 void SetupMenu2(GroupEditor oe)
152169 {
170
+ oe.jTree = new cTree();
171
+
153172 Menu menu;
154173 oe.menuBar.add(menu = new Menu("Edit"));
155174 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +179,7 @@
160179 // redoItem = menu.add(new MenuItem("Redo"));
161180 // redoItem.addActionListener(this);
162181 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164183 duplicateItem.addActionListener(this);
165184 cloneItem = menu.add(new MenuItem("Clone"));
166185 cloneItem.addActionListener(this);
....@@ -202,23 +221,23 @@
202221 //zBufferItem.addActionListener(this);
203222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204223 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
207226
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212239
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222241 toggleHandleItem.addItemListener(this);
223242 toggleHandleItem.setState(CameraPane.HANDLES);
224243
....@@ -273,7 +292,7 @@
273292 {
274293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278297 oe.cameraMenu.add("-");
279298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +300,7 @@
281300 editLeafItem.addActionListener(this);
282301 lookAtItem.addActionListener(this);
283302 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
285304 }
286305
287306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +345,29 @@
326345 }
327346
328347 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
331350 backItem = menu.add(new MenuItem("Back"));
332351 backItem.addActionListener(this);
333352 frontItem = menu.add(new MenuItem("Front"));
334353 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
337359 hideItem = menu.add(new MenuItem("Hidden Group"));
338360 hideItem.addActionListener(this);
361
+ }
339362 ungroupItem = menu.add(new MenuItem("Ungroup"));
340363 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
344371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345372 switchGeoItem.addActionListener(this);
346373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +375,6 @@
348375 morphItem = menu.add(new MenuItem("Morph Group"));
349376 morphItem.addActionListener(this);
350377
351
- if (Globals.ADVANCED)
352
- {
353378 menu.add("-");
354379 physicsItem = menu.add(new MenuItem("Physics"));
355380 physicsItem.addActionListener(this);
....@@ -357,13 +382,11 @@
357382 frameselectorItem.addActionListener(this);
358383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359384 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362385 }
363386
364387 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
367390 billboardItem = menu.add(new MenuItem("Billboard"));
368391 billboardItem.addActionListener(this);
369392 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +397,14 @@
374397 shadowYItem.addActionListener(this);
375398 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
377403 if (Globals.ADVANCED)
378404 {
379405 menu.add("-");
380406 linkerItem = menu.add(new MenuItem("Linker"));
381407 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384408 templateItem = menu.add(new MenuItem("Template"));
385409 templateItem.addActionListener(this);
386410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -532,6 +556,7 @@
532556 buildToolsMenu(menu);
533557 }
534558
559
+
535560 void SetupUI2(ObjEditor oe)
536561 {
537562 // June 2019
....@@ -574,51 +599,79 @@
574599 oe.radioPanel.add(dummyButton);
575600 oe.buttonGroup.add(dummyButton);
576601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
577606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578607
579608 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580609 //minButton.setToolTipText("Minimize window");
581610 //minButton.addActionListener(this);
582611
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
586618
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588620 fullButton.setToolTipText("Full-screen window");
589621 fullButton.addActionListener(this);
590622
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
594630
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
601633 saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
602639
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604659 liveCB.setToolTipText("Enable animation");
605660 liveCB.addItemListener(this);
606661
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608663 oneStepButton.setToolTipText("Animate one step forward");
609664 oneStepButton.addActionListener(this);
610665
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612667 fastCB.setToolTipText("Fast mode");
613668 fastCB.addItemListener(this);
614669
615
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
622675
623676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624677 // screenfitpointButton.addActionListener(this);
....@@ -630,15 +683,13 @@
630683 snapobjectButton.setToolTipText("Snap Object");
631684 }
632685
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
636
-
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638687
639688 oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640689 twoButton.setToolTipText("Show center view only");
641690 twoButton.addActionListener(this);
691
+ this.fullscreenLayout = twoButton;
692
+
642693 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643694 fourButton.addActionListener(this);
644695 fourButton.setToolTipText("Show left panel only");
....@@ -653,26 +704,105 @@
653704 sevenButton.addActionListener(this);
654705 //
655706
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657708 rootButton.setToolTipText("Edit selection in new tab");
658709 rootButton.addActionListener(this);
659710
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661712 closeButton.setToolTipText("Close tab");
662713 closeButton.addActionListener(this);
663714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664715 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
716
+
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
748
+
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
668798 editButton.addActionListener(this);
669799
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
672802 uneditButton.addActionListener(this);
673803
674804 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
805
+ allParamsButton.setToolTipText("Show all controle");
676806 allParamsButton.addActionListener(this);
677807
678808 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +813,13 @@
683813 unselectButton.setToolTipText("Unselect");
684814 unselectButton.addActionListener(this);
685815
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
819
+
686820 editCommandsPanel.preferredHeight = 1;
687821
822
+ SetPinStates(false);
688823 // oe.treePanel.add(commandsPanel);
689824 // oe.treePanel.Return();
690825
....@@ -703,29 +838,17 @@
703838
704839 JScrollPane jSP;
705840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707842 ResetModel();
708843
709844 oe.treePanel.add(jSPPanel);
710845 oe.treePanel.Return();
711846
712
- cGridBag copyOptionsPanel = new cGridBag();
713
-
714
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
- colorCB.setToolTipText("Copy color when dropped");
716
- colorCB.addItemListener(this);
717
-
718
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
- materialCB.setToolTipText("Copy material when dropped");
720
- materialCB.addItemListener(this);
721
-
722
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
- textureCB.setToolTipText("Copy texture when dropped");
724
- textureCB.addItemListener(this);
725
-
726
- copyOptionsPanel.preferredHeight = 1;
727847 oe.treePanel.add(copyOptionsPanel);
728848 oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
729852
730853 // mainPanel.setDividerLocation(0.5); //1.0);
731854 // mainPanel.setResizeWeight(0.5);
....@@ -754,23 +877,43 @@
754877
755878 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756879 {
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
883
+
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
757894 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758895 boxCB.setToolTipText("Display bounding boxes");
759896 boxCB.addItemListener(this);
760897
761898 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
763900 zoomBoxCB.addItemListener(this);
764901
765902 if (true) // Globals.ADVANCED)
766903 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
770911
771912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772913 // localCB.addItemListener(this);
773914
915
+ panel.Return();
916
+
774917 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775918 crowdCB.setToolTipText("Used for crowds");
776919 crowdCB.addItemListener(this);
....@@ -787,6 +930,8 @@
787930 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788931 // speakerMocapCB.addItemListener(this);
789932
933
+ panel.Return();
934
+
790935 if (false)
791936 {
792937 // handled in scripts
....@@ -801,32 +946,72 @@
801946 //constraints.gridy += 1;
802947 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803948 smoothfocusCB.addItemListener(this);
949
+ panel.Return();
804950 }
805951
806952 //constraints.gridx += 1;
807953 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808954 // debugCB.addItemListener(this);
809955
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
810960 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
811962 oeilCB.addItemListener(this);
812963
964
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
965
+ shadowCB.setToolTipText("When live compute shadows");
966
+ shadowCB.addItemListener(this);
967
+
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
980
+
981
+ panel.Return();
982
+ if (Globals.ADVANCED)
983
+ {
813984 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
814985 lookAtCB.setToolTipText("Look-at target");
815986 lookAtCB.addItemListener(this);
987
+ }
816988
817989 }
818990
819991 cGridBag fill = new cGridBag();
820
-
821992 fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
822997
823998 panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
8241001
8251002 }
8261003
8271004 void EditObject(Object3D obj)
8281005 {
8291006 cRadio radioButton = new cRadio(obj.name);
1007
+
1008
+ // June 2019. Patch to avoid bug with transparency.
1009
+ radioButton.hadMaterial = obj.material != null;
1010
+ if (!radioButton.hadMaterial)
1011
+ {
1012
+ obj.material = new cMaterial();
1013
+ }
1014
+
8301015 radioButton.SetObject(obj);
8311016 radioButton.layout = sevenButton;
8321017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -848,23 +1033,28 @@
8481033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8491034 }
8501035
851
- JCheckBox liveCB;
852
- JCheckBox supportCB;
853
- JCheckBox localCB;
854
- JCheckBox crowdCB;
855
- JCheckBox smoothCB;
856
- JCheckBox fastCB;
857
- JCheckBox slowCB;
858
- JCheckBox boxCB;
859
- JCheckBox zoomBoxCB;
860
- JCheckBox trackCB;
861
- JCheckBox smoothfocusCB;
1036
+ cToggleButton liveCB;
1037
+ cCheckBox supportCB;
1038
+ cCheckBox localCB;
1039
+ cCheckBox crowdCB;
1040
+ cCheckBox smoothCB;
1041
+ cToggleButton fastCB;
1042
+ cCheckBox slowCB;
1043
+ cCheckBox boxCB;
1044
+ cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
1047
+ cCheckBox trackCB;
1048
+ cCheckBox smoothfocusCB;
8621049 // JCheckBox speakerMocapCB;
863
- JCheckBox speakerCameraCB;
864
- JCheckBox speakerFocusCB;
865
- JCheckBox debugCB;
866
- JCheckBox oeilCB;
867
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
8681058
8691059 // static int COLOR = 1;
8701060 // static int MATERIAL = 2;
....@@ -872,9 +1062,9 @@
8721062
8731063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8741064
875
- JCheckBox colorCB;
876
- JCheckBox materialCB;
877
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
8781068
8791069 public void itemStateChanged(ItemEvent e)
8801070 {
....@@ -967,6 +1157,18 @@
9671157 {
9681158 cameraView.ToggleOeil();
9691159 }
1160
+ else if(e.getSource() == shadowCB)
1161
+ {
1162
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1163
+ }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
9701172 else if(e.getSource() == lookAtCB)
9711173 {
9721174 cameraView.ToggleLookAt();
....@@ -983,7 +1185,8 @@
9831185
9841186 /**/
9851187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
986
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
9871190 if ((path == null) || (path.getPathCount() <= 1)) {
9881191 // We can't move the root node or an empty selection
9891192 return;
....@@ -1046,8 +1249,6 @@
10461249 }
10471250 }
10481251
1049
- String string = (String) object;
1050
-
10511252 System.out.println("Transfer = " + object + "; drop : " + target);
10521253 // if( object instanceof java.io.File[])
10531254 // {
....@@ -1055,6 +1256,8 @@
10551256 // objEditor.DropFile((java.io.File[]) object, true);
10561257 // return;
10571258 // }
1259
+
1260
+ String string = object.toString();
10581261
10591262 // File path for Mac and Windows
10601263 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1100,23 +1303,33 @@
11001303
11011304 assert target == objEditor.jTree;
11021305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
11031307 try {
1104
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11051309 } catch (Exception e) {
11061310 System.out.println("destinationPath : " + destinationPath);
11071311 return;
11081312 }
11091313
1110
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
11111315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
11121325 loadClipboard(true);
11131326 objEditor.jTree.setSelectionPath(destinationPath);
11141327 pasteInto(false, false);
1115
- } else {
1116
- loadClipboard(false);
1117
- objEditor.jTree.setSelectionPath(destinationPath);
1118
- pasteInto(false, false); // true); // ???
1119
- }
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
11201333 }
11211334 public void dropActionChanged(DropTargetDragEvent dtde)
11221335 // Called if the user has modified the current drop gesture
....@@ -1221,22 +1434,30 @@
12211434 {
12221435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12231436 //heightFieldItem.addActionListener(this);
1224
- gridItem = menu.add(new MenuItem("Grid"));
1225
- gridItem.addActionListener(this);
1226
- rectoidItem = menu.add(new MenuItem("Box"));
1227
- rectoidItem.addActionListener(this);
1228
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1229
- ellipsoidItem.addActionListener(this);
1230
- coneItem = menu.add(new MenuItem("Cone"));
1231
- coneItem.addActionListener(this);
1232
- torusItem = menu.add(new MenuItem("Torus"));
1233
- torusItem.addActionListener(this);
1234
- superItem = menu.add(new MenuItem("Superellipsoid"));
1235
- superItem.addActionListener(this);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
12361455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12371456 kleinItem.addActionListener(this);
1238
- particleItem = menu.add(new MenuItem("Particle system"));
1239
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
12401461 if (Globals.ADVANCED)
12411462 {
12421463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1262,15 +1483,15 @@
12621483 }
12631484 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12641485 bezierItem.addActionListener(this);
1265
- overlayItem = menu.add(new MenuItem("Overlay"));
1266
- overlayItem.addActionListener(this);
1267
- lightItem = menu.add(new MenuItem("Light"));
1268
- lightItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
12691490 menu.add("-");
12701491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12711492 //superLoopItem.addActionListener(this);
1272
- loopItem = menu.add(new MenuItem("Loop"));
1273
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
12741495 doubleItem = menu.add(new MenuItem("Fork"));
12751496 doubleItem.addActionListener(this);
12761497 if (Globals.ADVANCED)
....@@ -1286,6 +1507,9 @@
12861507 animationItem.addItemListener(this);
12871508 animationItem.setState(Globals.ANIMATION);
12881509
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
1512
+
12891513 menu.add("-");
12901514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12911515 parseverticesItem.addActionListener(this);
....@@ -1298,6 +1522,8 @@
12981522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12991523 reduce34MorphItem.addActionListener(this);
13001524 menu.add("-");
1525
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1526
+ memoryItem.addActionListener(this);
13011527 menu.add(computeAOItem = new MenuItem("Compute AO"));
13021528 computeAOItem.addActionListener(this);
13031529
....@@ -1306,8 +1532,6 @@
13061532 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13071533 mirrorItem.addActionListener(this);
13081534 menu.add("-");
1309
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1310
- memoryItem.addActionListener(this);
13111535 menu.add(analyzeItem = new MenuItem("Analyze"));
13121536 analyzeItem.addActionListener(this);
13131537 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1455,6 +1679,20 @@
14551679
14561680 makeSomething(shadow);
14571681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
14581696
14591697 /**
14601698 * applyExample
....@@ -1699,7 +1937,7 @@
16991937 {
17001938 ScreenFit();
17011939 } else
1702
- if (source == switchItem)
1940
+ if (source == switchViewItem)
17031941 {
17041942 cVector v1 = new cVector();
17051943 cVector v2 = new cVector();
....@@ -1708,11 +1946,11 @@
17081946 objEditor.cameraView.renderCamera.setAim(v2, v1);
17091947 objEditor.cameraView.repaint();
17101948 } else
1711
- if (source == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
17121950 {
17131951 makeSomething(new Box());
17141952 } else
1715
- if (source == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
17161954 {
17171955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17181956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1791,27 +2029,27 @@
17912029
17922030 makeSomething(obj);
17932031 } else
1794
- if (source == gridItem)
2032
+ if (source == gridItem || source == gridButton)
17952033 {
17962034 makeSomething(new Grid());
17972035 } else
1798
- if (source == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
17992037 {
18002038 makeSomething(new Sphere());
18012039 } else
1802
- if (source == coneItem)
2040
+ if (source == coneItem || source == coneButton)
18032041 {
18042042 makeSomething(new Cone());
18052043 } else
1806
- if (source == torusItem)
2044
+ if (source == torusItem || source == torusButton)
18072045 {
18082046 makeSomething(new Torus());
18092047 } else
1810
- if (source == superItem)
2048
+ if (source == superItem || source == superButton)
18112049 {
18122050 makeSomething(new Superellipsoid());
18132051 } else
1814
- if (source == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
18152053 {
18162054 makeSomething(new Klein());
18172055 } else
....@@ -1831,7 +2069,7 @@
18312069 {
18322070 makeSomething(new BezierSurface());
18332071 } else
1834
- if (source == overlayItem)
2072
+ if (source == overlayItem || source == overlayButton)
18352073 {
18362074 /*
18372075 Object3D obj = new BezierSurface(5,8);
....@@ -1879,7 +2117,7 @@
18792117 s.setup();
18802118 makeSomething(s);
18812119 } else
1882
- if (source == lightItem)
2120
+ if (source == lightItem || source == lightButton)
18832121 {
18842122 makeSomething(new Light());
18852123 } else
....@@ -1929,30 +2167,30 @@
19292167
19302168 group(g);
19312169 } else
1932
- if (source == loopItem)
2170
+ if (source == loopItem || source == loopButton)
19332171 {
19342172 Composite csg = new GroupLeaf();
19352173 csg.count = 5;
19362174 group(csg);
1937
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
19382176 csg.addChild(child);
19392177 child.addChild(csg);
19402178 } else
19412179 if (source == doubleItem)
19422180 {
1943
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
19442182 csg.count = 5;
19452183 group(csg);
1946
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
19472185 csg.addChild(child);
19482186 child.addChild(csg);
1949
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
19502188 csg.addChild(child);
19512189 child.addChild(csg);
19522190 } else
19532191 if (source == tripleItem)
19542192 {
1955
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
19562194 csg.count = 4;
19572195 group(csg);
19582196 Composite child = new cGroup();
....@@ -2016,15 +2254,31 @@
20162254 } else
20172255 if (source == undoButton)
20182256 {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20192260 Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
20202271 } else
20212272 if (source == redoButton)
20222273 {
2274
+ // Go to next version
20232275 Redo();
20242276 } else
20252277 if (source == saveButton)
20262278 {
2027
- Save();
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
20282282 } else
20292283 if (source == oneStepButton)
20302284 {
....@@ -2033,17 +2287,14 @@
20332287 } else
20342288 if (source == screenfitButton)
20352289 {
2036
- //Reload(lastConverter, lastFilename, true);
20372290 ScreenFit();
20382291 } else
20392292 if (source == screenfitpointButton)
20402293 {
2041
- //Reload(lastConverter, lastFilename, true);
20422294 ScreenFitPoint();
20432295 } else
20442296 if (source == snapobjectButton)
20452297 {
2046
- //Reload(lastConverter, lastFilename, true);
20472298 SnapObject();
20482299 } else
20492300 // if (event.getSource() == recompileButton)
....@@ -2419,9 +2670,9 @@
24192670 {
24202671 ClearSelection(true);
24212672 } else
2422
- if (source == grabItem)
2673
+ if (source == grabItem || source == groupButton)
24232674 {
2424
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
24252676 } else
24262677 if (source == hideItem)
24272678 {
....@@ -2439,11 +2690,11 @@
24392690 {
24402691 makeSomething(new Camera());
24412692 } else
2442
- if (source == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
24432694 {
24442695 group(new Composite());
24452696 } else
2446
- if (source == randomItem)
2697
+ if (source == switchItem || source == switchButton)
24472698 {
24482699 RandomNode random = new RandomNode();
24492700 group(random);
....@@ -2545,7 +2796,7 @@
25452796 {
25462797 group(new cLinker());
25472798 } else
2548
- if (source == textureItem)
2799
+ if (source == textureItem || source == textureButton)
25492800 {
25502801 group(new TextureNode());
25512802 } else
....@@ -2565,17 +2816,30 @@
25652816 {
25662817 CastShadow(2);
25672818 } else
2568
- if (source == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
25692820 {
2570
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
25712823 for (int i=0; i<group.selection.size(); i++)
25722824 {
2573
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
25742830 }
25752831
2576
- ClearSelection(false);
2577
-
2578
- refreshContents();
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
25792843 } else
25802844 if (source == genUVItem)
25812845 {
....@@ -2903,6 +3167,10 @@
29033167 if (source == twoButton)
29043168 {
29053169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
29063174 // bug
29073175 //gridPanel.setDividerLocation(1.0);
29083176 //bigPanel.setDividerLocation(0.0);
....@@ -2958,6 +3226,9 @@
29583226 {
29593227 radio.layout = threeButton;
29603228
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
3231
+
29613232 // bigThree.remove(scenePanel);
29623233 // bigThree.remove(centralPanel);
29633234 // bigThree.remove(XYZPanel);
....@@ -2996,6 +3267,9 @@
29963267 {
29973268 radio.layout = fourButton;
29983269
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
3272
+
29993273 // bigThree.remove(scenePanel);
30003274 // bigThree.remove(centralPanel);
30013275 // bigThree.remove(XYZPanel);
....@@ -3032,6 +3306,9 @@
30323306 if (source == sixButton)
30333307 {
30343308 radio.layout = sixButton;
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
30353312
30363313 // bigThree.remove(scenePanel);
30373314 // bigThree.remove(centralPanel);
....@@ -3070,6 +3347,9 @@
30703347 if (source == sevenButton)
30713348 {
30723349 radio.layout = sevenButton;
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
30733353
30743354 // bigThree.remove(scenePanel);
30753355 // bigThree.remove(centralPanel);
....@@ -3126,12 +3406,19 @@
31263406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31273407 {
31283408 ab = (cRadio)e.nextElement();
3129
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31303410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
31313417 buttonGroup.remove(ab);
31323418 radioPanel.remove(ab);
31333419
3134
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
31353422 // ab.GetObject().objectUI = null; // ?????????
31363423
31373424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3144,6 +3431,12 @@
31443431 } else
31453432 if (source == editItem || source == editButton)
31463433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
31473440 EditSelection(false);
31483441 } else
31493442 if (source == uneditButton)
....@@ -3153,6 +3446,7 @@
31533446 Object3D child = (Object3D)e.nextElement();
31543447 if(child.editWindow != null)
31553448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
31563450 child.CloseUI();
31573451 listUI.remove(child);
31583452
....@@ -3169,6 +3463,7 @@
31693463 //copy.ClearUI();
31703464 for (Object3D obj : listUI)
31713465 {
3466
+ obj.pinned = false;
31723467 obj.CloseUI();
31733468 }
31743469 listUI.clear();
....@@ -3178,7 +3473,7 @@
31783473 {
31793474 assert(copy == group);
31803475
3181
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31823477
31833478 for (Object3D obj : listUI)
31843479 {
....@@ -3227,6 +3522,9 @@
32273522 }
32283523
32293524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
32303528 //Globals.theRenderer.object = group;
32313529 if(!useclient)
32323530 {
....@@ -3245,6 +3543,7 @@
32453543
32463544 // fix "+" issue
32473545 //group.editWindow = this;
3546
+ group.manipWindow = this;
32483547
32493548 /*
32503549 currentLayout = radio.layout;
....@@ -3252,6 +3551,13 @@
32523551 currentLayout = sevenButton;
32533552 */
32543553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
32553561 keepparent = group.parent;
32563562 // PARENT = NULL or not???
32573563 //group.parent = null; // ROOT
....@@ -3265,7 +3571,7 @@
32653571 cameraView.ProtectCamera();
32663572 cameraView.repaint();
32673573 return;
3268
- } else if (event.getSource() == revertCameraItem)
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32693575 {
32703576 cameraView.RevertCamera();
32713577 cameraView.repaint();
....@@ -4319,10 +4625,6 @@
43194625 // }
43204626 // }
43214627
4322
- static boolean allparams = true;
4323
-
4324
- static Vector<Object3D> listUI = new Vector<Object3D>();
4325
-
43264628 void EditSelection(boolean newWindow)
43274629 {
43284630 // aConstraints.gridy = 0;
....@@ -4330,7 +4632,7 @@
43304632 {
43314633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43324634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4333
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43344636
43354637 Object3D elem = (Object3D)group.selection.elementAt(i);
43364638 if(elem != group || !newWindow)
....@@ -4415,7 +4717,8 @@
44154717 //new Exception().printStackTrace();
44164718
44174719 freezemodel = true;
4418
-
4720
+ ClearUnpinned();
4721
+
44194722 /**/
44204723 //switch (event.id)
44214724 {
....@@ -4448,7 +4751,7 @@
44484751 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44494752 // a camera
44504753 {
4451
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44524755 {
44534756 CameraPane.camerachangeframe = 0; // don't refuse it
44544757 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4457,6 +4760,13 @@
44574760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44584761 }
44594762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
44604770 refreshContents();
44614771 //return true;
44624772 }
....@@ -4466,9 +4776,18 @@
44664776 freezemodel = false;
44674777 }
44684778
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
44694787 void refreshContents(boolean cp)
44704788 {
4471
- if (!Globals.MOUSEDRAGGED)
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44724791 {
44734792 objEditor.ClearInfo(); // .GetMaterial());
44744793
....@@ -4567,7 +4886,8 @@
45674886
45684887 if (cut)
45694888 {
4570
- Save();
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
45714891 //int indices[] = jList.getSelectedIndices();
45724892 //for (int i = indices.length - 1; i >= 0; i--)
45734893 //jList.remove(indices[i]);
....@@ -4670,6 +4990,10 @@
46704990
46714991 void paste(boolean expand)
46724992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
46734997 // if (GrafreeD.clipboard == null)
46744998 // return;
46754999 boolean first = true;
....@@ -4729,6 +5053,7 @@
47295053 Grafreed.clipboard.get(0).parent = keepparent;
47305054 }
47315055
5056
+ Globals.REPLACEONMAKE = keep;
47325057 ResetModel();
47335058 refreshContents();
47345059 }
....@@ -4864,6 +5189,10 @@
48645189
48655190 void group(Object3D csg, boolean grab)
48665191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
48675196 if (//false) // why??
48685197 !group.selection.isEmpty())
48695198 {
....@@ -4977,10 +5306,15 @@
49775306 //node.add(csg);
49785307 //makeSomething(node);
49795308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
49805310 }
49815311
49825312 void Ungroup(Object3D g)
49835313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
49845318 if (g instanceof HiddenObject)
49855319 {
49865320 HiddenObject h = (HiddenObject) g;
....@@ -4997,6 +5331,7 @@
49975331 objEditor.makeSomething(g.get(i), false);
49985332 }
49995333 }
5334
+ Globals.REPLACEONMAKE = keep;
50005335 }
50015336
50025337 void ungroup()
....@@ -5285,13 +5620,28 @@
52855620 cButton clearpanelButton;
52865621 cButton unselectButton;
52875622
5288
- cButton minButton;
5289
- cButton maxButton;
5290
- cButton fullButton;
5291
- cButton undoButton;
5292
- cButton redoButton;
5623
+ cButton restoreCameraButton;
5624
+
52935625 cButton saveButton;
52945626 cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
52955645
52965646 cButton screenfitButton;
52975647 cButton screenfitpointButton;
....@@ -5313,11 +5663,11 @@
53135663 //JTree jTree;
53145664 private MenuItem lookAtItem;
53155665 private MenuItem lookFromItem;
5316
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
53175667 private MenuItem cutItem;
53185668 private MenuItem undoItem;
53195669 private MenuItem redoItem;
5320
- private MenuItem duplicateItem;
5670
+ private JMenuItem duplicateItem;
53215671 private MenuItem cloneItem;
53225672 private MenuItem cloneSupportItem;
53235673 private MenuItem overwriteGeoItem;
....@@ -5405,7 +5755,7 @@
54055755 private MenuItem frontItem;
54065756 private MenuItem cameraItem;
54075757 private MenuItem compositeItem;
5408
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
54095759 private MenuItem physicsItem;
54105760 private MenuItem frameselectorItem;
54115761 private MenuItem scriptNodeItem;
....@@ -5479,5 +5829,5 @@
54795829
54805830 Menu cameraMenu;
54815831 MenuItem editCameraItem;
5482
- MenuItem revertCameraItem;
5832
+ MenuItem restoreCameraItem;
54835833 }