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);
....@@ -187,8 +206,8 @@
187206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188207 // pasteExpandItem.addActionListener(this);
189208 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
192211
193212 if (Globals.ADVANCED)
194213 {
....@@ -202,23 +221,23 @@
202221 //zBufferItem.addActionListener(this);
203222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204223 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
207226
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212239
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222241 toggleHandleItem.addItemListener(this);
223242 toggleHandleItem.setState(CameraPane.HANDLES);
224243
....@@ -273,7 +292,7 @@
273292 {
274293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278297 oe.cameraMenu.add("-");
279298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +300,7 @@
281300 editLeafItem.addActionListener(this);
282301 lookAtItem.addActionListener(this);
283302 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
285304 }
286305
287306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +345,29 @@
326345 }
327346
328347 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
331350 backItem = menu.add(new MenuItem("Back"));
332351 backItem.addActionListener(this);
333352 frontItem = menu.add(new MenuItem("Front"));
334353 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
337359 hideItem = menu.add(new MenuItem("Hidden Group"));
338360 hideItem.addActionListener(this);
361
+ }
339362 ungroupItem = menu.add(new MenuItem("Ungroup"));
340363 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
344371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345372 switchGeoItem.addActionListener(this);
346373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +375,6 @@
348375 morphItem = menu.add(new MenuItem("Morph Group"));
349376 morphItem.addActionListener(this);
350377
351
- if (Globals.ADVANCED)
352
- {
353378 menu.add("-");
354379 physicsItem = menu.add(new MenuItem("Physics"));
355380 physicsItem.addActionListener(this);
....@@ -357,13 +382,11 @@
357382 frameselectorItem.addActionListener(this);
358383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359384 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362385 }
363386
364387 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
367390 billboardItem = menu.add(new MenuItem("Billboard"));
368391 billboardItem.addActionListener(this);
369392 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +397,14 @@
374397 shadowYItem.addActionListener(this);
375398 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
377403 if (Globals.ADVANCED)
378404 {
379405 menu.add("-");
380406 linkerItem = menu.add(new MenuItem("Linker"));
381407 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384408 templateItem = menu.add(new MenuItem("Template"));
385409 templateItem.addActionListener(this);
386410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +433,7 @@
409433 genNormalsMESHItem.addActionListener(this);
410434 if (Globals.ADVANCED)
411435 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413437 genNormalsMINEItem.addActionListener(this);
414438 }
415439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -532,6 +556,7 @@
532556 buildToolsMenu(menu);
533557 }
534558
559
+
535560 void SetupUI2(ObjEditor oe)
536561 {
537562 // June 2019
....@@ -574,51 +599,79 @@
574599 oe.radioPanel.add(dummyButton);
575600 oe.buttonGroup.add(dummyButton);
576601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
577606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578607
579608 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580609 //minButton.setToolTipText("Minimize window");
581610 //minButton.addActionListener(this);
582611
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
586618
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588620 fullButton.setToolTipText("Full-screen window");
589621 fullButton.addActionListener(this);
590622
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
594630
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
601633 saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
602639
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604659 liveCB.setToolTipText("Enable animation");
605660 liveCB.addItemListener(this);
606661
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608663 oneStepButton.setToolTipText("Animate one step forward");
609664 oneStepButton.addActionListener(this);
610665
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612667 fastCB.setToolTipText("Fast mode");
613668 fastCB.addItemListener(this);
614669
615
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
622675
623676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624677 // screenfitpointButton.addActionListener(this);
....@@ -630,49 +683,127 @@
630683 snapobjectButton.setToolTipText("Snap Object");
631684 }
632685
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
636687
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638
-
639
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640
- twoButton.setToolTipText("Show center view only");
641
- twoButton.addActionListener(this);
642688 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643689 fourButton.addActionListener(this);
644690 fourButton.setToolTipText("Show left panel only");
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
+
645697 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- sixButton.setToolTipText("2-column layout left");
698
+ sixButton.setToolTipText("Show left and right");
647699 sixButton.addActionListener(this);
648
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
- threeButton.setToolTipText("2-column layout right");
650
- threeButton.addActionListener(this);
651
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- sevenButton.setToolTipText("3-column layout");
653
- 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);
654706 //
655707
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- 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");
658710 rootButton.addActionListener(this);
659711
660
- 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);
661713 closeButton.setToolTipText("Close tab");
662714 closeButton.addActionListener(this);
663715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664716 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
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
+ }
749
+
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");
668799 editButton.addActionListener(this);
669800
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
672803 uneditButton.addActionListener(this);
673804
674805 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
806
+ allParamsButton.setToolTipText("Show all controle");
676807 allParamsButton.addActionListener(this);
677808
678809 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +814,13 @@
683814 unselectButton.setToolTipText("Unselect");
684815 unselectButton.addActionListener(this);
685816
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
820
+
686821 editCommandsPanel.preferredHeight = 1;
687822
823
+ SetPinStates(false);
688824 // oe.treePanel.add(commandsPanel);
689825 // oe.treePanel.Return();
690826
....@@ -703,29 +839,17 @@
703839
704840 JScrollPane jSP;
705841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707843 ResetModel();
708844
709845 oe.treePanel.add(jSPPanel);
710846 oe.treePanel.Return();
711847
712
- cGridBag copyOptionsPanel = new cGridBag();
713
-
714
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
- colorCB.setToolTipText("Copy color when dropped");
716
- colorCB.addItemListener(this);
717
-
718
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
- materialCB.setToolTipText("Copy material when dropped");
720
- materialCB.addItemListener(this);
721
-
722
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
- textureCB.setToolTipText("Copy texture when dropped");
724
- textureCB.addItemListener(this);
725
-
726
- copyOptionsPanel.preferredHeight = 1;
727848 oe.treePanel.add(copyOptionsPanel);
728849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
729853
730854 // mainPanel.setDividerLocation(0.5); //1.0);
731855 // mainPanel.setResizeWeight(0.5);
....@@ -748,29 +872,49 @@
748872 dgr.addDragGestureListener(this);
749873 }catch(Exception e) {}
750874 */
751
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
752876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
753877 }
754878
755879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756880 {
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
+
757895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758896 boxCB.setToolTipText("Display bounding boxes");
759897 boxCB.addItemListener(this);
760898
761899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
763901 zoomBoxCB.addItemListener(this);
764902
765903 if (true) // Globals.ADVANCED)
766904 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- 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);
770912
771913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772914 // localCB.addItemListener(this);
773915
916
+ panel.Return();
917
+
774918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775919 crowdCB.setToolTipText("Used for crowds");
776920 crowdCB.addItemListener(this);
....@@ -787,6 +931,8 @@
787931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788932 // speakerMocapCB.addItemListener(this);
789933
934
+ panel.Return();
935
+
790936 if (false)
791937 {
792938 // handled in scripts
....@@ -801,20 +947,39 @@
801947 //constraints.gridy += 1;
802948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
804951 }
805952
806953 //constraints.gridx += 1;
807954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808955 // debugCB.addItemListener(this);
809956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
810961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
962
+ oeilCB.setToolTipText("Move camera when tracking");
812963 oeilCB.addItemListener(this);
813964
814965 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
966
+ shadowCB.setToolTipText("When live compute shadows");
816967 shadowCB.addItemListener(this);
817968
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();
818983 if (Globals.ADVANCED)
819984 {
820985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -825,10 +990,15 @@
825990 }
826991
827992 cGridBag fill = new cGridBag();
828
-
829993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
830998
831999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
8321002
8331003 }
8341004
....@@ -836,7 +1006,7 @@
8361006 {
8371007 cRadio radioButton = new cRadio(obj.name);
8381008
839
- // Patch to avoid bug with transparency.
1009
+ // June 2019. Patch to avoid bug with transparency.
8401010 radioButton.hadMaterial = obj.material != null;
8411011 if (!radioButton.hadMaterial)
8421012 {
....@@ -844,7 +1014,7 @@
8441014 }
8451015
8461016 radioButton.SetObject(obj);
847
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
8481018 radioButton.SetCamera(cameraView.renderCamera, false);
8491019 radioButton.addActionListener(this);
8501020 radioPanel.add(radioButton);
....@@ -864,25 +1034,28 @@
8641034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8651035 }
8661036
867
- JCheckBox liveCB;
868
- JCheckBox supportCB;
869
- JCheckBox localCB;
870
- JCheckBox crowdCB;
871
- JCheckBox smoothCB;
872
- JCheckBox fastCB;
873
- JCheckBox slowCB;
874
- JCheckBox boxCB;
875
- JCheckBox zoomBoxCB;
876
- JCheckBox trackCB;
877
- JCheckBox smoothfocusCB;
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;
8781050 // JCheckBox speakerMocapCB;
879
- JCheckBox speakerCameraCB;
880
- JCheckBox speakerFocusCB;
881
- JCheckBox debugCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
8821054
883
- JCheckBox oeilCB;
884
- JCheckBox shadowCB;
885
- JCheckBox lookAtCB;
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
8861059
8871060 // static int COLOR = 1;
8881061 // static int MATERIAL = 2;
....@@ -890,9 +1063,9 @@
8901063
8911064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8921065
893
- JCheckBox colorCB;
894
- JCheckBox materialCB;
895
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
8961069
8971070 public void itemStateChanged(ItemEvent e)
8981071 {
....@@ -989,6 +1162,14 @@
9891162 {
9901163 Globals.COMPUTESHADOWWHENLIVE ^= true;
9911164 }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
9921173 else if(e.getSource() == lookAtCB)
9931174 {
9941175 cameraView.ToggleLookAt();
....@@ -1005,7 +1186,8 @@
10051186
10061187 /**/
10071188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1008
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
10091191 if ((path == null) || (path.getPathCount() <= 1)) {
10101192 // We can't move the root node or an empty selection
10111193 return;
....@@ -1068,8 +1250,6 @@
10681250 }
10691251 }
10701252
1071
- String string = (String) object;
1072
-
10731253 System.out.println("Transfer = " + object + "; drop : " + target);
10741254 // if( object instanceof java.io.File[])
10751255 // {
....@@ -1077,6 +1257,8 @@
10771257 // objEditor.DropFile((java.io.File[]) object, true);
10781258 // return;
10791259 // }
1260
+
1261
+ String string = object.toString();
10801262
10811263 // File path for Mac and Windows
10821264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1122,23 +1304,33 @@
11221304
11231305 assert target == objEditor.jTree;
11241306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
11251308 try {
1126
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11271310 } catch (Exception e) {
11281311 System.out.println("destinationPath : " + destinationPath);
11291312 return;
11301313 }
11311314
1132
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
11331316 {
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
+// {
11341326 loadClipboard(true);
11351327 objEditor.jTree.setSelectionPath(destinationPath);
11361328 pasteInto(false, false);
1137
- } else {
1138
- loadClipboard(false);
1139
- objEditor.jTree.setSelectionPath(destinationPath);
1140
- pasteInto(false, false); // true); // ???
1141
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
11421334 }
11431335 public void dropActionChanged(DropTargetDragEvent dtde)
11441336 // Called if the user has modified the current drop gesture
....@@ -1243,22 +1435,30 @@
12431435 {
12441436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12451437 //heightFieldItem.addActionListener(this);
1246
- gridItem = menu.add(new MenuItem("Grid"));
1247
- gridItem.addActionListener(this);
1248
- rectoidItem = menu.add(new MenuItem("Box"));
1249
- rectoidItem.addActionListener(this);
1250
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1251
- ellipsoidItem.addActionListener(this);
1252
- coneItem = menu.add(new MenuItem("Cone"));
1253
- coneItem.addActionListener(this);
1254
- torusItem = menu.add(new MenuItem("Torus"));
1255
- torusItem.addActionListener(this);
1256
- superItem = menu.add(new MenuItem("Superellipsoid"));
1257
- superItem.addActionListener(this);
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
+ {
12581456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12591457 kleinItem.addActionListener(this);
1260
- particleItem = menu.add(new MenuItem("Particle system"));
1261
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
12621462 if (Globals.ADVANCED)
12631463 {
12641464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1284,15 +1484,15 @@
12841484 }
12851485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12861486 bezierItem.addActionListener(this);
1287
- overlayItem = menu.add(new MenuItem("Overlay"));
1288
- overlayItem.addActionListener(this);
1289
- lightItem = menu.add(new MenuItem("Light"));
1290
- lightItem.addActionListener(this);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
12911491 menu.add("-");
12921492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12931493 //superLoopItem.addActionListener(this);
1294
- loopItem = menu.add(new MenuItem("Loop"));
1295
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
12961496 doubleItem = menu.add(new MenuItem("Fork"));
12971497 doubleItem.addActionListener(this);
12981498 if (Globals.ADVANCED)
....@@ -1308,6 +1508,9 @@
13081508 animationItem.addItemListener(this);
13091509 animationItem.setState(Globals.ANIMATION);
13101510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
13111514 menu.add("-");
13121515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13131516 parseverticesItem.addActionListener(this);
....@@ -1320,6 +1523,8 @@
13201523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13211524 reduce34MorphItem.addActionListener(this);
13221525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
13231528 menu.add(computeAOItem = new MenuItem("Compute AO"));
13241529 computeAOItem.addActionListener(this);
13251530
....@@ -1328,8 +1533,6 @@
13281533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13291534 mirrorItem.addActionListener(this);
13301535 menu.add("-");
1331
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1332
- memoryItem.addActionListener(this);
13331536 menu.add(analyzeItem = new MenuItem("Analyze"));
13341537 analyzeItem.addActionListener(this);
13351538 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1477,6 +1680,30 @@
14771680
14781681 makeSomething(shadow);
14791682 }
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
+ }
14801707
14811708 /**
14821709 * applyExample
....@@ -1721,7 +1948,7 @@
17211948 {
17221949 ScreenFit();
17231950 } else
1724
- if (source == switchItem)
1951
+ if (source == switchViewItem)
17251952 {
17261953 cVector v1 = new cVector();
17271954 cVector v2 = new cVector();
....@@ -1730,11 +1957,11 @@
17301957 objEditor.cameraView.renderCamera.setAim(v2, v1);
17311958 objEditor.cameraView.repaint();
17321959 } else
1733
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
17341961 {
17351962 makeSomething(new Box());
17361963 } else
1737
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
17381965 {
17391966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17401967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1813,27 +2040,27 @@
18132040
18142041 makeSomething(obj);
18152042 } else
1816
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
18172044 {
18182045 makeSomething(new Grid());
18192046 } else
1820
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
18212048 {
18222049 makeSomething(new Sphere());
18232050 } else
1824
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
18252052 {
18262053 makeSomething(new Cone());
18272054 } else
1828
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
18292056 {
18302057 makeSomething(new Torus());
18312058 } else
1832
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
18332060 {
18342061 makeSomething(new Superellipsoid());
18352062 } else
1836
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
18372064 {
18382065 makeSomething(new Klein());
18392066 } else
....@@ -1853,7 +2080,7 @@
18532080 {
18542081 makeSomething(new BezierSurface());
18552082 } else
1856
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
18572084 {
18582085 /*
18592086 Object3D obj = new BezierSurface(5,8);
....@@ -1901,7 +2128,7 @@
19012128 s.setup();
19022129 makeSomething(s);
19032130 } else
1904
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
19052132 {
19062133 makeSomething(new Light());
19072134 } else
....@@ -1951,30 +2178,30 @@
19512178
19522179 group(g);
19532180 } else
1954
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
19552182 {
19562183 Composite csg = new GroupLeaf();
19572184 csg.count = 5;
19582185 group(csg);
1959
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
19602187 csg.addChild(child);
19612188 child.addChild(csg);
19622189 } else
19632190 if (source == doubleItem)
19642191 {
1965
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
19662193 csg.count = 5;
19672194 group(csg);
1968
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
19692196 csg.addChild(child);
19702197 child.addChild(csg);
1971
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
19722199 csg.addChild(child);
19732200 child.addChild(csg);
19742201 } else
19752202 if (source == tripleItem)
19762203 {
1977
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
19782205 csg.count = 4;
19792206 group(csg);
19802207 Composite child = new cGroup();
....@@ -2038,15 +2265,31 @@
20382265 } else
20392266 if (source == undoButton)
20402267 {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20412271 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();
20422282 } else
20432283 if (source == redoButton)
20442284 {
2285
+ // Go to next version
20452286 Redo();
20462287 } else
20472288 if (source == saveButton)
20482289 {
2049
- Save();
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
20502293 } else
20512294 if (source == oneStepButton)
20522295 {
....@@ -2055,17 +2298,14 @@
20552298 } else
20562299 if (source == screenfitButton)
20572300 {
2058
- //Reload(lastConverter, lastFilename, true);
20592301 ScreenFit();
20602302 } else
20612303 if (source == screenfitpointButton)
20622304 {
2063
- //Reload(lastConverter, lastFilename, true);
20642305 ScreenFitPoint();
20652306 } else
20662307 if (source == snapobjectButton)
20672308 {
2068
- //Reload(lastConverter, lastFilename, true);
20692309 SnapObject();
20702310 } else
20712311 // if (event.getSource() == recompileButton)
....@@ -2429,7 +2669,7 @@
24292669 {
24302670 StepAll();
24312671 } else
2432
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
24332673 {
24342674 //int indices[] = jList.getSelectedIndices();
24352675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2441,9 +2681,9 @@
24412681 {
24422682 ClearSelection(true);
24432683 } else
2444
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
24452685 {
2446
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
24472687 } else
24482688 if (source == hideItem)
24492689 {
....@@ -2461,11 +2701,11 @@
24612701 {
24622702 makeSomething(new Camera());
24632703 } else
2464
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
24652705 {
24662706 group(new Composite());
24672707 } else
2468
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
24692709 {
24702710 RandomNode random = new RandomNode();
24712711 group(random);
....@@ -2567,7 +2807,7 @@
25672807 {
25682808 group(new cLinker());
25692809 } else
2570
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
25712811 {
25722812 group(new TextureNode());
25732813 } else
....@@ -2587,17 +2827,30 @@
25872827 {
25882828 CastShadow(2);
25892829 } else
2590
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
25912831 {
2592
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
25932834 for (int i=0; i<group.selection.size(); i++)
25942835 {
2595
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
25962841 }
25972842
2598
- ClearSelection(false);
2599
-
2600
- 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
+ }
26012854 } else
26022855 if (source == genUVItem)
26032856 {
....@@ -2925,6 +3178,10 @@
29253178 if (source == twoButton)
29263179 {
29273180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
29283185 // bug
29293186 //gridPanel.setDividerLocation(1.0);
29303187 //bigPanel.setDividerLocation(0.0);
....@@ -2980,6 +3237,9 @@
29803237 {
29813238 radio.layout = threeButton;
29823239
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
3242
+
29833243 // bigThree.remove(scenePanel);
29843244 // bigThree.remove(centralPanel);
29853245 // bigThree.remove(XYZPanel);
....@@ -3018,6 +3278,9 @@
30183278 {
30193279 radio.layout = fourButton;
30203280
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
3283
+
30213284 // bigThree.remove(scenePanel);
30223285 // bigThree.remove(centralPanel);
30233286 // bigThree.remove(XYZPanel);
....@@ -3054,6 +3317,9 @@
30543317 if (source == sixButton)
30553318 {
30563319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
30573323
30583324 // bigThree.remove(scenePanel);
30593325 // bigThree.remove(centralPanel);
....@@ -3092,6 +3358,9 @@
30923358 if (source == sevenButton)
30933359 {
30943360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
30953364
30963365 // bigThree.remove(scenePanel);
30973366 // bigThree.remove(centralPanel);
....@@ -3159,7 +3428,8 @@
31593428 buttonGroup.remove(ab);
31603429 radioPanel.remove(ab);
31613430
3162
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
31633433 // ab.GetObject().objectUI = null; // ?????????
31643434
31653435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3172,6 +3442,12 @@
31723442 } else
31733443 if (source == editItem || source == editButton)
31743444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
31753451 EditSelection(false);
31763452 } else
31773453 if (source == uneditButton)
....@@ -3181,6 +3457,7 @@
31813457 Object3D child = (Object3D)e.nextElement();
31823458 if(child.editWindow != null)
31833459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
31843461 child.CloseUI();
31853462 listUI.remove(child);
31863463
....@@ -3197,6 +3474,7 @@
31973474 //copy.ClearUI();
31983475 for (Object3D obj : listUI)
31993476 {
3477
+ obj.pinned = false;
32003478 obj.CloseUI();
32013479 }
32023480 listUI.clear();
....@@ -3206,7 +3484,7 @@
32063484 {
32073485 assert(copy == group);
32083486
3209
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32103488
32113489 for (Object3D obj : listUI)
32123490 {
....@@ -3255,6 +3533,9 @@
32553533 }
32563534
32573535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
32583539 //Globals.theRenderer.object = group;
32593540 if(!useclient)
32603541 {
....@@ -3273,6 +3554,7 @@
32733554
32743555 // fix "+" issue
32753556 //group.editWindow = this;
3557
+ group.manipWindow = this;
32763558
32773559 /*
32783560 currentLayout = radio.layout;
....@@ -3280,6 +3562,13 @@
32803562 currentLayout = sevenButton;
32813563 */
32823564 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);
32833572 keepparent = group.parent;
32843573 // PARENT = NULL or not???
32853574 //group.parent = null; // ROOT
....@@ -3293,7 +3582,7 @@
32933582 cameraView.ProtectCamera();
32943583 cameraView.repaint();
32953584 return;
3296
- } else if (event.getSource() == revertCameraItem)
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32973586 {
32983587 cameraView.RevertCamera();
32993588 cameraView.repaint();
....@@ -4347,28 +4636,25 @@
43474636 // }
43484637 // }
43494638
4350
- static boolean allparams = true;
4351
-
4352
- static Vector<Object3D> listUI = new Vector<Object3D>();
4353
-
43544639 void EditSelection(boolean newWindow)
43554640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
43564647 // aConstraints.gridy = 0;
43574648 for (int i=0; i<group.selection.size(); i++)
43584649 {
43594650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43604651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4361
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43624653
43634654 Object3D elem = (Object3D)group.selection.elementAt(i);
43644655 if(elem != group || !newWindow)
43654656 {
4366
- // if (!(elem instanceof Composite))
4367
- // newWindow = false;
4368
- listUI.add(elem);
4369
- elem.openEditWindow(this, newWindow); //, false);
4370
- System.out.println("edit : " + elem);
4371
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
43724658 }
43734659 }
43744660 }
....@@ -4443,7 +4729,8 @@
44434729 //new Exception().printStackTrace();
44444730
44454731 freezemodel = true;
4446
-
4732
+ ClearUnpinned();
4733
+
44474734 /**/
44484735 //switch (event.id)
44494736 {
....@@ -4476,7 +4763,7 @@
44764763 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44774764 // a camera
44784765 {
4479
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44804767 {
44814768 CameraPane.camerachangeframe = 0; // don't refuse it
44824769 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4485,6 +4772,13 @@
44854772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44864773 }
44874774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
44884782 refreshContents();
44894783 //return true;
44904784 }
....@@ -4494,9 +4788,18 @@
44944788 freezemodel = false;
44954789 }
44964790
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
44974799 void refreshContents(boolean cp)
44984800 {
4499
- if (!Globals.MOUSEDRAGGED)
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45004803 {
45014804 objEditor.ClearInfo(); // .GetMaterial());
45024805
....@@ -4595,7 +4898,8 @@
45954898
45964899 if (cut)
45974900 {
4598
- Save();
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
45994903 //int indices[] = jList.getSelectedIndices();
46004904 //for (int i = indices.length - 1; i >= 0; i--)
46014905 //jList.remove(indices[i]);
....@@ -4698,6 +5002,10 @@
46985002
46995003 void paste(boolean expand)
47005004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
47015009 // if (GrafreeD.clipboard == null)
47025010 // return;
47035011 boolean first = true;
....@@ -4757,6 +5065,7 @@
47575065 Grafreed.clipboard.get(0).parent = keepparent;
47585066 }
47595067
5068
+ Globals.REPLACEONMAKE = keep;
47605069 ResetModel();
47615070 refreshContents();
47625071 }
....@@ -4892,6 +5201,10 @@
48925201
48935202 void group(Object3D csg, boolean grab)
48945203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
48955208 if (//false) // why??
48965209 !group.selection.isEmpty())
48975210 {
....@@ -5005,10 +5318,15 @@
50055318 //node.add(csg);
50065319 //makeSomething(node);
50075320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
50085322 }
50095323
50105324 void Ungroup(Object3D g)
50115325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
50125330 if (g instanceof HiddenObject)
50135331 {
50145332 HiddenObject h = (HiddenObject) g;
....@@ -5025,6 +5343,7 @@
50255343 objEditor.makeSomething(g.get(i), false);
50265344 }
50275345 }
5346
+ Globals.REPLACEONMAKE = keep;
50285347 }
50295348
50305349 void ungroup()
....@@ -5313,13 +5632,28 @@
53135632 cButton clearpanelButton;
53145633 cButton unselectButton;
53155634
5316
- cButton minButton;
5317
- cButton maxButton;
5318
- cButton fullButton;
5319
- cButton undoButton;
5320
- cButton redoButton;
5635
+ cButton restoreCameraButton;
5636
+
53215637 cButton saveButton;
53225638 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;
53235657
53245658 cButton screenfitButton;
53255659 cButton screenfitpointButton;
....@@ -5341,11 +5675,11 @@
53415675 //JTree jTree;
53425676 private MenuItem lookAtItem;
53435677 private MenuItem lookFromItem;
5344
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
53455679 private MenuItem cutItem;
53465680 private MenuItem undoItem;
53475681 private MenuItem redoItem;
5348
- private MenuItem duplicateItem;
5682
+ private JMenuItem duplicateItem;
53495683 private MenuItem cloneItem;
53505684 private MenuItem cloneSupportItem;
53515685 private MenuItem overwriteGeoItem;
....@@ -5373,7 +5707,7 @@
53735707 private MenuItem pasteLinkItem;
53745708 private MenuItem pasteCloneItem;
53755709 private MenuItem pasteExpandItem;
5376
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
53775711 private MenuItem clearAllItem;
53785712 private MenuItem genUVItem;
53795713 private MenuItem genNormalsMESHItem;
....@@ -5433,7 +5767,7 @@
54335767 private MenuItem frontItem;
54345768 private MenuItem cameraItem;
54355769 private MenuItem compositeItem;
5436
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
54375771 private MenuItem physicsItem;
54385772 private MenuItem frameselectorItem;
54395773 private MenuItem scriptNodeItem;
....@@ -5507,5 +5841,5 @@
55075841
55085842 Menu cameraMenu;
55095843 MenuItem editCameraItem;
5510
- MenuItem revertCameraItem;
5844
+ MenuItem restoreCameraItem;
55115845 }