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,20 +946,39 @@
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);
811
- oeilCB.setToolTipText("Move camera when tracking target");
961
+ oeilCB.setToolTipText("Move camera when tracking");
812962 oeilCB.addItemListener(this);
813963
814964 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
965
+ shadowCB.setToolTipText("When live compute shadows");
816966 shadowCB.addItemListener(this);
817967
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();
818982 if (Globals.ADVANCED)
819983 {
820984 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -825,10 +989,15 @@
825989 }
826990
827991 cGridBag fill = new cGridBag();
828
-
829992 fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
830997
831998 panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
8321001
8331002 }
8341003
....@@ -836,7 +1005,7 @@
8361005 {
8371006 cRadio radioButton = new cRadio(obj.name);
8381007
839
- // Patch to avoid bug with transparency.
1008
+ // June 2019. Patch to avoid bug with transparency.
8401009 radioButton.hadMaterial = obj.material != null;
8411010 if (!radioButton.hadMaterial)
8421011 {
....@@ -864,25 +1033,28 @@
8641033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8651034 }
8661035
867
- JCheckBox liveCB;
868
- JCheckBox supportCB;
869
- JCheckBox localCB;
870
- JCheckBox crowdCB;
871
- JCheckBox smoothCB;
872
- JCheckBox fastCB;
873
- JCheckBox slowCB;
874
- JCheckBox boxCB;
875
- JCheckBox zoomBoxCB;
876
- JCheckBox trackCB;
877
- 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;
8781049 // JCheckBox speakerMocapCB;
879
- JCheckBox speakerCameraCB;
880
- JCheckBox speakerFocusCB;
881
- JCheckBox debugCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
8821053
883
- JCheckBox oeilCB;
884
- JCheckBox shadowCB;
885
- JCheckBox lookAtCB;
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
8861058
8871059 // static int COLOR = 1;
8881060 // static int MATERIAL = 2;
....@@ -890,9 +1062,9 @@
8901062
8911063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8921064
893
- JCheckBox colorCB;
894
- JCheckBox materialCB;
895
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
8961068
8971069 public void itemStateChanged(ItemEvent e)
8981070 {
....@@ -989,6 +1161,14 @@
9891161 {
9901162 Globals.COMPUTESHADOWWHENLIVE ^= true;
9911163 }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
9921172 else if(e.getSource() == lookAtCB)
9931173 {
9941174 cameraView.ToggleLookAt();
....@@ -1005,7 +1185,8 @@
10051185
10061186 /**/
10071187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1008
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
10091190 if ((path == null) || (path.getPathCount() <= 1)) {
10101191 // We can't move the root node or an empty selection
10111192 return;
....@@ -1068,8 +1249,6 @@
10681249 }
10691250 }
10701251
1071
- String string = (String) object;
1072
-
10731252 System.out.println("Transfer = " + object + "; drop : " + target);
10741253 // if( object instanceof java.io.File[])
10751254 // {
....@@ -1077,6 +1256,8 @@
10771256 // objEditor.DropFile((java.io.File[]) object, true);
10781257 // return;
10791258 // }
1259
+
1260
+ String string = object.toString();
10801261
10811262 // File path for Mac and Windows
10821263 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1122,23 +1303,33 @@
11221303
11231304 assert target == objEditor.jTree;
11241305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
11251307 try {
1126
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11271309 } catch (Exception e) {
11281310 System.out.println("destinationPath : " + destinationPath);
11291311 return;
11301312 }
11311313
1132
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
11331315 {
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
+// {
11341325 loadClipboard(true);
11351326 objEditor.jTree.setSelectionPath(destinationPath);
11361327 pasteInto(false, false);
1137
- } else {
1138
- loadClipboard(false);
1139
- objEditor.jTree.setSelectionPath(destinationPath);
1140
- pasteInto(false, false); // true); // ???
1141
- }
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
11421333 }
11431334 public void dropActionChanged(DropTargetDragEvent dtde)
11441335 // Called if the user has modified the current drop gesture
....@@ -1243,22 +1434,30 @@
12431434 {
12441435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12451436 //heightFieldItem.addActionListener(this);
1246
- gridItem = menu.add(new MenuItem("Grid"));
1247
- gridItem.addActionListener(this);
1248
- rectoidItem = menu.add(new MenuItem("Box"));
1249
- rectoidItem.addActionListener(this);
1250
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1251
- ellipsoidItem.addActionListener(this);
1252
- coneItem = menu.add(new MenuItem("Cone"));
1253
- coneItem.addActionListener(this);
1254
- torusItem = menu.add(new MenuItem("Torus"));
1255
- torusItem.addActionListener(this);
1256
- superItem = menu.add(new MenuItem("Superellipsoid"));
1257
- 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
+ {
12581455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12591456 kleinItem.addActionListener(this);
1260
- particleItem = menu.add(new MenuItem("Particle system"));
1261
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
12621461 if (Globals.ADVANCED)
12631462 {
12641463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1284,15 +1483,15 @@
12841483 }
12851484 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12861485 bezierItem.addActionListener(this);
1287
- overlayItem = menu.add(new MenuItem("Overlay"));
1288
- overlayItem.addActionListener(this);
1289
- lightItem = menu.add(new MenuItem("Light"));
1290
- 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);
12911490 menu.add("-");
12921491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12931492 //superLoopItem.addActionListener(this);
1294
- loopItem = menu.add(new MenuItem("Loop"));
1295
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
12961495 doubleItem = menu.add(new MenuItem("Fork"));
12971496 doubleItem.addActionListener(this);
12981497 if (Globals.ADVANCED)
....@@ -1308,6 +1507,9 @@
13081507 animationItem.addItemListener(this);
13091508 animationItem.setState(Globals.ANIMATION);
13101509
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
1512
+
13111513 menu.add("-");
13121514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13131515 parseverticesItem.addActionListener(this);
....@@ -1320,6 +1522,8 @@
13201522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13211523 reduce34MorphItem.addActionListener(this);
13221524 menu.add("-");
1525
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1526
+ memoryItem.addActionListener(this);
13231527 menu.add(computeAOItem = new MenuItem("Compute AO"));
13241528 computeAOItem.addActionListener(this);
13251529
....@@ -1328,8 +1532,6 @@
13281532 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13291533 mirrorItem.addActionListener(this);
13301534 menu.add("-");
1331
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1332
- memoryItem.addActionListener(this);
13331535 menu.add(analyzeItem = new MenuItem("Analyze"));
13341536 analyzeItem.addActionListener(this);
13351537 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1477,6 +1679,20 @@
14771679
14781680 makeSomething(shadow);
14791681 }
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
+ }
14801696
14811697 /**
14821698 * applyExample
....@@ -1721,7 +1937,7 @@
17211937 {
17221938 ScreenFit();
17231939 } else
1724
- if (source == switchItem)
1940
+ if (source == switchViewItem)
17251941 {
17261942 cVector v1 = new cVector();
17271943 cVector v2 = new cVector();
....@@ -1730,11 +1946,11 @@
17301946 objEditor.cameraView.renderCamera.setAim(v2, v1);
17311947 objEditor.cameraView.repaint();
17321948 } else
1733
- if (source == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
17341950 {
17351951 makeSomething(new Box());
17361952 } else
1737
- if (source == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
17381954 {
17391955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17401956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1813,27 +2029,27 @@
18132029
18142030 makeSomething(obj);
18152031 } else
1816
- if (source == gridItem)
2032
+ if (source == gridItem || source == gridButton)
18172033 {
18182034 makeSomething(new Grid());
18192035 } else
1820
- if (source == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
18212037 {
18222038 makeSomething(new Sphere());
18232039 } else
1824
- if (source == coneItem)
2040
+ if (source == coneItem || source == coneButton)
18252041 {
18262042 makeSomething(new Cone());
18272043 } else
1828
- if (source == torusItem)
2044
+ if (source == torusItem || source == torusButton)
18292045 {
18302046 makeSomething(new Torus());
18312047 } else
1832
- if (source == superItem)
2048
+ if (source == superItem || source == superButton)
18332049 {
18342050 makeSomething(new Superellipsoid());
18352051 } else
1836
- if (source == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
18372053 {
18382054 makeSomething(new Klein());
18392055 } else
....@@ -1853,7 +2069,7 @@
18532069 {
18542070 makeSomething(new BezierSurface());
18552071 } else
1856
- if (source == overlayItem)
2072
+ if (source == overlayItem || source == overlayButton)
18572073 {
18582074 /*
18592075 Object3D obj = new BezierSurface(5,8);
....@@ -1901,7 +2117,7 @@
19012117 s.setup();
19022118 makeSomething(s);
19032119 } else
1904
- if (source == lightItem)
2120
+ if (source == lightItem || source == lightButton)
19052121 {
19062122 makeSomething(new Light());
19072123 } else
....@@ -1951,30 +2167,30 @@
19512167
19522168 group(g);
19532169 } else
1954
- if (source == loopItem)
2170
+ if (source == loopItem || source == loopButton)
19552171 {
19562172 Composite csg = new GroupLeaf();
19572173 csg.count = 5;
19582174 group(csg);
1959
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
19602176 csg.addChild(child);
19612177 child.addChild(csg);
19622178 } else
19632179 if (source == doubleItem)
19642180 {
1965
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
19662182 csg.count = 5;
19672183 group(csg);
1968
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
19692185 csg.addChild(child);
19702186 child.addChild(csg);
1971
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
19722188 csg.addChild(child);
19732189 child.addChild(csg);
19742190 } else
19752191 if (source == tripleItem)
19762192 {
1977
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
19782194 csg.count = 4;
19792195 group(csg);
19802196 Composite child = new cGroup();
....@@ -2038,15 +2254,31 @@
20382254 } else
20392255 if (source == undoButton)
20402256 {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20412260 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();
20422271 } else
20432272 if (source == redoButton)
20442273 {
2274
+ // Go to next version
20452275 Redo();
20462276 } else
20472277 if (source == saveButton)
20482278 {
2049
- Save();
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
20502282 } else
20512283 if (source == oneStepButton)
20522284 {
....@@ -2055,17 +2287,14 @@
20552287 } else
20562288 if (source == screenfitButton)
20572289 {
2058
- //Reload(lastConverter, lastFilename, true);
20592290 ScreenFit();
20602291 } else
20612292 if (source == screenfitpointButton)
20622293 {
2063
- //Reload(lastConverter, lastFilename, true);
20642294 ScreenFitPoint();
20652295 } else
20662296 if (source == snapobjectButton)
20672297 {
2068
- //Reload(lastConverter, lastFilename, true);
20692298 SnapObject();
20702299 } else
20712300 // if (event.getSource() == recompileButton)
....@@ -2441,9 +2670,9 @@
24412670 {
24422671 ClearSelection(true);
24432672 } else
2444
- if (source == grabItem)
2673
+ if (source == grabItem || source == groupButton)
24452674 {
2446
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
24472676 } else
24482677 if (source == hideItem)
24492678 {
....@@ -2461,11 +2690,11 @@
24612690 {
24622691 makeSomething(new Camera());
24632692 } else
2464
- if (source == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
24652694 {
24662695 group(new Composite());
24672696 } else
2468
- if (source == randomItem)
2697
+ if (source == switchItem || source == switchButton)
24692698 {
24702699 RandomNode random = new RandomNode();
24712700 group(random);
....@@ -2567,7 +2796,7 @@
25672796 {
25682797 group(new cLinker());
25692798 } else
2570
- if (source == textureItem)
2799
+ if (source == textureItem || source == textureButton)
25712800 {
25722801 group(new TextureNode());
25732802 } else
....@@ -2587,17 +2816,30 @@
25872816 {
25882817 CastShadow(2);
25892818 } else
2590
- if (source == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
25912820 {
2592
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
25932823 for (int i=0; i<group.selection.size(); i++)
25942824 {
2595
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
25962830 }
25972831
2598
- ClearSelection(false);
2599
-
2600
- 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
+ }
26012843 } else
26022844 if (source == genUVItem)
26032845 {
....@@ -2925,6 +3167,10 @@
29253167 if (source == twoButton)
29263168 {
29273169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
29283174 // bug
29293175 //gridPanel.setDividerLocation(1.0);
29303176 //bigPanel.setDividerLocation(0.0);
....@@ -2980,6 +3226,9 @@
29803226 {
29813227 radio.layout = threeButton;
29823228
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
3231
+
29833232 // bigThree.remove(scenePanel);
29843233 // bigThree.remove(centralPanel);
29853234 // bigThree.remove(XYZPanel);
....@@ -3018,6 +3267,9 @@
30183267 {
30193268 radio.layout = fourButton;
30203269
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
3272
+
30213273 // bigThree.remove(scenePanel);
30223274 // bigThree.remove(centralPanel);
30233275 // bigThree.remove(XYZPanel);
....@@ -3054,6 +3306,9 @@
30543306 if (source == sixButton)
30553307 {
30563308 radio.layout = sixButton;
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
30573312
30583313 // bigThree.remove(scenePanel);
30593314 // bigThree.remove(centralPanel);
....@@ -3092,6 +3347,9 @@
30923347 if (source == sevenButton)
30933348 {
30943349 radio.layout = sevenButton;
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
30953353
30963354 // bigThree.remove(scenePanel);
30973355 // bigThree.remove(centralPanel);
....@@ -3159,7 +3417,8 @@
31593417 buttonGroup.remove(ab);
31603418 radioPanel.remove(ab);
31613419
3162
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
31633422 // ab.GetObject().objectUI = null; // ?????????
31643423
31653424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3172,6 +3431,12 @@
31723431 } else
31733432 if (source == editItem || source == editButton)
31743433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
31753440 EditSelection(false);
31763441 } else
31773442 if (source == uneditButton)
....@@ -3181,6 +3446,7 @@
31813446 Object3D child = (Object3D)e.nextElement();
31823447 if(child.editWindow != null)
31833448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
31843450 child.CloseUI();
31853451 listUI.remove(child);
31863452
....@@ -3197,6 +3463,7 @@
31973463 //copy.ClearUI();
31983464 for (Object3D obj : listUI)
31993465 {
3466
+ obj.pinned = false;
32003467 obj.CloseUI();
32013468 }
32023469 listUI.clear();
....@@ -3206,7 +3473,7 @@
32063473 {
32073474 assert(copy == group);
32083475
3209
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32103477
32113478 for (Object3D obj : listUI)
32123479 {
....@@ -3255,6 +3522,9 @@
32553522 }
32563523
32573524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
32583528 //Globals.theRenderer.object = group;
32593529 if(!useclient)
32603530 {
....@@ -3273,6 +3543,7 @@
32733543
32743544 // fix "+" issue
32753545 //group.editWindow = this;
3546
+ group.manipWindow = this;
32763547
32773548 /*
32783549 currentLayout = radio.layout;
....@@ -3280,6 +3551,13 @@
32803551 currentLayout = sevenButton;
32813552 */
32823553 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);
32833561 keepparent = group.parent;
32843562 // PARENT = NULL or not???
32853563 //group.parent = null; // ROOT
....@@ -3293,7 +3571,7 @@
32933571 cameraView.ProtectCamera();
32943572 cameraView.repaint();
32953573 return;
3296
- } else if (event.getSource() == revertCameraItem)
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32973575 {
32983576 cameraView.RevertCamera();
32993577 cameraView.repaint();
....@@ -4347,10 +4625,6 @@
43474625 // }
43484626 // }
43494627
4350
- static boolean allparams = true;
4351
-
4352
- static Vector<Object3D> listUI = new Vector<Object3D>();
4353
-
43544628 void EditSelection(boolean newWindow)
43554629 {
43564630 // aConstraints.gridy = 0;
....@@ -4358,7 +4632,7 @@
43584632 {
43594633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43604634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4361
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43624636
43634637 Object3D elem = (Object3D)group.selection.elementAt(i);
43644638 if(elem != group || !newWindow)
....@@ -4443,7 +4717,8 @@
44434717 //new Exception().printStackTrace();
44444718
44454719 freezemodel = true;
4446
-
4720
+ ClearUnpinned();
4721
+
44474722 /**/
44484723 //switch (event.id)
44494724 {
....@@ -4476,7 +4751,7 @@
44764751 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44774752 // a camera
44784753 {
4479
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44804755 {
44814756 CameraPane.camerachangeframe = 0; // don't refuse it
44824757 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4485,6 +4760,13 @@
44854760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44864761 }
44874762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
44884770 refreshContents();
44894771 //return true;
44904772 }
....@@ -4494,9 +4776,18 @@
44944776 freezemodel = false;
44954777 }
44964778
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
44974787 void refreshContents(boolean cp)
44984788 {
4499
- if (!Globals.MOUSEDRAGGED)
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45004791 {
45014792 objEditor.ClearInfo(); // .GetMaterial());
45024793
....@@ -4595,7 +4886,8 @@
45954886
45964887 if (cut)
45974888 {
4598
- Save();
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
45994891 //int indices[] = jList.getSelectedIndices();
46004892 //for (int i = indices.length - 1; i >= 0; i--)
46014893 //jList.remove(indices[i]);
....@@ -4698,6 +4990,10 @@
46984990
46994991 void paste(boolean expand)
47004992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
47014997 // if (GrafreeD.clipboard == null)
47024998 // return;
47034999 boolean first = true;
....@@ -4757,6 +5053,7 @@
47575053 Grafreed.clipboard.get(0).parent = keepparent;
47585054 }
47595055
5056
+ Globals.REPLACEONMAKE = keep;
47605057 ResetModel();
47615058 refreshContents();
47625059 }
....@@ -4892,6 +5189,10 @@
48925189
48935190 void group(Object3D csg, boolean grab)
48945191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
48955196 if (//false) // why??
48965197 !group.selection.isEmpty())
48975198 {
....@@ -5005,10 +5306,15 @@
50055306 //node.add(csg);
50065307 //makeSomething(node);
50075308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
50085310 }
50095311
50105312 void Ungroup(Object3D g)
50115313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
50125318 if (g instanceof HiddenObject)
50135319 {
50145320 HiddenObject h = (HiddenObject) g;
....@@ -5025,6 +5331,7 @@
50255331 objEditor.makeSomething(g.get(i), false);
50265332 }
50275333 }
5334
+ Globals.REPLACEONMAKE = keep;
50285335 }
50295336
50305337 void ungroup()
....@@ -5313,13 +5620,28 @@
53135620 cButton clearpanelButton;
53145621 cButton unselectButton;
53155622
5316
- cButton minButton;
5317
- cButton maxButton;
5318
- cButton fullButton;
5319
- cButton undoButton;
5320
- cButton redoButton;
5623
+ cButton restoreCameraButton;
5624
+
53215625 cButton saveButton;
53225626 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;
53235645
53245646 cButton screenfitButton;
53255647 cButton screenfitpointButton;
....@@ -5341,11 +5663,11 @@
53415663 //JTree jTree;
53425664 private MenuItem lookAtItem;
53435665 private MenuItem lookFromItem;
5344
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
53455667 private MenuItem cutItem;
53465668 private MenuItem undoItem;
53475669 private MenuItem redoItem;
5348
- private MenuItem duplicateItem;
5670
+ private JMenuItem duplicateItem;
53495671 private MenuItem cloneItem;
53505672 private MenuItem cloneSupportItem;
53515673 private MenuItem overwriteGeoItem;
....@@ -5433,7 +5755,7 @@
54335755 private MenuItem frontItem;
54345756 private MenuItem cameraItem;
54355757 private MenuItem compositeItem;
5436
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
54375759 private MenuItem physicsItem;
54385760 private MenuItem frameselectorItem;
54395761 private MenuItem scriptNodeItem;
....@@ -5507,5 +5829,5 @@
55075829
55085830 Menu cameraMenu;
55095831 MenuItem editCameraItem;
5510
- MenuItem revertCameraItem;
5832
+ MenuItem restoreCameraItem;
55115833 }