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);
....@@ -176,7 +195,6 @@
176195 copyItem.addActionListener(this);
177196 pasteItem = menu.add(new MenuItem("Paste"));
178197 pasteItem.addActionListener(this);
179
- menu.add("-");
180198
181199 menu.add("-");
182200 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -203,23 +221,23 @@
203221 //zBufferItem.addActionListener(this);
204222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205223 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
208226
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- 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);
213239
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223241 toggleHandleItem.addItemListener(this);
224242 toggleHandleItem.setState(CameraPane.HANDLES);
225243
....@@ -274,7 +292,7 @@
274292 {
275293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279297 oe.cameraMenu.add("-");
280298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +300,7 @@
282300 editLeafItem.addActionListener(this);
283301 lookAtItem.addActionListener(this);
284302 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
286304 }
287305
288306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +345,29 @@
327345 }
328346
329347 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
332350 backItem = menu.add(new MenuItem("Back"));
333351 backItem.addActionListener(this);
334352 frontItem = menu.add(new MenuItem("Front"));
335353 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
338359 hideItem = menu.add(new MenuItem("Hidden Group"));
339360 hideItem.addActionListener(this);
361
+ }
340362 ungroupItem = menu.add(new MenuItem("Ungroup"));
341363 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- 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
+ {
345371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346372 switchGeoItem.addActionListener(this);
347373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +375,6 @@
349375 morphItem = menu.add(new MenuItem("Morph Group"));
350376 morphItem.addActionListener(this);
351377
352
- if (Globals.ADVANCED)
353
- {
354378 menu.add("-");
355379 physicsItem = menu.add(new MenuItem("Physics"));
356380 physicsItem.addActionListener(this);
....@@ -358,30 +382,29 @@
358382 frameselectorItem.addActionListener(this);
359383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360384 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363385 }
364386
365387 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
368390 billboardItem = menu.add(new MenuItem("Billboard"));
369391 billboardItem.addActionListener(this);
370392 csgItem = menu.add(new MenuItem("CSG"));
371393 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373395 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375397 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
378403 if (Globals.ADVANCED)
379404 {
380405 menu.add("-");
381406 linkerItem = menu.add(new MenuItem("Linker"));
382407 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385408 templateItem = menu.add(new MenuItem("Template"));
386409 templateItem.addActionListener(this);
387410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -533,6 +556,7 @@
533556 buildToolsMenu(menu);
534557 }
535558
559
+
536560 void SetupUI2(ObjEditor oe)
537561 {
538562 // June 2019
....@@ -575,51 +599,79 @@
575599 oe.radioPanel.add(dummyButton);
576600 oe.buttonGroup.add(dummyButton);
577601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
578606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
579607
580608 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
581609 //minButton.setToolTipText("Minimize window");
582610 //minButton.addActionListener(this);
583611
584
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- maxButton.setToolTipText("Maximize window");
586
- 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
+ }
587618
588
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589620 fullButton.setToolTipText("Full-screen window");
590621 fullButton.addActionListener(this);
591622
592
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
593
- undoButton.setToolTipText("Undo changes");
594
- 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);
595630
596
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- redoButton.setToolTipText("Redo changes");
598
- redoButton.addActionListener(this);
599
-
600
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
- saveButton.setToolTipText("Save changes");
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
602633 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);
603639
604
- 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);
605659 liveCB.setToolTipText("Enable animation");
606660 liveCB.addItemListener(this);
607661
608
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609663 oneStepButton.setToolTipText("Animate one step forward");
610664 oneStepButton.addActionListener(this);
611665
612
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
613667 fastCB.setToolTipText("Fast mode");
614668 fastCB.addItemListener(this);
615669
616
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
617
- trackCB.setToolTipText("Enable tracking");
618
- trackCB.addItemListener(this);
619
-
620
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- screenfitButton.setToolTipText("Screen fit");
622
- screenfitButton.addActionListener(this);
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);
623675
624676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
625677 // screenfitpointButton.addActionListener(this);
....@@ -631,65 +683,145 @@
631683 snapobjectButton.setToolTipText("Snap Object");
632684 }
633685
634
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
- flashSelectionButton.setToolTipText("Show selection");
636
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
637687
638
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
639
-
640
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641689 twoButton.setToolTipText("Show center view only");
642690 twoButton.addActionListener(this);
643
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644694 fourButton.addActionListener(this);
645695 fourButton.setToolTipText("Show left panel only");
646
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647697 sixButton.setToolTipText("2-column layout left");
648698 sixButton.addActionListener(this);
649
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650700 threeButton.setToolTipText("2-column layout right");
651701 threeButton.addActionListener(this);
652
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653703 sevenButton.setToolTipText("3-column layout");
654704 sevenButton.addActionListener(this);
655705 //
656706
657
- 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);
658708 rootButton.setToolTipText("Edit selection in new tab");
659709 rootButton.addActionListener(this);
660710
661
- 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);
662712 closeButton.setToolTipText("Close tab");
663713 closeButton.addActionListener(this);
664714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
665715 //clearButton.addActionListener(this);
666
-
667
- cGridBag commandsPanel = new cGridBag();
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
+ }
668748
669
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
- editButton.setToolTipText("Edit selection");
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");
671798 editButton.addActionListener(this);
672799
673
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- uneditButton.setToolTipText("Unedit selection");
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
675802 uneditButton.addActionListener(this);
676803
677
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
678
- allParamsButton.setToolTipText("Edit all params");
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
679806 allParamsButton.addActionListener(this);
680807
681
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682809 clearPanelButton.setToolTipText("Clear edit panel");
683810 clearPanelButton.addActionListener(this);
684811
685
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686813 unselectButton.setToolTipText("Unselect");
687814 unselectButton.addActionListener(this);
688815
689
- commandsPanel.preferredHeight = 1;
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
690819
691
- oe.treePanel.add(commandsPanel);
692
- oe.treePanel.Return();
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
693825
694826 // oe.aConstraints.gridx += 1;
695827 // oe.aConstraints.weighty = 0;
....@@ -706,29 +838,17 @@
706838
707839 JScrollPane jSP;
708840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
709
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
710842 ResetModel();
711843
712844 oe.treePanel.add(jSPPanel);
713845 oe.treePanel.Return();
714846
715
- cGridBag copyOptionsPanel = new cGridBag();
716
-
717
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
718
- colorCB.setToolTipText("Copy color when dropped");
719
- colorCB.addItemListener(this);
720
-
721
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
722
- materialCB.setToolTipText("Copy material when dropped");
723
- materialCB.addItemListener(this);
724
-
725
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
726
- textureCB.setToolTipText("Copy texture when dropped");
727
- textureCB.addItemListener(this);
728
-
729
- copyOptionsPanel.preferredHeight = 1;
730847 oe.treePanel.add(copyOptionsPanel);
731848 oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
732852
733853 // mainPanel.setDividerLocation(0.5); //1.0);
734854 // mainPanel.setResizeWeight(0.5);
....@@ -757,23 +877,43 @@
757877
758878 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
759879 {
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
+
760894 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
761895 boxCB.setToolTipText("Display bounding boxes");
762896 boxCB.addItemListener(this);
763897
764898 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
765
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
766900 zoomBoxCB.addItemListener(this);
767901
768902 if (true) // Globals.ADVANCED)
769903 {
770
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
771
- supportCB.setToolTipText("Enable rigging");
772
- 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);
773911
774912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
775913 // localCB.addItemListener(this);
776914
915
+ panel.Return();
916
+
777917 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
778918 crowdCB.setToolTipText("Used for crowds");
779919 crowdCB.addItemListener(this);
....@@ -790,6 +930,8 @@
790930 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
791931 // speakerMocapCB.addItemListener(this);
792932
933
+ panel.Return();
934
+
793935 if (false)
794936 {
795937 // handled in scripts
....@@ -804,32 +946,72 @@
804946 //constraints.gridy += 1;
805947 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
806948 smoothfocusCB.addItemListener(this);
949
+ panel.Return();
807950 }
808951
809952 //constraints.gridx += 1;
810953 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
811954 // debugCB.addItemListener(this);
812955
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
813960 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
814962 oeilCB.addItemListener(this);
815963
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
+ {
816984 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
817985 lookAtCB.setToolTipText("Look-at target");
818986 lookAtCB.addItemListener(this);
987
+ }
819988
820989 }
821990
822991 cGridBag fill = new cGridBag();
823
-
824992 fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
825997
826998 panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
8271001
8281002 }
8291003
8301004 void EditObject(Object3D obj)
8311005 {
8321006 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
+
8331015 radioButton.SetObject(obj);
8341016 radioButton.layout = sevenButton;
8351017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -851,23 +1033,28 @@
8511033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8521034 }
8531035
854
- JCheckBox liveCB;
855
- JCheckBox supportCB;
856
- JCheckBox localCB;
857
- JCheckBox crowdCB;
858
- JCheckBox smoothCB;
859
- JCheckBox fastCB;
860
- JCheckBox slowCB;
861
- JCheckBox boxCB;
862
- JCheckBox zoomBoxCB;
863
- JCheckBox trackCB;
864
- JCheckBox smoothfocusCB;
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;
8651049 // JCheckBox speakerMocapCB;
866
- JCheckBox speakerCameraCB;
867
- JCheckBox speakerFocusCB;
868
- JCheckBox debugCB;
869
- JCheckBox oeilCB;
870
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
8711058
8721059 // static int COLOR = 1;
8731060 // static int MATERIAL = 2;
....@@ -875,9 +1062,9 @@
8751062
8761063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8771064
878
- JCheckBox colorCB;
879
- JCheckBox materialCB;
880
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
8811068
8821069 public void itemStateChanged(ItemEvent e)
8831070 {
....@@ -970,6 +1157,18 @@
9701157 {
9711158 cameraView.ToggleOeil();
9721159 }
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
+ }
9731172 else if(e.getSource() == lookAtCB)
9741173 {
9751174 cameraView.ToggleLookAt();
....@@ -986,7 +1185,8 @@
9861185
9871186 /**/
9881187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
989
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
9901190 if ((path == null) || (path.getPathCount() <= 1)) {
9911191 // We can't move the root node or an empty selection
9921192 return;
....@@ -1049,8 +1249,6 @@
10491249 }
10501250 }
10511251
1052
- String string = (String) object;
1053
-
10541252 System.out.println("Transfer = " + object + "; drop : " + target);
10551253 // if( object instanceof java.io.File[])
10561254 // {
....@@ -1058,6 +1256,8 @@
10581256 // objEditor.DropFile((java.io.File[]) object, true);
10591257 // return;
10601258 // }
1259
+
1260
+ String string = object.toString();
10611261
10621262 // File path for Mac and Windows
10631263 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1103,23 +1303,33 @@
11031303
11041304 assert target == objEditor.jTree;
11051305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
11061307 try {
1107
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11081309 } catch (Exception e) {
11091310 System.out.println("destinationPath : " + destinationPath);
11101311 return;
11111312 }
11121313
1113
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
11141315 {
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
+// {
11151325 loadClipboard(true);
11161326 objEditor.jTree.setSelectionPath(destinationPath);
11171327 pasteInto(false, false);
1118
- } else {
1119
- loadClipboard(false);
1120
- objEditor.jTree.setSelectionPath(destinationPath);
1121
- pasteInto(false, false); // true); // ???
1122
- }
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
11231333 }
11241334 public void dropActionChanged(DropTargetDragEvent dtde)
11251335 // Called if the user has modified the current drop gesture
....@@ -1224,22 +1434,30 @@
12241434 {
12251435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12261436 //heightFieldItem.addActionListener(this);
1227
- gridItem = menu.add(new MenuItem("Grid"));
1228
- gridItem.addActionListener(this);
1229
- rectoidItem = menu.add(new MenuItem("Box"));
1230
- rectoidItem.addActionListener(this);
1231
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1232
- ellipsoidItem.addActionListener(this);
1233
- coneItem = menu.add(new MenuItem("Cone"));
1234
- coneItem.addActionListener(this);
1235
- torusItem = menu.add(new MenuItem("Torus"));
1236
- torusItem.addActionListener(this);
1237
- superItem = menu.add(new MenuItem("Superellipsoid"));
1238
- superItem.addActionListener(this);
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
+ {
12391455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12401456 kleinItem.addActionListener(this);
1241
- particleItem = menu.add(new MenuItem("Particle system"));
1242
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
12431461 if (Globals.ADVANCED)
12441462 {
12451463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1265,15 +1483,15 @@
12651483 }
12661484 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12671485 bezierItem.addActionListener(this);
1268
- overlayItem = menu.add(new MenuItem("Overlay"));
1269
- overlayItem.addActionListener(this);
1270
- lightItem = menu.add(new MenuItem("Light"));
1271
- lightItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
12721490 menu.add("-");
12731491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12741492 //superLoopItem.addActionListener(this);
1275
- loopItem = menu.add(new MenuItem("Loop"));
1276
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
12771495 doubleItem = menu.add(new MenuItem("Fork"));
12781496 doubleItem.addActionListener(this);
12791497 if (Globals.ADVANCED)
....@@ -1289,6 +1507,9 @@
12891507 animationItem.addItemListener(this);
12901508 animationItem.setState(Globals.ANIMATION);
12911509
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
1512
+
12921513 menu.add("-");
12931514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12941515 parseverticesItem.addActionListener(this);
....@@ -1301,6 +1522,8 @@
13011522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13021523 reduce34MorphItem.addActionListener(this);
13031524 menu.add("-");
1525
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1526
+ memoryItem.addActionListener(this);
13041527 menu.add(computeAOItem = new MenuItem("Compute AO"));
13051528 computeAOItem.addActionListener(this);
13061529
....@@ -1309,8 +1532,6 @@
13091532 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13101533 mirrorItem.addActionListener(this);
13111534 menu.add("-");
1312
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1313
- memoryItem.addActionListener(this);
13141535 menu.add(analyzeItem = new MenuItem("Analyze"));
13151536 analyzeItem.addActionListener(this);
13161537 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1454,9 +1675,24 @@
14541675 shadow.material = new cMaterial(obj.material);
14551676 shadow.material.diffuse = 0.0001f;
14561677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
14571679
14581680 makeSomething(shadow);
14591681 }
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
+ }
14601696
14611697 /**
14621698 * applyExample
....@@ -1701,7 +1937,7 @@
17011937 {
17021938 ScreenFit();
17031939 } else
1704
- if (source == switchItem)
1940
+ if (source == switchViewItem)
17051941 {
17061942 cVector v1 = new cVector();
17071943 cVector v2 = new cVector();
....@@ -1710,11 +1946,11 @@
17101946 objEditor.cameraView.renderCamera.setAim(v2, v1);
17111947 objEditor.cameraView.repaint();
17121948 } else
1713
- if (source == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
17141950 {
17151951 makeSomething(new Box());
17161952 } else
1717
- if (source == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
17181954 {
17191955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17201956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1793,27 +2029,27 @@
17932029
17942030 makeSomething(obj);
17952031 } else
1796
- if (source == gridItem)
2032
+ if (source == gridItem || source == gridButton)
17972033 {
17982034 makeSomething(new Grid());
17992035 } else
1800
- if (source == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
18012037 {
18022038 makeSomething(new Sphere());
18032039 } else
1804
- if (source == coneItem)
2040
+ if (source == coneItem || source == coneButton)
18052041 {
18062042 makeSomething(new Cone());
18072043 } else
1808
- if (source == torusItem)
2044
+ if (source == torusItem || source == torusButton)
18092045 {
18102046 makeSomething(new Torus());
18112047 } else
1812
- if (source == superItem)
2048
+ if (source == superItem || source == superButton)
18132049 {
18142050 makeSomething(new Superellipsoid());
18152051 } else
1816
- if (source == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
18172053 {
18182054 makeSomething(new Klein());
18192055 } else
....@@ -1833,7 +2069,7 @@
18332069 {
18342070 makeSomething(new BezierSurface());
18352071 } else
1836
- if (source == overlayItem)
2072
+ if (source == overlayItem || source == overlayButton)
18372073 {
18382074 /*
18392075 Object3D obj = new BezierSurface(5,8);
....@@ -1881,7 +2117,7 @@
18812117 s.setup();
18822118 makeSomething(s);
18832119 } else
1884
- if (source == lightItem)
2120
+ if (source == lightItem || source == lightButton)
18852121 {
18862122 makeSomething(new Light());
18872123 } else
....@@ -1931,30 +2167,30 @@
19312167
19322168 group(g);
19332169 } else
1934
- if (source == loopItem)
2170
+ if (source == loopItem || source == loopButton)
19352171 {
19362172 Composite csg = new GroupLeaf();
19372173 csg.count = 5;
19382174 group(csg);
1939
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
19402176 csg.addChild(child);
19412177 child.addChild(csg);
19422178 } else
19432179 if (source == doubleItem)
19442180 {
1945
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
19462182 csg.count = 5;
19472183 group(csg);
1948
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
19492185 csg.addChild(child);
19502186 child.addChild(csg);
1951
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
19522188 csg.addChild(child);
19532189 child.addChild(csg);
19542190 } else
19552191 if (source == tripleItem)
19562192 {
1957
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
19582194 csg.count = 4;
19592195 group(csg);
19602196 Composite child = new cGroup();
....@@ -2018,15 +2254,31 @@
20182254 } else
20192255 if (source == undoButton)
20202256 {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20212260 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();
20222271 } else
20232272 if (source == redoButton)
20242273 {
2274
+ // Go to next version
20252275 Redo();
20262276 } else
20272277 if (source == saveButton)
20282278 {
2029
- Save();
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
20302282 } else
20312283 if (source == oneStepButton)
20322284 {
....@@ -2035,17 +2287,14 @@
20352287 } else
20362288 if (source == screenfitButton)
20372289 {
2038
- //Reload(lastConverter, lastFilename, true);
20392290 ScreenFit();
20402291 } else
20412292 if (source == screenfitpointButton)
20422293 {
2043
- //Reload(lastConverter, lastFilename, true);
20442294 ScreenFitPoint();
20452295 } else
20462296 if (source == snapobjectButton)
20472297 {
2048
- //Reload(lastConverter, lastFilename, true);
20492298 SnapObject();
20502299 } else
20512300 // if (event.getSource() == recompileButton)
....@@ -2421,9 +2670,9 @@
24212670 {
24222671 ClearSelection(true);
24232672 } else
2424
- if (source == grabItem)
2673
+ if (source == grabItem || source == groupButton)
24252674 {
2426
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
24272676 } else
24282677 if (source == hideItem)
24292678 {
....@@ -2441,11 +2690,11 @@
24412690 {
24422691 makeSomething(new Camera());
24432692 } else
2444
- if (source == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
24452694 {
24462695 group(new Composite());
24472696 } else
2448
- if (source == randomItem)
2697
+ if (source == switchItem || source == switchButton)
24492698 {
24502699 RandomNode random = new RandomNode();
24512700 group(random);
....@@ -2547,7 +2796,7 @@
25472796 {
25482797 group(new cLinker());
25492798 } else
2550
- if (source == textureItem)
2799
+ if (source == textureItem || source == textureButton)
25512800 {
25522801 group(new TextureNode());
25532802 } else
....@@ -2567,17 +2816,30 @@
25672816 {
25682817 CastShadow(2);
25692818 } else
2570
- if (source == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
25712820 {
2572
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
25732823 for (int i=0; i<group.selection.size(); i++)
25742824 {
2575
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
25762830 }
25772831
2578
- ClearSelection(false);
2579
-
2580
- 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
+ }
25812843 } else
25822844 if (source == genUVItem)
25832845 {
....@@ -2905,6 +3167,10 @@
29053167 if (source == twoButton)
29063168 {
29073169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
29083174 // bug
29093175 //gridPanel.setDividerLocation(1.0);
29103176 //bigPanel.setDividerLocation(0.0);
....@@ -2960,6 +3226,9 @@
29603226 {
29613227 radio.layout = threeButton;
29623228
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
3231
+
29633232 // bigThree.remove(scenePanel);
29643233 // bigThree.remove(centralPanel);
29653234 // bigThree.remove(XYZPanel);
....@@ -2998,6 +3267,9 @@
29983267 {
29993268 radio.layout = fourButton;
30003269
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
3272
+
30013273 // bigThree.remove(scenePanel);
30023274 // bigThree.remove(centralPanel);
30033275 // bigThree.remove(XYZPanel);
....@@ -3034,6 +3306,9 @@
30343306 if (source == sixButton)
30353307 {
30363308 radio.layout = sixButton;
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
30373312
30383313 // bigThree.remove(scenePanel);
30393314 // bigThree.remove(centralPanel);
....@@ -3072,6 +3347,9 @@
30723347 if (source == sevenButton)
30733348 {
30743349 radio.layout = sevenButton;
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
30753353
30763354 // bigThree.remove(scenePanel);
30773355 // bigThree.remove(centralPanel);
....@@ -3128,12 +3406,19 @@
31283406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31293407 {
31303408 ab = (cRadio)e.nextElement();
3131
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31323410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
31333417 buttonGroup.remove(ab);
31343418 radioPanel.remove(ab);
31353419
3136
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
31373422 // ab.GetObject().objectUI = null; // ?????????
31383423
31393424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3146,6 +3431,12 @@
31463431 } else
31473432 if (source == editItem || source == editButton)
31483433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
31493440 EditSelection(false);
31503441 } else
31513442 if (source == uneditButton)
....@@ -3155,6 +3446,7 @@
31553446 Object3D child = (Object3D)e.nextElement();
31563447 if(child.editWindow != null)
31573448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
31583450 child.CloseUI();
31593451 listUI.remove(child);
31603452
....@@ -3171,6 +3463,7 @@
31713463 //copy.ClearUI();
31723464 for (Object3D obj : listUI)
31733465 {
3466
+ obj.pinned = false;
31743467 obj.CloseUI();
31753468 }
31763469 listUI.clear();
....@@ -3180,7 +3473,7 @@
31803473 {
31813474 assert(copy == group);
31823475
3183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31843477
31853478 for (Object3D obj : listUI)
31863479 {
....@@ -3229,6 +3522,9 @@
32293522 }
32303523
32313524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
32323528 //Globals.theRenderer.object = group;
32333529 if(!useclient)
32343530 {
....@@ -3247,6 +3543,7 @@
32473543
32483544 // fix "+" issue
32493545 //group.editWindow = this;
3546
+ group.manipWindow = this;
32503547
32513548 /*
32523549 currentLayout = radio.layout;
....@@ -3254,6 +3551,13 @@
32543551 currentLayout = sevenButton;
32553552 */
32563553 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);
32573561 keepparent = group.parent;
32583562 // PARENT = NULL or not???
32593563 //group.parent = null; // ROOT
....@@ -3267,7 +3571,7 @@
32673571 cameraView.ProtectCamera();
32683572 cameraView.repaint();
32693573 return;
3270
- } else if (event.getSource() == revertCameraItem)
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32713575 {
32723576 cameraView.RevertCamera();
32733577 cameraView.repaint();
....@@ -4321,10 +4625,6 @@
43214625 // }
43224626 // }
43234627
4324
- static boolean allparams = true;
4325
-
4326
- static Vector<Object3D> listUI = new Vector<Object3D>();
4327
-
43284628 void EditSelection(boolean newWindow)
43294629 {
43304630 // aConstraints.gridy = 0;
....@@ -4332,7 +4632,7 @@
43324632 {
43334633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43344634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4335
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43364636
43374637 Object3D elem = (Object3D)group.selection.elementAt(i);
43384638 if(elem != group || !newWindow)
....@@ -4417,7 +4717,8 @@
44174717 //new Exception().printStackTrace();
44184718
44194719 freezemodel = true;
4420
-
4720
+ ClearUnpinned();
4721
+
44214722 /**/
44224723 //switch (event.id)
44234724 {
....@@ -4450,7 +4751,7 @@
44504751 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44514752 // a camera
44524753 {
4453
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44544755 {
44554756 CameraPane.camerachangeframe = 0; // don't refuse it
44564757 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4459,6 +4760,13 @@
44594760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44604761 }
44614762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
44624770 refreshContents();
44634771 //return true;
44644772 }
....@@ -4468,9 +4776,18 @@
44684776 freezemodel = false;
44694777 }
44704778
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
44714787 void refreshContents(boolean cp)
44724788 {
4473
- if (!Globals.MOUSEDRAGGED)
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44744791 {
44754792 objEditor.ClearInfo(); // .GetMaterial());
44764793
....@@ -4569,7 +4886,8 @@
45694886
45704887 if (cut)
45714888 {
4572
- Save();
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
45734891 //int indices[] = jList.getSelectedIndices();
45744892 //for (int i = indices.length - 1; i >= 0; i--)
45754893 //jList.remove(indices[i]);
....@@ -4672,6 +4990,10 @@
46724990
46734991 void paste(boolean expand)
46744992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
46754997 // if (GrafreeD.clipboard == null)
46764998 // return;
46774999 boolean first = true;
....@@ -4731,6 +5053,7 @@
47315053 Grafreed.clipboard.get(0).parent = keepparent;
47325054 }
47335055
5056
+ Globals.REPLACEONMAKE = keep;
47345057 ResetModel();
47355058 refreshContents();
47365059 }
....@@ -4866,6 +5189,10 @@
48665189
48675190 void group(Object3D csg, boolean grab)
48685191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
48695196 if (//false) // why??
48705197 !group.selection.isEmpty())
48715198 {
....@@ -4979,10 +5306,15 @@
49795306 //node.add(csg);
49805307 //makeSomething(node);
49815308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
49825310 }
49835311
49845312 void Ungroup(Object3D g)
49855313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
49865318 if (g instanceof HiddenObject)
49875319 {
49885320 HiddenObject h = (HiddenObject) g;
....@@ -4999,6 +5331,7 @@
49995331 objEditor.makeSomething(g.get(i), false);
50005332 }
50015333 }
5334
+ Globals.REPLACEONMAKE = keep;
50025335 }
50035336
50045337 void ungroup()
....@@ -5287,13 +5620,28 @@
52875620 cButton clearpanelButton;
52885621 cButton unselectButton;
52895622
5290
- cButton minButton;
5291
- cButton maxButton;
5292
- cButton fullButton;
5293
- cButton undoButton;
5294
- cButton redoButton;
5623
+ cButton restoreCameraButton;
5624
+
52955625 cButton saveButton;
52965626 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;
52975645
52985646 cButton screenfitButton;
52995647 cButton screenfitpointButton;
....@@ -5315,11 +5663,11 @@
53155663 //JTree jTree;
53165664 private MenuItem lookAtItem;
53175665 private MenuItem lookFromItem;
5318
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
53195667 private MenuItem cutItem;
53205668 private MenuItem undoItem;
53215669 private MenuItem redoItem;
5322
- private MenuItem duplicateItem;
5670
+ private JMenuItem duplicateItem;
53235671 private MenuItem cloneItem;
53245672 private MenuItem cloneSupportItem;
53255673 private MenuItem overwriteGeoItem;
....@@ -5407,7 +5755,7 @@
54075755 private MenuItem frontItem;
54085756 private MenuItem cameraItem;
54095757 private MenuItem compositeItem;
5410
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
54115759 private MenuItem physicsItem;
54125760 private MenuItem frameselectorItem;
54135761 private MenuItem scriptNodeItem;
....@@ -5481,5 +5829,5 @@
54815829
54825830 Menu cameraMenu;
54835831 MenuItem editCameraItem;
5484
- MenuItem revertCameraItem;
5832
+ MenuItem restoreCameraItem;
54855833 }