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,11 +167,19 @@
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"));
156175 //editItem.addActionListener(this);
157
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
158183 duplicateItem.addActionListener(this);
159184 cloneItem = menu.add(new MenuItem("Clone"));
160185 cloneItem.addActionListener(this);
....@@ -170,7 +195,6 @@
170195 copyItem.addActionListener(this);
171196 pasteItem = menu.add(new MenuItem("Paste"));
172197 pasteItem.addActionListener(this);
173
- menu.add("-");
174198
175199 menu.add("-");
176200 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,23 +221,23 @@
197221 //zBufferItem.addActionListener(this);
198222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199223 //normalLensItem.addActionListener(this);
200
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
201
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
202226
203
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
204
- toggleFullScreenItem.addItemListener(this);
205
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
206
- 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);
207239
208
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
209
- toggleTextureItem.addItemListener(this);
210
- toggleTextureItem.setState(CameraPane.textureon);
211
-
212
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
213
- toggleSwitchItem.addItemListener(this);
214
- toggleSwitchItem.setState(CameraPane.SWITCH);
215
-
216
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
217241 toggleHandleItem.addItemListener(this);
218242 toggleHandleItem.setState(CameraPane.HANDLES);
219243
....@@ -240,7 +264,7 @@
240264
241265 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242266 toggleDebugItem.addItemListener(this);
243
- toggleDebugItem.setState(CameraPane.DEBUG);
267
+ toggleDebugItem.setState(Globals.DEBUG);
244268
245269 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246270 toggleFrustumItem.addItemListener(this);
....@@ -261,14 +285,14 @@
261285 // animationItem.addItemListener(this);
262286 // animationItem.setState(CameraPane.ANIMATION);
263287 cameraMenu.add("-");
264
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
265289 editCameraItem.addActionListener(this);
266290
267291 if (Globals.ADVANCED)
268292 {
269293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
270294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
271
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
272296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
273297 oe.cameraMenu.add("-");
274298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -276,7 +300,7 @@
276300 editLeafItem.addActionListener(this);
277301 lookAtItem.addActionListener(this);
278302 //lookFromItem.addActinoListener(this);
279
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
280304 }
281305
282306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -321,21 +345,29 @@
321345 }
322346
323347 oe.menuBar.add(menu = new Menu("Group"));
324
- grabItem = menu.add(new MenuItem("Grab"));
325
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
326350 backItem = menu.add(new MenuItem("Back"));
327351 backItem.addActionListener(this);
328352 frontItem = menu.add(new MenuItem("Front"));
329353 frontItem.addActionListener(this);
330
- compositeItem = menu.add(new MenuItem("Composite"));
331
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
332359 hideItem = menu.add(new MenuItem("Hidden Group"));
333360 hideItem.addActionListener(this);
361
+ }
334362 ungroupItem = menu.add(new MenuItem("Ungroup"));
335363 ungroupItem.addActionListener(this);
336
- menu.add("-");
337
- randomItem = menu.add(new MenuItem("Switch node"));
338
- 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
+ {
339371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
340372 switchGeoItem.addActionListener(this);
341373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -343,8 +375,6 @@
343375 morphItem = menu.add(new MenuItem("Morph Group"));
344376 morphItem.addActionListener(this);
345377
346
- if (Globals.ADVANCED)
347
- {
348378 menu.add("-");
349379 physicsItem = menu.add(new MenuItem("Physics"));
350380 physicsItem.addActionListener(this);
....@@ -352,30 +382,29 @@
352382 frameselectorItem.addActionListener(this);
353383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
354384 scriptNodeItem.addActionListener(this);
355
- cameraItem = menu.add(new MenuItem("Camera"));
356
- cameraItem.addActionListener(this);
357385 }
358386
359387 oe.menuBar.add(menu = new Menu("Object"));
360
- textureItem = menu.add(new MenuItem("Texture"));
361
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
362390 billboardItem = menu.add(new MenuItem("Billboard"));
363391 billboardItem.addActionListener(this);
364392 csgItem = menu.add(new MenuItem("CSG"));
365393 csgItem.addActionListener(this);
366
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
367395 shadowXItem.addActionListener(this);
368
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
369397 shadowYItem.addActionListener(this);
370
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
371399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
372403 if (Globals.ADVANCED)
373404 {
374405 menu.add("-");
375406 linkerItem = menu.add(new MenuItem("Linker"));
376407 linkerItem.addActionListener(this);
377
- attributeItem = menu.add(new MenuItem("Attribute"));
378
- attributeItem.addActionListener(this);
379408 templateItem = menu.add(new MenuItem("Template"));
380409 templateItem.addActionListener(this);
381410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -464,6 +493,14 @@
464493 markleavesItem.addActionListener(this);
465494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
466495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
467504 menu.add("-");
468505 flipVItem = menu.add(new MenuItem("Flip V"));
469506 flipVItem.addActionListener(this);
....@@ -519,8 +556,21 @@
519556 buildToolsMenu(menu);
520557 }
521558
559
+
522560 void SetupUI2(ObjEditor oe)
523561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
524574 //new Exception().printStackTrace();
525575
526576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -549,27 +599,79 @@
549599 oe.radioPanel.add(dummyButton);
550600 oe.buttonGroup.add(dummyButton);
551601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
552606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
553607
554
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
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
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
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);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ 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);
639
+
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);
555659 liveCB.setToolTipText("Enable animation");
556660 liveCB.addItemListener(this);
557661
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
559663 oneStepButton.setToolTipText("Animate one step forward");
560664 oneStepButton.addActionListener(this);
561665
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
563667 fastCB.setToolTipText("Fast mode");
564668 fastCB.addItemListener(this);
565669
566
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
567
- trackCB.setToolTipText("Enable tracking");
568
- trackCB.addItemListener(this);
569
-
570
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
571
- screenfitButton.setToolTipText("Screen fit");
572
- 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);
573675
574676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
575677 // screenfitpointButton.addActionListener(this);
....@@ -581,65 +683,145 @@
581683 snapobjectButton.setToolTipText("Snap Object");
582684 }
583685
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
586
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
587687
588
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
589
-
590
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591689 twoButton.setToolTipText("Show center view only");
592690 twoButton.addActionListener(this);
593
- 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);
594694 fourButton.addActionListener(this);
595695 fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597697 sixButton.setToolTipText("2-column layout left");
598698 sixButton.addActionListener(this);
599
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600700 threeButton.setToolTipText("2-column layout right");
601701 threeButton.addActionListener(this);
602
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603703 sevenButton.setToolTipText("3-column layout");
604704 sevenButton.addActionListener(this);
605705 //
606706
607
- 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);
608708 rootButton.setToolTipText("Edit selection in new tab");
609709 rootButton.addActionListener(this);
610710
611
- 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);
612712 closeButton.setToolTipText("Close tab");
613713 closeButton.addActionListener(this);
614714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
615715 //clearButton.addActionListener(this);
616
-
617
- 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
+ }
618748
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- 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");
621798 editButton.addActionListener(this);
622799
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- uneditButton.setToolTipText("Unedit selection");
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
625802 uneditButton.addActionListener(this);
626803
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628
- allParamsButton.setToolTipText("Edit all params");
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
629806 allParamsButton.addActionListener(this);
630807
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632809 clearPanelButton.setToolTipText("Clear edit panel");
633810 clearPanelButton.addActionListener(this);
634811
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636813 unselectButton.setToolTipText("Unselect");
637814 unselectButton.addActionListener(this);
638815
639
- 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);
640819
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
643825
644826 // oe.aConstraints.gridx += 1;
645827 // oe.aConstraints.weighty = 0;
....@@ -656,29 +838,17 @@
656838
657839 JScrollPane jSP;
658840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
660842 ResetModel();
661843
662844 oe.treePanel.add(jSPPanel);
663845 oe.treePanel.Return();
664846
665
- cGridBag copyOptionsPanel = new cGridBag();
666
-
667
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
668
- colorCB.setToolTipText("Copy color when dropped");
669
- colorCB.addItemListener(this);
670
-
671
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
672
- materialCB.setToolTipText("Copy material when dropped");
673
- materialCB.addItemListener(this);
674
-
675
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
676
- textureCB.setToolTipText("Copy texture when dropped");
677
- textureCB.addItemListener(this);
678
-
679
- copyOptionsPanel.preferredHeight = 1;
680847 oe.treePanel.add(copyOptionsPanel);
681848 oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
682852
683853 // mainPanel.setDividerLocation(0.5); //1.0);
684854 // mainPanel.setResizeWeight(0.5);
....@@ -707,23 +877,43 @@
707877
708878 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
709879 {
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
+
710894 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
711895 boxCB.setToolTipText("Display bounding boxes");
712896 boxCB.addItemListener(this);
713897
714898 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
715
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
716900 zoomBoxCB.addItemListener(this);
717901
718902 if (true) // Globals.ADVANCED)
719903 {
720
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
721
- supportCB.setToolTipText("Enable rigging");
722
- 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);
723911
724912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
725913 // localCB.addItemListener(this);
726914
915
+ panel.Return();
916
+
727917 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
728918 crowdCB.setToolTipText("Used for crowds");
729919 crowdCB.addItemListener(this);
....@@ -740,6 +930,8 @@
740930 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
741931 // speakerMocapCB.addItemListener(this);
742932
933
+ panel.Return();
934
+
743935 if (false)
744936 {
745937 // handled in scripts
....@@ -754,32 +946,72 @@
754946 //constraints.gridy += 1;
755947 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
756948 smoothfocusCB.addItemListener(this);
949
+ panel.Return();
757950 }
758951
759952 //constraints.gridx += 1;
760953 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
761954 // debugCB.addItemListener(this);
762955
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
763960 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
764962 oeilCB.addItemListener(this);
765963
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
+ {
766984 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
767985 lookAtCB.setToolTipText("Look-at target");
768986 lookAtCB.addItemListener(this);
987
+ }
769988
770989 }
771990
772991 cGridBag fill = new cGridBag();
773
-
774992 fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
775997
776998 panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
7771001
7781002 }
7791003
7801004 void EditObject(Object3D obj)
7811005 {
7821006 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
+
7831015 radioButton.SetObject(obj);
7841016 radioButton.layout = sevenButton;
7851017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -791,6 +1023,8 @@
7911023
7921024 void SetupViews(ObjEditor oe)
7931025 {
1026
+ theFrame = this;
1027
+
7941028 oe.SetupViews();
7951029
7961030 System.out.println("SetupViews");
....@@ -799,23 +1033,28 @@
7991033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8001034 }
8011035
802
- JCheckBox liveCB;
803
- JCheckBox supportCB;
804
- JCheckBox localCB;
805
- JCheckBox crowdCB;
806
- JCheckBox smoothCB;
807
- JCheckBox fastCB;
808
- JCheckBox slowCB;
809
- JCheckBox boxCB;
810
- JCheckBox zoomBoxCB;
811
- JCheckBox trackCB;
812
- 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;
8131049 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
8191058
8201059 // static int COLOR = 1;
8211060 // static int MATERIAL = 2;
....@@ -823,9 +1062,9 @@
8231062
8241063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251064
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
8291068
8301069 public void itemStateChanged(ItemEvent e)
8311070 {
....@@ -853,6 +1092,7 @@
8531092 } else if(e.getSource() == liveCB)
8541093 {
8551094 cameraView.ToggleLive();
1095
+ refreshContents(false);
8561096 }
8571097 else if(e.getSource() == supportCB)
8581098 {
....@@ -917,6 +1157,18 @@
9171157 {
9181158 cameraView.ToggleOeil();
9191159 }
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
+ }
9201172 else if(e.getSource() == lookAtCB)
9211173 {
9221174 cameraView.ToggleLookAt();
....@@ -933,7 +1185,8 @@
9331185
9341186 /**/
9351187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
9371190 if ((path == null) || (path.getPathCount() <= 1)) {
9381191 // We can't move the root node or an empty selection
9391192 return;
....@@ -996,8 +1249,6 @@
9961249 }
9971250 }
9981251
999
- String string = (String) object;
1000
-
10011252 System.out.println("Transfer = " + object + "; drop : " + target);
10021253 // if( object instanceof java.io.File[])
10031254 // {
....@@ -1005,6 +1256,8 @@
10051256 // objEditor.DropFile((java.io.File[]) object, true);
10061257 // return;
10071258 // }
1259
+
1260
+ String string = object.toString();
10081261
10091262 // File path for Mac and Windows
10101263 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1050,23 +1303,33 @@
10501303
10511304 assert target == objEditor.jTree;
10521305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
10531307 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551309 } catch (Exception e) {
10561310 System.out.println("destinationPath : " + destinationPath);
10571311 return;
10581312 }
10591313
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
10611315 {
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
+// {
10621325 loadClipboard(true);
10631326 objEditor.jTree.setSelectionPath(destinationPath);
10641327 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
10701333 }
10711334 public void dropActionChanged(DropTargetDragEvent dtde)
10721335 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1434,30 @@
11711434 {
11721435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731436 //heightFieldItem.addActionListener(this);
1174
- gridItem = menu.add(new MenuItem("Grid"));
1175
- gridItem.addActionListener(this);
1176
- rectoidItem = menu.add(new MenuItem("Box"));
1177
- rectoidItem.addActionListener(this);
1178
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1179
- ellipsoidItem.addActionListener(this);
1180
- coneItem = menu.add(new MenuItem("Cone"));
1181
- coneItem.addActionListener(this);
1182
- torusItem = menu.add(new MenuItem("Torus"));
1183
- torusItem.addActionListener(this);
1184
- superItem = menu.add(new MenuItem("Superellipsoid"));
1185
- 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
+ {
11861455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871456 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
11901461 if (Globals.ADVANCED)
11911462 {
11921463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1483,15 @@
12121483 }
12131484 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141485 bezierItem.addActionListener(this);
1215
- overlayItem = menu.add(new MenuItem("Overlay"));
1216
- overlayItem.addActionListener(this);
1217
- lightItem = menu.add(new MenuItem("Light"));
1218
- 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);
12191490 menu.add("-");
12201491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211492 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
12241495 doubleItem = menu.add(new MenuItem("Fork"));
12251496 doubleItem.addActionListener(this);
12261497 if (Globals.ADVANCED)
....@@ -1236,6 +1507,9 @@
12361507 animationItem.addItemListener(this);
12371508 animationItem.setState(Globals.ANIMATION);
12381509
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
1512
+
12391513 menu.add("-");
12401514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12411515 parseverticesItem.addActionListener(this);
....@@ -1248,6 +1522,8 @@
12481522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12491523 reduce34MorphItem.addActionListener(this);
12501524 menu.add("-");
1525
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1526
+ memoryItem.addActionListener(this);
12511527 menu.add(computeAOItem = new MenuItem("Compute AO"));
12521528 computeAOItem.addActionListener(this);
12531529
....@@ -1256,11 +1532,9 @@
12561532 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12571533 mirrorItem.addActionListener(this);
12581534 menu.add("-");
1259
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1260
- memoryItem.addActionListener(this);
12611535 menu.add(analyzeItem = new MenuItem("Analyze"));
12621536 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
12641538 dumpItem.addActionListener(this);
12651539 // menu.add(pathItem = new MenuItem("From-to path"));
12661540 // pathItem.addActionListener(this);
....@@ -1401,9 +1675,24 @@
14011675 shadow.material = new cMaterial(obj.material);
14021676 shadow.material.diffuse = 0.0001f;
14031677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
14041679
14051680 makeSomething(shadow);
14061681 }
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
+ }
14071696
14081697 /**
14091698 * applyExample
....@@ -1648,7 +1937,7 @@
16481937 {
16491938 ScreenFit();
16501939 } else
1651
- if (source == switchItem)
1940
+ if (source == switchViewItem)
16521941 {
16531942 cVector v1 = new cVector();
16541943 cVector v2 = new cVector();
....@@ -1657,11 +1946,11 @@
16571946 objEditor.cameraView.renderCamera.setAim(v2, v1);
16581947 objEditor.cameraView.repaint();
16591948 } else
1660
- if (source == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
16611950 {
16621951 makeSomething(new Box());
16631952 } else
1664
- if (source == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
16651954 {
16661955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16671956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +2029,27 @@
17402029
17412030 makeSomething(obj);
17422031 } else
1743
- if (source == gridItem)
2032
+ if (source == gridItem || source == gridButton)
17442033 {
17452034 makeSomething(new Grid());
17462035 } else
1747
- if (source == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
17482037 {
17492038 makeSomething(new Sphere());
17502039 } else
1751
- if (source == coneItem)
2040
+ if (source == coneItem || source == coneButton)
17522041 {
17532042 makeSomething(new Cone());
17542043 } else
1755
- if (source == torusItem)
2044
+ if (source == torusItem || source == torusButton)
17562045 {
17572046 makeSomething(new Torus());
17582047 } else
1759
- if (source == superItem)
2048
+ if (source == superItem || source == superButton)
17602049 {
17612050 makeSomething(new Superellipsoid());
17622051 } else
1763
- if (source == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
17642053 {
17652054 makeSomething(new Klein());
17662055 } else
....@@ -1780,7 +2069,7 @@
17802069 {
17812070 makeSomething(new BezierSurface());
17822071 } else
1783
- if (source == overlayItem)
2072
+ if (source == overlayItem || source == overlayButton)
17842073 {
17852074 /*
17862075 Object3D obj = new BezierSurface(5,8);
....@@ -1828,7 +2117,7 @@
18282117 s.setup();
18292118 makeSomething(s);
18302119 } else
1831
- if (source == lightItem)
2120
+ if (source == lightItem || source == lightButton)
18322121 {
18332122 makeSomething(new Light());
18342123 } else
....@@ -1878,30 +2167,30 @@
18782167
18792168 group(g);
18802169 } else
1881
- if (source == loopItem)
2170
+ if (source == loopItem || source == loopButton)
18822171 {
18832172 Composite csg = new GroupLeaf();
18842173 csg.count = 5;
18852174 group(csg);
1886
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
18872176 csg.addChild(child);
18882177 child.addChild(csg);
18892178 } else
18902179 if (source == doubleItem)
18912180 {
1892
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
18932182 csg.count = 5;
18942183 group(csg);
1895
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
18962185 csg.addChild(child);
18972186 child.addChild(csg);
1898
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
18992188 csg.addChild(child);
19002189 child.addChild(csg);
19012190 } else
19022191 if (source == tripleItem)
19032192 {
1904
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
19052194 csg.count = 4;
19062195 group(csg);
19072196 Composite child = new cGroup();
....@@ -1951,6 +2240,46 @@
19512240 {
19522241 DumpObject();
19532242 } else
2243
+ if (source == minButton)
2244
+ {
2245
+ Minimize();
2246
+ } else
2247
+ if (source == maxButton)
2248
+ {
2249
+ Maximize();
2250
+ } else
2251
+ if (source == fullButton)
2252
+ {
2253
+ ToggleFullScreen();
2254
+ } else
2255
+ if (source == undoButton)
2256
+ {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2260
+ 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();
2271
+ } else
2272
+ if (source == redoButton)
2273
+ {
2274
+ // Go to next version
2275
+ Redo();
2276
+ } else
2277
+ if (source == saveButton)
2278
+ {
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
2282
+ } else
19542283 if (source == oneStepButton)
19552284 {
19562285 Globals.ONESTEP = true;
....@@ -1958,17 +2287,14 @@
19582287 } else
19592288 if (source == screenfitButton)
19602289 {
1961
- //Reload(lastConverter, lastFilename, true);
19622290 ScreenFit();
19632291 } else
19642292 if (source == screenfitpointButton)
19652293 {
1966
- //Reload(lastConverter, lastFilename, true);
19672294 ScreenFitPoint();
19682295 } else
19692296 if (source == snapobjectButton)
19702297 {
1971
- //Reload(lastConverter, lastFilename, true);
19722298 SnapObject();
19732299 } else
19742300 // if (event.getSource() == recompileButton)
....@@ -2004,6 +2330,14 @@
20042330 if (source == cutItem || source == clearButton)
20052331 {
20062332 loadClipboard(true);
2333
+ } else
2334
+ if (source == undoItem)
2335
+ {
2336
+ Undo();
2337
+ } else
2338
+ if (source == redoItem)
2339
+ {
2340
+ Redo();
20072341 } else
20082342 if (source == duplicateItem)
20092343 {
....@@ -2336,9 +2670,9 @@
23362670 {
23372671 ClearSelection(true);
23382672 } else
2339
- if (source == grabItem)
2673
+ if (source == grabItem || source == groupButton)
23402674 {
2341
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
23422676 } else
23432677 if (source == hideItem)
23442678 {
....@@ -2356,11 +2690,11 @@
23562690 {
23572691 makeSomething(new Camera());
23582692 } else
2359
- if (source == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
23602694 {
23612695 group(new Composite());
23622696 } else
2363
- if (source == randomItem)
2697
+ if (source == switchItem || source == switchButton)
23642698 {
23652699 RandomNode random = new RandomNode();
23662700 group(random);
....@@ -2462,7 +2796,7 @@
24622796 {
24632797 group(new cLinker());
24642798 } else
2465
- if (source == textureItem)
2799
+ if (source == textureItem || source == textureButton)
24662800 {
24672801 group(new TextureNode());
24682802 } else
....@@ -2482,17 +2816,30 @@
24822816 {
24832817 CastShadow(2);
24842818 } else
2485
- if (source == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
24862820 {
2487
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
24882823 for (int i=0; i<group.selection.size(); i++)
24892824 {
2490
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
24912830 }
24922831
2493
- ClearSelection(false);
2494
-
2495
- 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
+ }
24962843 } else
24972844 if (source == genUVItem)
24982845 {
....@@ -2504,7 +2851,7 @@
25042851 } else
25052852 if (source == genNormalsMESHItem)
25062853 {
2507
- GenNormals(true); // TODO
2854
+ GenNormalsMESH();
25082855 } else
25092856 if (source == genNormalsORGANItem)
25102857 {
....@@ -2569,6 +2916,22 @@
25692916 if (source == unmarkleavesItem)
25702917 {
25712918 MarkLeaves(false);
2919
+ } else
2920
+ if (source == rewindleavesItem)
2921
+ {
2922
+ RewindLeaves(true);
2923
+ } else
2924
+ if (source == unrewindleavesItem)
2925
+ {
2926
+ RewindLeaves(false);
2927
+ } else
2928
+ if (source == randomleavesItem)
2929
+ {
2930
+ RandomLeaves(true);
2931
+ } else
2932
+ if (source == unrandomleavesItem)
2933
+ {
2934
+ RandomLeaves(false);
25722935 } else
25732936 if (source == flipVItem)
25742937 {
....@@ -2804,6 +3167,10 @@
28043167 if (source == twoButton)
28053168 {
28063169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
28073174 // bug
28083175 //gridPanel.setDividerLocation(1.0);
28093176 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3203,31 @@
28363203 bigThree.ClearUI();
28373204 bigThree.add(centralPanel);
28383205 bigThree.FlushUI();
3206
+
3207
+ cameraView.requestFocusInWindow();
3208
+
3209
+// refreshContents(true);
3210
+//
3211
+// try
3212
+// {
3213
+// java.awt.Robot bot = new java.awt.Robot();
3214
+// int mask = InputEvent.BUTTON1_MASK;
3215
+// bot.mouseMove(100, 100);
3216
+// bot.mousePress(mask);
3217
+// bot.mouseRelease(mask);
3218
+// }
3219
+// catch (Exception e)
3220
+// {
3221
+//
3222
+// }
3223
+
28393224 } else
28403225 if (source == threeButton)
28413226 {
28423227 radio.layout = threeButton;
3228
+
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
28433231
28443232 // bigThree.remove(scenePanel);
28453233 // bigThree.remove(centralPanel);
....@@ -2872,10 +3260,15 @@
28723260 bigThree.add(centralPanel);
28733261 bigThree.add(XYZPanel);
28743262 bigThree.FlushUI();
3263
+
3264
+ cameraView.requestFocusInWindow();
28753265 } else
28763266 if (source == fourButton)
28773267 {
28783268 radio.layout = fourButton;
3269
+
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
28793272
28803273 // bigThree.remove(scenePanel);
28813274 // bigThree.remove(centralPanel);
....@@ -2907,10 +3300,15 @@
29073300 bigThree.ClearUI();
29083301 bigThree.add(scenePanel);
29093302 bigThree.FlushUI();
3303
+
3304
+ cameraView.requestFocusInWindow();
29103305 } else
29113306 if (source == sixButton)
29123307 {
29133308 radio.layout = sixButton;
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
29143312
29153313 // bigThree.remove(scenePanel);
29163314 // bigThree.remove(centralPanel);
....@@ -2943,10 +3341,15 @@
29433341 bigThree.add(scenePanel);
29443342 bigThree.add(centralPanel);
29453343 bigThree.FlushUI();
3344
+
3345
+ cameraView.requestFocusInWindow();
29463346 } else
29473347 if (source == sevenButton)
29483348 {
29493349 radio.layout = sevenButton;
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
29503353
29513354 // bigThree.remove(scenePanel);
29523355 // bigThree.remove(centralPanel);
....@@ -2980,6 +3383,8 @@
29803383 bigThree.add(centralPanel);
29813384 bigThree.add(XYZPanel);
29823385 bigThree.FlushUI();
3386
+
3387
+ cameraView.requestFocusInWindow();
29833388 } else
29843389 if (source == rootButton)
29853390 {
....@@ -2991,6 +3396,7 @@
29913396 EditObject(obj);
29923397 }
29933398
3399
+ cameraView.requestFocusInWindow();
29943400 refreshContents(true);
29953401 } else
29963402 if (source == closeButton)
....@@ -3000,22 +3406,37 @@
30003406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013407 {
30023408 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
30053417 buttonGroup.remove(ab);
30063418 radioPanel.remove(ab);
30073419
3008
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
30093422 // ab.GetObject().objectUI = null; // ?????????
30103423
30113424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123425 break;
30133426 }
30143427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
30153430 refreshContents(true);
30163431 } else
30173432 if (source == editItem || source == editButton)
30183433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
30193440 EditSelection(false);
30203441 } else
30213442 if (source == uneditButton)
....@@ -3025,10 +3446,11 @@
30253446 Object3D child = (Object3D)e.nextElement();
30263447 if(child.editWindow != null)
30273448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
30283450 child.CloseUI();
30293451 listUI.remove(child);
30303452
3031
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
30323454 }
30333455 objEditor.ctrlPanel.FlushUI();
30343456 //objEditor.jTree.clearSelection();
....@@ -3041,6 +3463,7 @@
30413463 //copy.ClearUI();
30423464 for (Object3D obj : listUI)
30433465 {
3466
+ obj.pinned = false;
30443467 obj.CloseUI();
30453468 }
30463469 listUI.clear();
....@@ -3050,7 +3473,7 @@
30503473 {
30513474 assert(copy == group);
30523475
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543477
30553478 for (Object3D obj : listUI)
30563479 {
....@@ -3099,6 +3522,9 @@
30993522 }
31003523
31013524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
31023528 //Globals.theRenderer.object = group;
31033529 if(!useclient)
31043530 {
....@@ -3115,7 +3541,9 @@
31153541 sideView.object = group;
31163542 }
31173543
3118
-// fix "+" issue group.editWindow = this;
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
31193547
31203548 /*
31213549 currentLayout = radio.layout;
....@@ -3123,18 +3551,27 @@
31233551 currentLayout = sevenButton;
31243552 */
31253553 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);
31263561 keepparent = group.parent;
31273562 // PARENT = NULL or not???
31283563 //group.parent = null; // ROOT
31293564 //group.attributes = -1;
31303565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
31313568 refreshContents(true);
31323569 } else if (event.getSource() == editCameraItem)
31333570 {
31343571 cameraView.ProtectCamera();
31353572 cameraView.repaint();
31363573 return;
3137
- } else if (event.getSource() == revertCameraItem)
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31383575 {
31393576 cameraView.RevertCamera();
31403577 cameraView.repaint();
....@@ -3151,7 +3588,6 @@
31513588 }
31523589
31533590 boolean useclient = false;
3154
- cRadio radio;
31553591
31563592 void ToggleRoot()
31573593 {
....@@ -3390,7 +3826,8 @@
33903826
33913827 int size = obj.MemorySize();
33923828
3393
- System.err.println((size/1024) + " KB is the size of " + obj);
3829
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3830
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33943831 }
33953832 }
33963833 catch (Exception e)
....@@ -3471,6 +3908,13 @@
34713908 void GenNormals(boolean crease)
34723909 {
34733910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
34743918
34753919 refreshContents();
34763920 }
....@@ -4098,6 +4542,18 @@
40984542 refreshContents();
40994543 }
41004544
4545
+ void RewindLeaves(boolean hide)
4546
+ {
4547
+ group.selection.RewindLeaves(hide);
4548
+ refreshContents();
4549
+ }
4550
+
4551
+ void RandomLeaves(boolean hide)
4552
+ {
4553
+ group.selection.RandomLeaves(hide);
4554
+ refreshContents();
4555
+ }
4556
+
41014557 void SetTexRes(int tr)
41024558 {
41034559 group.selection.SetTexRes(tr);
....@@ -4169,10 +4625,6 @@
41694625 // }
41704626 // }
41714627
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41764628 void EditSelection(boolean newWindow)
41774629 {
41784630 // aConstraints.gridy = 0;
....@@ -4180,7 +4632,7 @@
41804632 {
41814633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41824634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41844636
41854637 Object3D elem = (Object3D)group.selection.elementAt(i);
41864638 if(elem != group || !newWindow)
....@@ -4265,7 +4717,8 @@
42654717 //new Exception().printStackTrace();
42664718
42674719 freezemodel = true;
4268
-
4720
+ ClearUnpinned();
4721
+
42694722 /**/
42704723 //switch (event.id)
42714724 {
....@@ -4273,7 +4726,6 @@
42734726 //case 702: // Event.LIST_DESELECT
42744727 group.deselectAll();
42754728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42774729 if (tps != null)
42784730 {
42794731 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +4734,8 @@
42824734
42834735 //if (child.parent != null)
42844736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
42854738 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42894739 }
42904740 }
42914741 // else
....@@ -4295,20 +4745,28 @@
42954745 // System.err.println("info : " + group.GetPath());
42964746 // }
42974747
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4748
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43014749 CameraPane.flash = true;
43024750
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43044752 // a camera
43054753 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4755
+ {
4756
+ CameraPane.camerachangeframe = 0; // don't refuse it
4757
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4758
+ }
43084759 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43094760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43104761 }
43114762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
43124770 refreshContents();
43134771 //return true;
43144772 }
....@@ -4317,6 +4775,35 @@
43174775
43184776 freezemodel = false;
43194777 }
4778
+
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
4787
+ void refreshContents(boolean cp)
4788
+ {
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4791
+ {
4792
+ objEditor.ClearInfo(); // .GetMaterial());
4793
+
4794
+ for (int i=0; i < group.selection.Size(); i++)
4795
+ {
4796
+ Object3D child = (Object3D) group.selection.get(i);
4797
+
4798
+ objEditor.AddInfo(child, this, true);
4799
+ System.err.println("info : " + child.GetPath());
4800
+ }
4801
+
4802
+ objEditor.SetText(); // jan 2014
4803
+ }
4804
+
4805
+ super.refreshContents(cp);
4806
+ }
43204807
43214808 void linkSomething(Object3D thing)
43224809 {
....@@ -4388,6 +4875,7 @@
43884875 {
43894876 if (group.selection.isEmpty())
43904877 return;
4878
+
43914879 Grafreed.clipboardIsTempGroup = false;
43924880 Composite tGroup = null;
43934881 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +4886,8 @@
43984886
43994887 if (cut)
44004888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
44014891 //int indices[] = jList.getSelectedIndices();
44024892 //for (int i = indices.length - 1; i >= 0; i--)
44034893 //jList.remove(indices[i]);
....@@ -4487,8 +4977,10 @@
44874977 }
44884978
44894979 }
4980
+
44904981 if (Grafreed.clipboardIsTempGroup)
44914982 Grafreed.clipboard = tGroup;
4983
+
44924984 if (cut)
44934985 {
44944986 ResetModel();
....@@ -4498,6 +4990,10 @@
44984990
44994991 void paste(boolean expand)
45004992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
45014997 // if (GrafreeD.clipboard == null)
45024998 // return;
45034999 boolean first = true;
....@@ -4557,6 +5053,7 @@
45575053 Grafreed.clipboard.get(0).parent = keepparent;
45585054 }
45595055
5056
+ Globals.REPLACEONMAKE = keep;
45605057 ResetModel();
45615058 refreshContents();
45625059 }
....@@ -4692,6 +5189,10 @@
46925189
46935190 void group(Object3D csg, boolean grab)
46945191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
46955196 if (//false) // why??
46965197 !group.selection.isEmpty())
46975198 {
....@@ -4805,10 +5306,15 @@
48055306 //node.add(csg);
48065307 //makeSomething(node);
48075308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
48085310 }
48095311
48105312 void Ungroup(Object3D g)
48115313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
48125318 if (g instanceof HiddenObject)
48135319 {
48145320 HiddenObject h = (HiddenObject) g;
....@@ -4825,6 +5331,7 @@
48255331 objEditor.makeSomething(g.get(i), false);
48265332 }
48275333 }
5334
+ Globals.REPLACEONMAKE = keep;
48285335 }
48295336
48305337 void ungroup()
....@@ -5113,7 +5620,28 @@
51135620 cButton clearpanelButton;
51145621 cButton unselectButton;
51155622
5623
+ cButton restoreCameraButton;
5624
+
5625
+ cButton saveButton;
51165626 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;
51175645
51185646 cButton screenfitButton;
51195647 cButton screenfitpointButton;
....@@ -5126,14 +5654,6 @@
51265654
51275655 cButton setsupportButton;
51285656
5129
- cButton twoButton;
5130
- cButton sixButton;
5131
- cButton threeButton;
5132
- cButton sevenButton;
5133
- cButton fourButton; // full panel
5134
- cButton oneButton; // full XYZ
5135
- //cButton currentLayout;
5136
-
51375657 //
51385658 //Composite
51395659 Object3D // to do !!
....@@ -5143,9 +5663,11 @@
51435663 //JTree jTree;
51445664 private MenuItem lookAtItem;
51455665 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
51475667 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
51495671 private MenuItem cloneItem;
51505672 private MenuItem cloneSupportItem;
51515673 private MenuItem overwriteGeoItem;
....@@ -5208,6 +5730,10 @@
52085730 private MenuItem showleavesItem;
52095731 private MenuItem markleavesItem;
52105732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
52115737
52125738 private MenuItem flipVItem;
52135739 private MenuItem unflipVItem;
....@@ -5229,7 +5755,7 @@
52295755 private MenuItem frontItem;
52305756 private MenuItem cameraItem;
52315757 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
52335759 private MenuItem physicsItem;
52345760 private MenuItem frameselectorItem;
52355761 private MenuItem scriptNodeItem;
....@@ -5303,5 +5829,5 @@
53035829
53045830 Menu cameraMenu;
53055831 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
5832
+ MenuItem restoreCameraItem;
53075833 }