Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
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"));
....@@ -188,8 +206,8 @@
188206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189207 // pasteExpandItem.addActionListener(this);
190208 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
193211
194212 if (Globals.ADVANCED)
195213 {
....@@ -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
....@@ -246,7 +264,7 @@
246264
247265 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248266 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
267
+ toggleDebugItem.setState(Globals.DEBUG);
250268
251269 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252270 toggleFrustumItem.addItemListener(this);
....@@ -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"));
....@@ -410,7 +433,7 @@
410433 genNormalsMESHItem.addActionListener(this);
411434 if (Globals.ADVANCED)
412435 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414437 genNormalsMINEItem.addActionListener(this);
415438 }
416439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -470,6 +493,14 @@
470493 markleavesItem.addActionListener(this);
471494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472495 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);
473504 menu.add("-");
474505 flipVItem = menu.add(new MenuItem("Flip V"));
475506 flipVItem.addActionListener(this);
....@@ -525,8 +556,21 @@
525556 buildToolsMenu(menu);
526557 }
527558
559
+
528560 void SetupUI2(ObjEditor oe)
529561 {
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
+
530574 //new Exception().printStackTrace();
531575
532576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +599,79 @@
555599 oe.radioPanel.add(dummyButton);
556600 oe.buttonGroup.add(dummyButton);
557601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
558606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559607
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- undoButton.setToolTipText("Undo changes");
562
- undoButton.addActionListener(this);
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
563611
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- redoButton.setToolTipText("Redo changes");
566
- redoButton.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
+ }
567618
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
- saveButton.setToolTipText("Save changes");
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");
570633 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);
571639
572
- 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);
573659 liveCB.setToolTipText("Enable animation");
574660 liveCB.addItemListener(this);
575661
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577663 oneStepButton.setToolTipText("Animate one step forward");
578664 oneStepButton.addActionListener(this);
579665
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581667 fastCB.setToolTipText("Fast mode");
582668 fastCB.addItemListener(this);
583669
584
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
585
- trackCB.setToolTipText("Enable tracking");
586
- trackCB.addItemListener(this);
587
-
588
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589
- screenfitButton.setToolTipText("Screen fit");
590
- 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);
591675
592676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593677 // screenfitpointButton.addActionListener(this);
....@@ -599,65 +683,146 @@
599683 snapobjectButton.setToolTipText("Snap Object");
600684 }
601685
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605687
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
- twoButton.setToolTipText("Show center view only");
610
- twoButton.addActionListener(this);
611
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612689 fourButton.addActionListener(this);
613690 fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
- sixButton.setToolTipText("2-column layout left");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
697
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ sixButton.setToolTipText("Show left and right");
616699 sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618
- threeButton.setToolTipText("2-column layout right");
619
- threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- sevenButton.setToolTipText("3-column layout");
622
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
623706 //
624707
625
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
- rootButton.setToolTipText("Edit selection in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
627710 rootButton.addActionListener(this);
628711
629
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630713 closeButton.setToolTipText("Close tab");
631714 closeButton.addActionListener(this);
632715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633716 //clearButton.addActionListener(this);
634
-
635
- cGridBag commandsPanel = new cGridBag();
717
+
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
636749
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- editButton.setToolTipText("Edit selection");
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
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
+ oe.toolboxPanel.add(new cGridBag());
794
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
639799 editButton.addActionListener(this);
640800
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
643803 uneditButton.addActionListener(this);
644804
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
647807 allParamsButton.addActionListener(this);
648808
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650810 clearPanelButton.setToolTipText("Clear edit panel");
651811 clearPanelButton.addActionListener(this);
652812
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654814 unselectButton.setToolTipText("Unselect");
655815 unselectButton.addActionListener(this);
656816
657
- commandsPanel.preferredHeight = 1;
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
658820
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
661826
662827 // oe.aConstraints.gridx += 1;
663828 // oe.aConstraints.weighty = 0;
....@@ -674,29 +839,17 @@
674839
675840 JScrollPane jSP;
676841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
678843 ResetModel();
679844
680845 oe.treePanel.add(jSPPanel);
681846 oe.treePanel.Return();
682847
683
- cGridBag copyOptionsPanel = new cGridBag();
684
-
685
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
686
- colorCB.setToolTipText("Copy color when dropped");
687
- colorCB.addItemListener(this);
688
-
689
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
690
- materialCB.setToolTipText("Copy material when dropped");
691
- materialCB.addItemListener(this);
692
-
693
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
694
- textureCB.setToolTipText("Copy texture when dropped");
695
- textureCB.addItemListener(this);
696
-
697
- copyOptionsPanel.preferredHeight = 1;
698848 oe.treePanel.add(copyOptionsPanel);
699849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
700853
701854 // mainPanel.setDividerLocation(0.5); //1.0);
702855 // mainPanel.setResizeWeight(0.5);
....@@ -719,29 +872,49 @@
719872 dgr.addDragGestureListener(this);
720873 }catch(Exception e) {}
721874 */
722
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
723876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
724877 }
725878
726879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
727880 {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
728895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
729896 boxCB.setToolTipText("Display bounding boxes");
730897 boxCB.addItemListener(this);
731898
732899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
734901 zoomBoxCB.addItemListener(this);
735902
736903 if (true) // Globals.ADVANCED)
737904 {
738
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
- supportCB.setToolTipText("Enable rigging");
740
- supportCB.addItemListener(this);
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
741912
742913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
743914 // localCB.addItemListener(this);
744915
916
+ panel.Return();
917
+
745918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
746919 crowdCB.setToolTipText("Used for crowds");
747920 crowdCB.addItemListener(this);
....@@ -758,6 +931,8 @@
758931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
759932 // speakerMocapCB.addItemListener(this);
760933
934
+ panel.Return();
935
+
761936 if (false)
762937 {
763938 // handled in scripts
....@@ -772,34 +947,74 @@
772947 //constraints.gridy += 1;
773948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
774949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
775951 }
776952
777953 //constraints.gridx += 1;
778954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
779955 // debugCB.addItemListener(this);
780956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
781961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
782963 oeilCB.addItemListener(this);
783964
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
784985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
785986 lookAtCB.setToolTipText("Look-at target");
786987 lookAtCB.addItemListener(this);
988
+ }
787989
788990 }
789991
790992 cGridBag fill = new cGridBag();
791
-
792993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
793998
794999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
7951002
7961003 }
7971004
7981005 void EditObject(Object3D obj)
7991006 {
8001007 cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
8011016 radioButton.SetObject(obj);
802
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
8031018 radioButton.SetCamera(cameraView.renderCamera, false);
8041019 radioButton.addActionListener(this);
8051020 radioPanel.add(radioButton);
....@@ -809,6 +1024,8 @@
8091024
8101025 void SetupViews(ObjEditor oe)
8111026 {
1027
+ theFrame = this;
1028
+
8121029 oe.SetupViews();
8131030
8141031 System.out.println("SetupViews");
....@@ -817,23 +1034,28 @@
8171034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8181035 }
8191036
820
- JCheckBox liveCB;
821
- JCheckBox supportCB;
822
- JCheckBox localCB;
823
- JCheckBox crowdCB;
824
- JCheckBox smoothCB;
825
- JCheckBox fastCB;
826
- JCheckBox slowCB;
827
- JCheckBox boxCB;
828
- JCheckBox zoomBoxCB;
829
- JCheckBox trackCB;
830
- JCheckBox smoothfocusCB;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
8311050 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
8371059
8381060 // static int COLOR = 1;
8391061 // static int MATERIAL = 2;
....@@ -841,9 +1063,9 @@
8411063
8421064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431065
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
8471069
8481070 public void itemStateChanged(ItemEvent e)
8491071 {
....@@ -936,6 +1158,18 @@
9361158 {
9371159 cameraView.ToggleOeil();
9381160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
9391173 else if(e.getSource() == lookAtCB)
9401174 {
9411175 cameraView.ToggleLookAt();
....@@ -952,7 +1186,8 @@
9521186
9531187 /**/
9541188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
955
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
9561191 if ((path == null) || (path.getPathCount() <= 1)) {
9571192 // We can't move the root node or an empty selection
9581193 return;
....@@ -1015,8 +1250,6 @@
10151250 }
10161251 }
10171252
1018
- String string = (String) object;
1019
-
10201253 System.out.println("Transfer = " + object + "; drop : " + target);
10211254 // if( object instanceof java.io.File[])
10221255 // {
....@@ -1024,6 +1257,8 @@
10241257 // objEditor.DropFile((java.io.File[]) object, true);
10251258 // return;
10261259 // }
1260
+
1261
+ String string = object.toString();
10271262
10281263 // File path for Mac and Windows
10291264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1069,23 +1304,33 @@
10691304
10701305 assert target == objEditor.jTree;
10711306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
10721308 try {
1073
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10741310 } catch (Exception e) {
10751311 System.out.println("destinationPath : " + destinationPath);
10761312 return;
10771313 }
10781314
1079
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
10801316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
10811326 loadClipboard(true);
10821327 objEditor.jTree.setSelectionPath(destinationPath);
10831328 pasteInto(false, false);
1084
- } else {
1085
- loadClipboard(false);
1086
- objEditor.jTree.setSelectionPath(destinationPath);
1087
- pasteInto(false, false); // true); // ???
1088
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
10891334 }
10901335 public void dropActionChanged(DropTargetDragEvent dtde)
10911336 // Called if the user has modified the current drop gesture
....@@ -1190,22 +1435,30 @@
11901435 {
11911436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11921437 //heightFieldItem.addActionListener(this);
1193
- gridItem = menu.add(new MenuItem("Grid"));
1194
- gridItem.addActionListener(this);
1195
- rectoidItem = menu.add(new MenuItem("Box"));
1196
- rectoidItem.addActionListener(this);
1197
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1198
- ellipsoidItem.addActionListener(this);
1199
- coneItem = menu.add(new MenuItem("Cone"));
1200
- coneItem.addActionListener(this);
1201
- torusItem = menu.add(new MenuItem("Torus"));
1202
- torusItem.addActionListener(this);
1203
- superItem = menu.add(new MenuItem("Superellipsoid"));
1204
- superItem.addActionListener(this);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
12051456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12061457 kleinItem.addActionListener(this);
1207
- particleItem = menu.add(new MenuItem("Particle system"));
1208
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
12091462 if (Globals.ADVANCED)
12101463 {
12111464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1231,15 +1484,15 @@
12311484 }
12321485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12331486 bezierItem.addActionListener(this);
1234
- overlayItem = menu.add(new MenuItem("Overlay"));
1235
- overlayItem.addActionListener(this);
1236
- lightItem = menu.add(new MenuItem("Light"));
1237
- lightItem.addActionListener(this);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
12381491 menu.add("-");
12391492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12401493 //superLoopItem.addActionListener(this);
1241
- loopItem = menu.add(new MenuItem("Loop"));
1242
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
12431496 doubleItem = menu.add(new MenuItem("Fork"));
12441497 doubleItem.addActionListener(this);
12451498 if (Globals.ADVANCED)
....@@ -1255,6 +1508,9 @@
12551508 animationItem.addItemListener(this);
12561509 animationItem.setState(Globals.ANIMATION);
12571510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
12581514 menu.add("-");
12591515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12601516 parseverticesItem.addActionListener(this);
....@@ -1267,6 +1523,8 @@
12671523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12681524 reduce34MorphItem.addActionListener(this);
12691525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
12701528 menu.add(computeAOItem = new MenuItem("Compute AO"));
12711529 computeAOItem.addActionListener(this);
12721530
....@@ -1275,8 +1533,6 @@
12751533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12761534 mirrorItem.addActionListener(this);
12771535 menu.add("-");
1278
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1279
- memoryItem.addActionListener(this);
12801536 menu.add(analyzeItem = new MenuItem("Analyze"));
12811537 analyzeItem.addActionListener(this);
12821538 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1420,9 +1676,34 @@
14201676 shadow.material = new cMaterial(obj.material);
14211677 shadow.material.diffuse = 0.0001f;
14221678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
14231680
14241681 makeSomething(shadow);
14251682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
14261707
14271708 /**
14281709 * applyExample
....@@ -1667,7 +1948,7 @@
16671948 {
16681949 ScreenFit();
16691950 } else
1670
- if (source == switchItem)
1951
+ if (source == switchViewItem)
16711952 {
16721953 cVector v1 = new cVector();
16731954 cVector v2 = new cVector();
....@@ -1676,11 +1957,11 @@
16761957 objEditor.cameraView.renderCamera.setAim(v2, v1);
16771958 objEditor.cameraView.repaint();
16781959 } else
1679
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
16801961 {
16811962 makeSomething(new Box());
16821963 } else
1683
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
16841965 {
16851966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16861967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1759,27 +2040,27 @@
17592040
17602041 makeSomething(obj);
17612042 } else
1762
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
17632044 {
17642045 makeSomething(new Grid());
17652046 } else
1766
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
17672048 {
17682049 makeSomething(new Sphere());
17692050 } else
1770
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
17712052 {
17722053 makeSomething(new Cone());
17732054 } else
1774
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
17752056 {
17762057 makeSomething(new Torus());
17772058 } else
1778
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
17792060 {
17802061 makeSomething(new Superellipsoid());
17812062 } else
1782
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
17832064 {
17842065 makeSomething(new Klein());
17852066 } else
....@@ -1799,7 +2080,7 @@
17992080 {
18002081 makeSomething(new BezierSurface());
18012082 } else
1802
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
18032084 {
18042085 /*
18052086 Object3D obj = new BezierSurface(5,8);
....@@ -1847,7 +2128,7 @@
18472128 s.setup();
18482129 makeSomething(s);
18492130 } else
1850
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
18512132 {
18522133 makeSomething(new Light());
18532134 } else
....@@ -1897,30 +2178,30 @@
18972178
18982179 group(g);
18992180 } else
1900
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
19012182 {
19022183 Composite csg = new GroupLeaf();
19032184 csg.count = 5;
19042185 group(csg);
1905
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
19062187 csg.addChild(child);
19072188 child.addChild(csg);
19082189 } else
19092190 if (source == doubleItem)
19102191 {
1911
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
19122193 csg.count = 5;
19132194 group(csg);
1914
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
19152196 csg.addChild(child);
19162197 child.addChild(csg);
1917
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
19182199 csg.addChild(child);
19192200 child.addChild(csg);
19202201 } else
19212202 if (source == tripleItem)
19222203 {
1923
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
19242205 csg.count = 4;
19252206 group(csg);
19262207 Composite child = new cGroup();
....@@ -1970,17 +2251,45 @@
19702251 {
19712252 DumpObject();
19722253 } else
2254
+ if (source == minButton)
2255
+ {
2256
+ Minimize();
2257
+ } else
2258
+ if (source == maxButton)
2259
+ {
2260
+ Maximize();
2261
+ } else
2262
+ if (source == fullButton)
2263
+ {
2264
+ ToggleFullScreen();
2265
+ } else
19732266 if (source == undoButton)
19742267 {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
19752271 Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
19762282 } else
19772283 if (source == redoButton)
19782284 {
2285
+ // Go to next version
19792286 Redo();
19802287 } else
19812288 if (source == saveButton)
19822289 {
1983
- Save();
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
19842293 } else
19852294 if (source == oneStepButton)
19862295 {
....@@ -1989,17 +2298,14 @@
19892298 } else
19902299 if (source == screenfitButton)
19912300 {
1992
- //Reload(lastConverter, lastFilename, true);
19932301 ScreenFit();
19942302 } else
19952303 if (source == screenfitpointButton)
19962304 {
1997
- //Reload(lastConverter, lastFilename, true);
19982305 ScreenFitPoint();
19992306 } else
20002307 if (source == snapobjectButton)
20012308 {
2002
- //Reload(lastConverter, lastFilename, true);
20032309 SnapObject();
20042310 } else
20052311 // if (event.getSource() == recompileButton)
....@@ -2363,7 +2669,7 @@
23632669 {
23642670 StepAll();
23652671 } else
2366
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
23672673 {
23682674 //int indices[] = jList.getSelectedIndices();
23692675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2375,9 +2681,9 @@
23752681 {
23762682 ClearSelection(true);
23772683 } else
2378
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
23792685 {
2380
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
23812687 } else
23822688 if (source == hideItem)
23832689 {
....@@ -2395,11 +2701,11 @@
23952701 {
23962702 makeSomething(new Camera());
23972703 } else
2398
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
23992705 {
24002706 group(new Composite());
24012707 } else
2402
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
24032709 {
24042710 RandomNode random = new RandomNode();
24052711 group(random);
....@@ -2501,7 +2807,7 @@
25012807 {
25022808 group(new cLinker());
25032809 } else
2504
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
25052811 {
25062812 group(new TextureNode());
25072813 } else
....@@ -2521,17 +2827,30 @@
25212827 {
25222828 CastShadow(2);
25232829 } else
2524
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
25252831 {
2526
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
25272834 for (int i=0; i<group.selection.size(); i++)
25282835 {
2529
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
25302841 }
25312842
2532
- ClearSelection(false);
2533
-
2534
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
25352854 } else
25362855 if (source == genUVItem)
25372856 {
....@@ -2608,6 +2927,22 @@
26082927 if (source == unmarkleavesItem)
26092928 {
26102929 MarkLeaves(false);
2930
+ } else
2931
+ if (source == rewindleavesItem)
2932
+ {
2933
+ RewindLeaves(true);
2934
+ } else
2935
+ if (source == unrewindleavesItem)
2936
+ {
2937
+ RewindLeaves(false);
2938
+ } else
2939
+ if (source == randomleavesItem)
2940
+ {
2941
+ RandomLeaves(true);
2942
+ } else
2943
+ if (source == unrandomleavesItem)
2944
+ {
2945
+ RandomLeaves(false);
26112946 } else
26122947 if (source == flipVItem)
26132948 {
....@@ -2843,6 +3178,10 @@
28433178 if (source == twoButton)
28443179 {
28453180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
28463185 // bug
28473186 //gridPanel.setDividerLocation(1.0);
28483187 //bigPanel.setDividerLocation(0.0);
....@@ -2875,10 +3214,31 @@
28753214 bigThree.ClearUI();
28763215 bigThree.add(centralPanel);
28773216 bigThree.FlushUI();
3217
+
3218
+ cameraView.requestFocusInWindow();
3219
+
3220
+// refreshContents(true);
3221
+//
3222
+// try
3223
+// {
3224
+// java.awt.Robot bot = new java.awt.Robot();
3225
+// int mask = InputEvent.BUTTON1_MASK;
3226
+// bot.mouseMove(100, 100);
3227
+// bot.mousePress(mask);
3228
+// bot.mouseRelease(mask);
3229
+// }
3230
+// catch (Exception e)
3231
+// {
3232
+//
3233
+// }
3234
+
28783235 } else
28793236 if (source == threeButton)
28803237 {
28813238 radio.layout = threeButton;
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
28823242
28833243 // bigThree.remove(scenePanel);
28843244 // bigThree.remove(centralPanel);
....@@ -2911,10 +3271,15 @@
29113271 bigThree.add(centralPanel);
29123272 bigThree.add(XYZPanel);
29133273 bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
29143276 } else
29153277 if (source == fourButton)
29163278 {
29173279 radio.layout = fourButton;
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
29183283
29193284 // bigThree.remove(scenePanel);
29203285 // bigThree.remove(centralPanel);
....@@ -2946,10 +3311,15 @@
29463311 bigThree.ClearUI();
29473312 bigThree.add(scenePanel);
29483313 bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
29493316 } else
29503317 if (source == sixButton)
29513318 {
29523319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
29533323
29543324 // bigThree.remove(scenePanel);
29553325 // bigThree.remove(centralPanel);
....@@ -2982,10 +3352,15 @@
29823352 bigThree.add(scenePanel);
29833353 bigThree.add(centralPanel);
29843354 bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
29853357 } else
29863358 if (source == sevenButton)
29873359 {
29883360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
29893364
29903365 // bigThree.remove(scenePanel);
29913366 // bigThree.remove(centralPanel);
....@@ -3019,6 +3394,8 @@
30193394 bigThree.add(centralPanel);
30203395 bigThree.add(XYZPanel);
30213396 bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
30223399 } else
30233400 if (source == rootButton)
30243401 {
....@@ -3030,6 +3407,7 @@
30303407 EditObject(obj);
30313408 }
30323409
3410
+ cameraView.requestFocusInWindow();
30333411 refreshContents(true);
30343412 } else
30353413 if (source == closeButton)
....@@ -3039,22 +3417,37 @@
30393417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30403418 {
30413419 ab = (cRadio)e.nextElement();
3042
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30433421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
30443428 buttonGroup.remove(ab);
30453429 radioPanel.remove(ab);
30463430
3047
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
30483433 // ab.GetObject().objectUI = null; // ?????????
30493434
30503435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30513436 break;
30523437 }
30533438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
30543441 refreshContents(true);
30553442 } else
30563443 if (source == editItem || source == editButton)
30573444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
30583451 EditSelection(false);
30593452 } else
30603453 if (source == uneditButton)
....@@ -3064,6 +3457,7 @@
30643457 Object3D child = (Object3D)e.nextElement();
30653458 if(child.editWindow != null)
30663459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
30673461 child.CloseUI();
30683462 listUI.remove(child);
30693463
....@@ -3080,6 +3474,7 @@
30803474 //copy.ClearUI();
30813475 for (Object3D obj : listUI)
30823476 {
3477
+ obj.pinned = false;
30833478 obj.CloseUI();
30843479 }
30853480 listUI.clear();
....@@ -3089,7 +3484,7 @@
30893484 {
30903485 assert(copy == group);
30913486
3092
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30933488
30943489 for (Object3D obj : listUI)
30953490 {
....@@ -3138,6 +3533,9 @@
31383533 }
31393534
31403535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
31413539 //Globals.theRenderer.object = group;
31423540 if(!useclient)
31433541 {
....@@ -3155,7 +3553,8 @@
31553553 }
31563554
31573555 // fix "+" issue
3158
- group.editWindow = this;
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
31593558
31603559 /*
31613560 currentLayout = radio.layout;
....@@ -3163,18 +3562,27 @@
31633562 currentLayout = sevenButton;
31643563 */
31653564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
31663572 keepparent = group.parent;
31673573 // PARENT = NULL or not???
31683574 //group.parent = null; // ROOT
31693575 //group.attributes = -1;
31703576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
31713579 refreshContents(true);
31723580 } else if (event.getSource() == editCameraItem)
31733581 {
31743582 cameraView.ProtectCamera();
31753583 cameraView.repaint();
31763584 return;
3177
- } else if (event.getSource() == revertCameraItem)
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31783586 {
31793587 cameraView.RevertCamera();
31803588 cameraView.repaint();
....@@ -3191,7 +3599,6 @@
31913599 }
31923600
31933601 boolean useclient = false;
3194
- cRadio radio;
31953602
31963603 void ToggleRoot()
31973604 {
....@@ -4146,6 +4553,18 @@
41464553 refreshContents();
41474554 }
41484555
4556
+ void RewindLeaves(boolean hide)
4557
+ {
4558
+ group.selection.RewindLeaves(hide);
4559
+ refreshContents();
4560
+ }
4561
+
4562
+ void RandomLeaves(boolean hide)
4563
+ {
4564
+ group.selection.RandomLeaves(hide);
4565
+ refreshContents();
4566
+ }
4567
+
41494568 void SetTexRes(int tr)
41504569 {
41514570 group.selection.SetTexRes(tr);
....@@ -4217,28 +4636,25 @@
42174636 // }
42184637 // }
42194638
4220
- static boolean allparams = true;
4221
-
4222
- static Vector<Object3D> listUI = new Vector<Object3D>();
4223
-
42244639 void EditSelection(boolean newWindow)
42254640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
42264647 // aConstraints.gridy = 0;
42274648 for (int i=0; i<group.selection.size(); i++)
42284649 {
42294650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42304651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4231
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42324653
42334654 Object3D elem = (Object3D)group.selection.elementAt(i);
42344655 if(elem != group || !newWindow)
42354656 {
4236
- // if (!(elem instanceof Composite))
4237
- // newWindow = false;
4238
- listUI.add(elem);
4239
- elem.openEditWindow(this, newWindow); //, false);
4240
- System.out.println("edit : " + elem);
4241
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
42424658 }
42434659 }
42444660 }
....@@ -4313,7 +4729,8 @@
43134729 //new Exception().printStackTrace();
43144730
43154731 freezemodel = true;
4316
-
4732
+ ClearUnpinned();
4733
+
43174734 /**/
43184735 //switch (event.id)
43194736 {
....@@ -4329,6 +4746,7 @@
43294746
43304747 //if (child.parent != null)
43314748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
43324750 group.addSelectee(child);
43334751 }
43344752 }
....@@ -4345,7 +4763,7 @@
43454763 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43464764 // a camera
43474765 {
4348
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43494767 {
43504768 CameraPane.camerachangeframe = 0; // don't refuse it
43514769 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4354,6 +4772,13 @@
43544772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43554773 }
43564774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
43574782 refreshContents();
43584783 //return true;
43594784 }
....@@ -4363,21 +4788,27 @@
43634788 freezemodel = false;
43644789 }
43654790
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
43664799 void refreshContents(boolean cp)
43674800 {
4368
- if (!Globals.MOUSEDRAGGED)
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
43694803 {
43704804 objEditor.ClearInfo(); // .GetMaterial());
43714805
4372
- for (int i=0; i < group.selection.size(); i++)
4806
+ for (int i=0; i < group.selection.Size(); i++)
43734807 {
4374
- Object3D child = (Object3D) group.selection.reserve(i);
4808
+ Object3D child = (Object3D) group.selection.get(i);
43754809
4376
- objEditor.SetMaterial(child);
43774810 objEditor.AddInfo(child, this, true);
43784811 System.err.println("info : " + child.GetPath());
4379
-
4380
- group.selection.release(i);
43814812 }
43824813
43834814 objEditor.SetText(); // jan 2014
....@@ -4467,7 +4898,8 @@
44674898
44684899 if (cut)
44694900 {
4470
- Save();
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
44714903 //int indices[] = jList.getSelectedIndices();
44724904 //for (int i = indices.length - 1; i >= 0; i--)
44734905 //jList.remove(indices[i]);
....@@ -4570,6 +5002,10 @@
45705002
45715003 void paste(boolean expand)
45725004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
45735009 // if (GrafreeD.clipboard == null)
45745010 // return;
45755011 boolean first = true;
....@@ -4629,6 +5065,7 @@
46295065 Grafreed.clipboard.get(0).parent = keepparent;
46305066 }
46315067
5068
+ Globals.REPLACEONMAKE = keep;
46325069 ResetModel();
46335070 refreshContents();
46345071 }
....@@ -4764,6 +5201,10 @@
47645201
47655202 void group(Object3D csg, boolean grab)
47665203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
47675208 if (//false) // why??
47685209 !group.selection.isEmpty())
47695210 {
....@@ -4877,10 +5318,15 @@
48775318 //node.add(csg);
48785319 //makeSomething(node);
48795320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
48805322 }
48815323
48825324 void Ungroup(Object3D g)
48835325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
48845330 if (g instanceof HiddenObject)
48855331 {
48865332 HiddenObject h = (HiddenObject) g;
....@@ -4897,6 +5343,7 @@
48975343 objEditor.makeSomething(g.get(i), false);
48985344 }
48995345 }
5346
+ Globals.REPLACEONMAKE = keep;
49005347 }
49015348
49025349 void ungroup()
....@@ -5185,10 +5632,28 @@
51855632 cButton clearpanelButton;
51865633 cButton unselectButton;
51875634
5635
+ cButton restoreCameraButton;
5636
+
51885637 cButton saveButton;
5189
- cButton undoButton;
5190
- cButton redoButton;
51915638 cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
51925657
51935658 cButton screenfitButton;
51945659 cButton screenfitpointButton;
....@@ -5201,14 +5666,6 @@
52015666
52025667 cButton setsupportButton;
52035668
5204
- cButton twoButton;
5205
- cButton sixButton;
5206
- cButton threeButton;
5207
- cButton sevenButton;
5208
- cButton fourButton; // full panel
5209
- cButton oneButton; // full XYZ
5210
- //cButton currentLayout;
5211
-
52125669 //
52135670 //Composite
52145671 Object3D // to do !!
....@@ -5218,11 +5675,11 @@
52185675 //JTree jTree;
52195676 private MenuItem lookAtItem;
52205677 private MenuItem lookFromItem;
5221
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
52225679 private MenuItem cutItem;
52235680 private MenuItem undoItem;
52245681 private MenuItem redoItem;
5225
- private MenuItem duplicateItem;
5682
+ private JMenuItem duplicateItem;
52265683 private MenuItem cloneItem;
52275684 private MenuItem cloneSupportItem;
52285685 private MenuItem overwriteGeoItem;
....@@ -5250,7 +5707,7 @@
52505707 private MenuItem pasteLinkItem;
52515708 private MenuItem pasteCloneItem;
52525709 private MenuItem pasteExpandItem;
5253
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
52545711 private MenuItem clearAllItem;
52555712 private MenuItem genUVItem;
52565713 private MenuItem genNormalsMESHItem;
....@@ -5285,6 +5742,10 @@
52855742 private MenuItem showleavesItem;
52865743 private MenuItem markleavesItem;
52875744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
52885749
52895750 private MenuItem flipVItem;
52905751 private MenuItem unflipVItem;
....@@ -5306,7 +5767,7 @@
53065767 private MenuItem frontItem;
53075768 private MenuItem cameraItem;
53085769 private MenuItem compositeItem;
5309
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
53105771 private MenuItem physicsItem;
53115772 private MenuItem frameselectorItem;
53125773 private MenuItem scriptNodeItem;
....@@ -5380,5 +5841,5 @@
53805841
53815842 Menu cameraMenu;
53825843 MenuItem editCameraItem;
5383
- MenuItem revertCameraItem;
5844
+ MenuItem restoreCameraItem;
53845845 }