Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
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 }
....@@ -80,10 +86,22 @@
8086 SetupViews(objEditor);
8187
8288 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8397 }
8498
8599 void CloneSelection(boolean supports)
86100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
87105 // Object3D keep = GrafreeD.clipboard;
88106 //Object3D obj;
89107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +112,7 @@
94112
95113 makeSomething(clone, i==group.selection.size()-1);
96114 }
115
+ Globals.REPLACEONMAKE = keep;
97116 }
98117
99118 void CloneClipboard(boolean supports)
....@@ -150,6 +169,8 @@
150169
151170 void SetupMenu2(GroupEditor oe)
152171 {
172
+ oe.jTree = new cTree();
173
+
153174 Menu menu;
154175 oe.menuBar.add(menu = new Menu("Edit"));
155176 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +181,7 @@
160181 // redoItem = menu.add(new MenuItem("Redo"));
161182 // redoItem.addActionListener(this);
162183 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164185 duplicateItem.addActionListener(this);
165186 cloneItem = menu.add(new MenuItem("Clone"));
166187 cloneItem.addActionListener(this);
....@@ -187,8 +208,8 @@
187208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188209 // pasteExpandItem.addActionListener(this);
189210 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
192213
193214 if (Globals.ADVANCED)
194215 {
....@@ -202,23 +223,23 @@
202223 //zBufferItem.addActionListener(this);
203224 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204225 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
207228
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212241
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"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222243 toggleHandleItem.addItemListener(this);
223244 toggleHandleItem.setState(CameraPane.HANDLES);
224245
....@@ -273,7 +294,7 @@
273294 {
274295 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275296 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277298 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278299 oe.cameraMenu.add("-");
279300 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +302,7 @@
281302 editLeafItem.addActionListener(this);
282303 lookAtItem.addActionListener(this);
283304 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
305
+ //switchViewItem.addActionListener(this);
285306 }
286307
287308 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +347,29 @@
326347 }
327348
328349 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
331352 backItem = menu.add(new MenuItem("Back"));
332353 backItem.addActionListener(this);
333354 frontItem = menu.add(new MenuItem("Front"));
334355 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
337361 hideItem = menu.add(new MenuItem("Hidden Group"));
338362 hideItem.addActionListener(this);
363
+ }
339364 ungroupItem = menu.add(new MenuItem("Ungroup"));
340365 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
344373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345374 switchGeoItem.addActionListener(this);
346375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +377,6 @@
348377 morphItem = menu.add(new MenuItem("Morph Group"));
349378 morphItem.addActionListener(this);
350379
351
- if (Globals.ADVANCED)
352
- {
353380 menu.add("-");
354381 physicsItem = menu.add(new MenuItem("Physics"));
355382 physicsItem.addActionListener(this);
....@@ -357,13 +384,11 @@
357384 frameselectorItem.addActionListener(this);
358385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359386 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362387 }
363388
364389 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
367392 billboardItem = menu.add(new MenuItem("Billboard"));
368393 billboardItem.addActionListener(this);
369394 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +399,14 @@
374399 shadowYItem.addActionListener(this);
375400 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
377405 if (Globals.ADVANCED)
378406 {
379407 menu.add("-");
380408 linkerItem = menu.add(new MenuItem("Linker"));
381409 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384410 templateItem = menu.add(new MenuItem("Template"));
385411 templateItem.addActionListener(this);
386412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +435,7 @@
409435 genNormalsMESHItem.addActionListener(this);
410436 if (Globals.ADVANCED)
411437 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413439 genNormalsMINEItem.addActionListener(this);
414440 }
415441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -532,6 +558,7 @@
532558 buildToolsMenu(menu);
533559 }
534560
561
+
535562 void SetupUI2(ObjEditor oe)
536563 {
537564 // June 2019
....@@ -574,51 +601,79 @@
574601 oe.radioPanel.add(dummyButton);
575602 oe.buttonGroup.add(dummyButton);
576603 */
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
607
+
577608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578609
579610 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580611 //minButton.setToolTipText("Minimize window");
581612 //minButton.addActionListener(this);
582613
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
586620
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588622 fullButton.setToolTipText("Full-screen window");
589623 fullButton.addActionListener(this);
590624
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
594632
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");
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
601635 saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
602641
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604661 liveCB.setToolTipText("Enable animation");
605662 liveCB.addItemListener(this);
606663
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608665 oneStepButton.setToolTipText("Animate one step forward");
609666 oneStepButton.addActionListener(this);
610667
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612669 fastCB.setToolTipText("Fast mode");
613670 fastCB.addItemListener(this);
614671
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);
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
622677
623678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624679 // screenfitpointButton.addActionListener(this);
....@@ -630,49 +685,127 @@
630685 snapobjectButton.setToolTipText("Snap Object");
631686 }
632687
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
636689
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);
642690 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643691 fourButton.addActionListener(this);
644692 fourButton.setToolTipText("Show left panel only");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
645699 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- sixButton.setToolTipText("2-column layout left");
700
+ sixButton.setToolTipText("Show left and right");
647701 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);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
654708 //
655709
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- rootButton.setToolTipText("Edit selection in new tab");
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
658712 rootButton.addActionListener(this);
659713
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661715 closeButton.setToolTipText("Close tab");
662716 closeButton.addActionListener(this);
663717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664718 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
719
+
720
+ // INSERT
721
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
722
+ gridButton.setToolTipText("Create grid");
723
+ gridButton.addActionListener(this);
724
+
725
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
+ boxButton.setToolTipText("Create box");
727
+ boxButton.addActionListener(this);
728
+
729
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ sphereButton.setToolTipText("Create sphere");
731
+ sphereButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ coneButton.setToolTipText("Create cone");
735
+ coneButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ torusButton.setToolTipText("Create torus");
739
+ torusButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ superButton.setToolTipText("Create superellipsoid");
743
+ superButton.addActionListener(this);
744
+
745
+ if (Globals.ADVANCED)
746
+ {
747
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ kleinButton.setToolTipText("Create Klein bottle");
749
+ kleinButton.addActionListener(this);
750
+ }
751
+
752
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ particlesButton.setToolTipText("Create particle system");
754
+ particlesButton.addActionListener(this);
755
+
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
778
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
779
+ overlayButton.setToolTipText("Create overlay");
780
+ overlayButton.addActionListener(this);
781
+
782
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ lightButton.setToolTipText("Create light");
784
+ lightButton.addActionListener(this);
785
+
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
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
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
798
+ // EDIT panel
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
668801 editButton.addActionListener(this);
669802
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
672805 uneditButton.addActionListener(this);
673806
674807 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
808
+ allParamsButton.setToolTipText("Show all controle");
676809 allParamsButton.addActionListener(this);
677810
678811 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +816,13 @@
683816 unselectButton.setToolTipText("Unselect");
684817 unselectButton.addActionListener(this);
685818
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
822
+
686823 editCommandsPanel.preferredHeight = 1;
687824
825
+ SetPinStates(false);
688826 // oe.treePanel.add(commandsPanel);
689827 // oe.treePanel.Return();
690828
....@@ -703,29 +841,17 @@
703841
704842 JScrollPane jSP;
705843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707845 ResetModel();
708846
709847 oe.treePanel.add(jSPPanel);
710848 oe.treePanel.Return();
711849
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;
727850 oe.treePanel.add(copyOptionsPanel);
728851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
729855
730856 // mainPanel.setDividerLocation(0.5); //1.0);
731857 // mainPanel.setResizeWeight(0.5);
....@@ -748,29 +874,49 @@
748874 dgr.addDragGestureListener(this);
749875 }catch(Exception e) {}
750876 */
751
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
752878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
753879 }
754880
755881 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756882 {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
757897 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758898 boxCB.setToolTipText("Display bounding boxes");
759899 boxCB.addItemListener(this);
760900
761901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
763903 zoomBoxCB.addItemListener(this);
764904
765905 if (true) // Globals.ADVANCED)
766906 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
770914
771915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772916 // localCB.addItemListener(this);
773917
918
+ panel.Return();
919
+
774920 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775921 crowdCB.setToolTipText("Used for crowds");
776922 crowdCB.addItemListener(this);
....@@ -787,6 +933,8 @@
787933 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788934 // speakerMocapCB.addItemListener(this);
789935
936
+ panel.Return();
937
+
790938 if (false)
791939 {
792940 // handled in scripts
....@@ -801,20 +949,39 @@
801949 //constraints.gridy += 1;
802950 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803951 smoothfocusCB.addItemListener(this);
952
+ panel.Return();
804953 }
805954
806955 //constraints.gridx += 1;
807956 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808957 // debugCB.addItemListener(this);
809958
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
810963 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
964
+ oeilCB.setToolTipText("Move camera when tracking");
812965 oeilCB.addItemListener(this);
813966
814967 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
968
+ shadowCB.setToolTipText("When live compute shadows");
816969 shadowCB.addItemListener(this);
817970
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
818985 if (Globals.ADVANCED)
819986 {
820987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -825,10 +992,15 @@
825992 }
826993
827994 cGridBag fill = new cGridBag();
828
-
829995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
8301000
8311001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
8321004
8331005 }
8341006
....@@ -836,7 +1008,7 @@
8361008 {
8371009 cRadio radioButton = new cRadio(obj.name);
8381010
839
- // Patch to avoid bug with transparency.
1011
+ // June 2019. Patch to avoid bug with transparency.
8401012 radioButton.hadMaterial = obj.material != null;
8411013 if (!radioButton.hadMaterial)
8421014 {
....@@ -844,7 +1016,7 @@
8441016 }
8451017
8461018 radioButton.SetObject(obj);
847
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
8481020 radioButton.SetCamera(cameraView.renderCamera, false);
8491021 radioButton.addActionListener(this);
8501022 radioPanel.add(radioButton);
....@@ -864,25 +1036,28 @@
8641036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8651037 }
8661038
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;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
8781052 // JCheckBox speakerMocapCB;
879
- JCheckBox speakerCameraCB;
880
- JCheckBox speakerFocusCB;
881
- JCheckBox debugCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
8821056
883
- JCheckBox oeilCB;
884
- JCheckBox shadowCB;
885
- JCheckBox lookAtCB;
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
8861061
8871062 // static int COLOR = 1;
8881063 // static int MATERIAL = 2;
....@@ -890,9 +1065,9 @@
8901065
8911066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8921067
893
- JCheckBox colorCB;
894
- JCheckBox materialCB;
895
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
8961071
8971072 public void itemStateChanged(ItemEvent e)
8981073 {
....@@ -989,6 +1164,14 @@
9891164 {
9901165 Globals.COMPUTESHADOWWHENLIVE ^= true;
9911166 }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
9921175 else if(e.getSource() == lookAtCB)
9931176 {
9941177 cameraView.ToggleLookAt();
....@@ -1005,7 +1188,8 @@
10051188
10061189 /**/
10071190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1008
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
10091193 if ((path == null) || (path.getPathCount() <= 1)) {
10101194 // We can't move the root node or an empty selection
10111195 return;
....@@ -1068,8 +1252,6 @@
10681252 }
10691253 }
10701254
1071
- String string = (String) object;
1072
-
10731255 System.out.println("Transfer = " + object + "; drop : " + target);
10741256 // if( object instanceof java.io.File[])
10751257 // {
....@@ -1077,6 +1259,8 @@
10771259 // objEditor.DropFile((java.io.File[]) object, true);
10781260 // return;
10791261 // }
1262
+
1263
+ String string = object.toString();
10801264
10811265 // File path for Mac and Windows
10821266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1122,23 +1306,33 @@
11221306
11231307 assert target == objEditor.jTree;
11241308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
11251310 try {
1126
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11271312 } catch (Exception e) {
11281313 System.out.println("destinationPath : " + destinationPath);
11291314 return;
11301315 }
11311316
1132
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
11331318 {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
1326
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1327
+// {
11341328 loadClipboard(true);
11351329 objEditor.jTree.setSelectionPath(destinationPath);
11361330 pasteInto(false, false);
1137
- } else {
1138
- loadClipboard(false);
1139
- objEditor.jTree.setSelectionPath(destinationPath);
1140
- pasteInto(false, false); // true); // ???
1141
- }
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
11421336 }
11431337 public void dropActionChanged(DropTargetDragEvent dtde)
11441338 // Called if the user has modified the current drop gesture
....@@ -1243,22 +1437,30 @@
12431437 {
12441438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12451439 //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);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
12581458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12591459 kleinItem.addActionListener(this);
1260
- particleItem = menu.add(new MenuItem("Particle system"));
1261
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
12621464 if (Globals.ADVANCED)
12631465 {
12641466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1284,15 +1486,15 @@
12841486 }
12851487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12861488 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);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
12911493 menu.add("-");
12921494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12931495 //superLoopItem.addActionListener(this);
1294
- loopItem = menu.add(new MenuItem("Loop"));
1295
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
12961498 doubleItem = menu.add(new MenuItem("Fork"));
12971499 doubleItem.addActionListener(this);
12981500 if (Globals.ADVANCED)
....@@ -1308,6 +1510,9 @@
13081510 animationItem.addItemListener(this);
13091511 animationItem.setState(Globals.ANIMATION);
13101512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
13111516 menu.add("-");
13121517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13131518 parseverticesItem.addActionListener(this);
....@@ -1320,6 +1525,8 @@
13201525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13211526 reduce34MorphItem.addActionListener(this);
13221527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
13231530 menu.add(computeAOItem = new MenuItem("Compute AO"));
13241531 computeAOItem.addActionListener(this);
13251532
....@@ -1328,8 +1535,6 @@
13281535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13291536 mirrorItem.addActionListener(this);
13301537 menu.add("-");
1331
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1332
- memoryItem.addActionListener(this);
13331538 menu.add(analyzeItem = new MenuItem("Analyze"));
13341539 analyzeItem.addActionListener(this);
13351540 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1477,6 +1682,30 @@
14771682
14781683 makeSomething(shadow);
14791684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
14801709
14811710 /**
14821711 * applyExample
....@@ -1721,7 +1950,7 @@
17211950 {
17221951 ScreenFit();
17231952 } else
1724
- if (source == switchItem)
1953
+ if (source == switchViewItem)
17251954 {
17261955 cVector v1 = new cVector();
17271956 cVector v2 = new cVector();
....@@ -1730,11 +1959,11 @@
17301959 objEditor.cameraView.renderCamera.setAim(v2, v1);
17311960 objEditor.cameraView.repaint();
17321961 } else
1733
- if (source == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
17341963 {
17351964 makeSomething(new Box());
17361965 } else
1737
- if (source == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
17381967 {
17391968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17401969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1813,27 +2042,27 @@
18132042
18142043 makeSomething(obj);
18152044 } else
1816
- if (source == gridItem)
2045
+ if (source == gridItem || source == gridButton)
18172046 {
18182047 makeSomething(new Grid());
18192048 } else
1820
- if (source == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
18212050 {
18222051 makeSomething(new Sphere());
18232052 } else
1824
- if (source == coneItem)
2053
+ if (source == coneItem || source == coneButton)
18252054 {
18262055 makeSomething(new Cone());
18272056 } else
1828
- if (source == torusItem)
2057
+ if (source == torusItem || source == torusButton)
18292058 {
18302059 makeSomething(new Torus());
18312060 } else
1832
- if (source == superItem)
2061
+ if (source == superItem || source == superButton)
18332062 {
18342063 makeSomething(new Superellipsoid());
18352064 } else
1836
- if (source == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
18372066 {
18382067 makeSomething(new Klein());
18392068 } else
....@@ -1853,7 +2082,7 @@
18532082 {
18542083 makeSomething(new BezierSurface());
18552084 } else
1856
- if (source == overlayItem)
2085
+ if (source == overlayItem || source == overlayButton)
18572086 {
18582087 /*
18592088 Object3D obj = new BezierSurface(5,8);
....@@ -1901,7 +2130,7 @@
19012130 s.setup();
19022131 makeSomething(s);
19032132 } else
1904
- if (source == lightItem)
2133
+ if (source == lightItem || source == lightButton)
19052134 {
19062135 makeSomething(new Light());
19072136 } else
....@@ -1951,30 +2180,30 @@
19512180
19522181 group(g);
19532182 } else
1954
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
19552184 {
19562185 Composite csg = new GroupLeaf();
19572186 csg.count = 5;
19582187 group(csg);
1959
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
19602189 csg.addChild(child);
19612190 child.addChild(csg);
19622191 } else
19632192 if (source == doubleItem)
19642193 {
1965
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
19662195 csg.count = 5;
19672196 group(csg);
1968
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
19692198 csg.addChild(child);
19702199 child.addChild(csg);
1971
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
19722201 csg.addChild(child);
19732202 child.addChild(csg);
19742203 } else
19752204 if (source == tripleItem)
19762205 {
1977
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
19782207 csg.count = 4;
19792208 group(csg);
19802209 Composite child = new cGroup();
....@@ -2038,15 +2267,31 @@
20382267 } else
20392268 if (source == undoButton)
20402269 {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20412273 Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
20422284 } else
20432285 if (source == redoButton)
20442286 {
2287
+ // Go to next version
20452288 Redo();
20462289 } else
20472290 if (source == saveButton)
20482291 {
2049
- Save();
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
20502295 } else
20512296 if (source == oneStepButton)
20522297 {
....@@ -2055,17 +2300,14 @@
20552300 } else
20562301 if (source == screenfitButton)
20572302 {
2058
- //Reload(lastConverter, lastFilename, true);
20592303 ScreenFit();
20602304 } else
20612305 if (source == screenfitpointButton)
20622306 {
2063
- //Reload(lastConverter, lastFilename, true);
20642307 ScreenFitPoint();
20652308 } else
20662309 if (source == snapobjectButton)
20672310 {
2068
- //Reload(lastConverter, lastFilename, true);
20692311 SnapObject();
20702312 } else
20712313 // if (event.getSource() == recompileButton)
....@@ -2429,7 +2671,7 @@
24292671 {
24302672 StepAll();
24312673 } else
2432
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
24332675 {
24342676 //int indices[] = jList.getSelectedIndices();
24352677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2441,9 +2683,9 @@
24412683 {
24422684 ClearSelection(true);
24432685 } else
2444
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
24452687 {
2446
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
24472689 } else
24482690 if (source == hideItem)
24492691 {
....@@ -2461,11 +2703,11 @@
24612703 {
24622704 makeSomething(new Camera());
24632705 } else
2464
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
24652707 {
24662708 group(new Composite());
24672709 } else
2468
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
24692711 {
24702712 RandomNode random = new RandomNode();
24712713 group(random);
....@@ -2567,7 +2809,7 @@
25672809 {
25682810 group(new cLinker());
25692811 } else
2570
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
25712813 {
25722814 group(new TextureNode());
25732815 } else
....@@ -2587,17 +2829,30 @@
25872829 {
25882830 CastShadow(2);
25892831 } else
2590
- if (source == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
25912833 {
2592
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
25932836 for (int i=0; i<group.selection.size(); i++)
25942837 {
2595
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
25962843 }
25972844
2598
- ClearSelection(false);
2599
-
2600
- refreshContents();
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
26012856 } else
26022857 if (source == genUVItem)
26032858 {
....@@ -2925,6 +3180,10 @@
29253180 if (source == twoButton)
29263181 {
29273182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
29283187 // bug
29293188 //gridPanel.setDividerLocation(1.0);
29303189 //bigPanel.setDividerLocation(0.0);
....@@ -2980,6 +3239,9 @@
29803239 {
29813240 radio.layout = threeButton;
29823241
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
3244
+
29833245 // bigThree.remove(scenePanel);
29843246 // bigThree.remove(centralPanel);
29853247 // bigThree.remove(XYZPanel);
....@@ -3018,6 +3280,9 @@
30183280 {
30193281 radio.layout = fourButton;
30203282
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
3285
+
30213286 // bigThree.remove(scenePanel);
30223287 // bigThree.remove(centralPanel);
30233288 // bigThree.remove(XYZPanel);
....@@ -3054,6 +3319,9 @@
30543319 if (source == sixButton)
30553320 {
30563321 radio.layout = sixButton;
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
30573325
30583326 // bigThree.remove(scenePanel);
30593327 // bigThree.remove(centralPanel);
....@@ -3092,6 +3360,9 @@
30923360 if (source == sevenButton)
30933361 {
30943362 radio.layout = sevenButton;
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
30953366
30963367 // bigThree.remove(scenePanel);
30973368 // bigThree.remove(centralPanel);
....@@ -3159,7 +3430,8 @@
31593430 buttonGroup.remove(ab);
31603431 radioPanel.remove(ab);
31613432
3162
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
31633435 // ab.GetObject().objectUI = null; // ?????????
31643436
31653437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3172,6 +3444,12 @@
31723444 } else
31733445 if (source == editItem || source == editButton)
31743446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
31753453 EditSelection(false);
31763454 } else
31773455 if (source == uneditButton)
....@@ -3181,6 +3459,7 @@
31813459 Object3D child = (Object3D)e.nextElement();
31823460 if(child.editWindow != null)
31833461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
31843463 child.CloseUI();
31853464 listUI.remove(child);
31863465
....@@ -3197,6 +3476,7 @@
31973476 //copy.ClearUI();
31983477 for (Object3D obj : listUI)
31993478 {
3479
+ obj.pinned = false;
32003480 obj.CloseUI();
32013481 }
32023482 listUI.clear();
....@@ -3206,7 +3486,7 @@
32063486 {
32073487 assert(copy == group);
32083488
3209
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32103490
32113491 for (Object3D obj : listUI)
32123492 {
....@@ -3255,6 +3535,9 @@
32553535 }
32563536
32573537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
32583541 //Globals.theRenderer.object = group;
32593542 if(!useclient)
32603543 {
....@@ -3273,6 +3556,7 @@
32733556
32743557 // fix "+" issue
32753558 //group.editWindow = this;
3559
+ group.manipWindow = this;
32763560
32773561 /*
32783562 currentLayout = radio.layout;
....@@ -3280,6 +3564,13 @@
32803564 currentLayout = sevenButton;
32813565 */
32823566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
32833574 keepparent = group.parent;
32843575 // PARENT = NULL or not???
32853576 //group.parent = null; // ROOT
....@@ -3293,7 +3584,7 @@
32933584 cameraView.ProtectCamera();
32943585 cameraView.repaint();
32953586 return;
3296
- } else if (event.getSource() == revertCameraItem)
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32973588 {
32983589 cameraView.RevertCamera();
32993590 cameraView.repaint();
....@@ -4347,28 +4638,25 @@
43474638 // }
43484639 // }
43494640
4350
- static boolean allparams = true;
4351
-
4352
- static Vector<Object3D> listUI = new Vector<Object3D>();
4353
-
43544641 void EditSelection(boolean newWindow)
43554642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
43564649 // aConstraints.gridy = 0;
43574650 for (int i=0; i<group.selection.size(); i++)
43584651 {
43594652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43604653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4361
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43624655
43634656 Object3D elem = (Object3D)group.selection.elementAt(i);
43644657 if(elem != group || !newWindow)
43654658 {
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
4659
+ EditElement(elem, newWindow); // ? new
43724660 }
43734661 }
43744662 }
....@@ -4443,7 +4731,8 @@
44434731 //new Exception().printStackTrace();
44444732
44454733 freezemodel = true;
4446
-
4734
+ ClearUnpinned();
4735
+
44474736 /**/
44484737 //switch (event.id)
44494738 {
....@@ -4476,7 +4765,7 @@
44764765 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44774766 // a camera
44784767 {
4479
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44804769 {
44814770 CameraPane.camerachangeframe = 0; // don't refuse it
44824771 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4485,6 +4774,13 @@
44854774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44864775 }
44874776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
44884784 refreshContents();
44894785 //return true;
44904786 }
....@@ -4494,9 +4790,18 @@
44944790 freezemodel = false;
44954791 }
44964792
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
44974801 void refreshContents(boolean cp)
44984802 {
4499
- if (!Globals.MOUSEDRAGGED)
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45004805 {
45014806 objEditor.ClearInfo(); // .GetMaterial());
45024807
....@@ -4595,7 +4900,8 @@
45954900
45964901 if (cut)
45974902 {
4598
- Save();
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
45994905 //int indices[] = jList.getSelectedIndices();
46004906 //for (int i = indices.length - 1; i >= 0; i--)
46014907 //jList.remove(indices[i]);
....@@ -4698,6 +5004,10 @@
46985004
46995005 void paste(boolean expand)
47005006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
47015011 // if (GrafreeD.clipboard == null)
47025012 // return;
47035013 boolean first = true;
....@@ -4757,6 +5067,7 @@
47575067 Grafreed.clipboard.get(0).parent = keepparent;
47585068 }
47595069
5070
+ Globals.REPLACEONMAKE = keep;
47605071 ResetModel();
47615072 refreshContents();
47625073 }
....@@ -4892,6 +5203,10 @@
48925203
48935204 void group(Object3D csg, boolean grab)
48945205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
48955210 if (//false) // why??
48965211 !group.selection.isEmpty())
48975212 {
....@@ -5005,10 +5320,15 @@
50055320 //node.add(csg);
50065321 //makeSomething(node);
50075322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
50085324 }
50095325
50105326 void Ungroup(Object3D g)
50115327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
50125332 if (g instanceof HiddenObject)
50135333 {
50145334 HiddenObject h = (HiddenObject) g;
....@@ -5025,6 +5345,7 @@
50255345 objEditor.makeSomething(g.get(i), false);
50265346 }
50275347 }
5348
+ Globals.REPLACEONMAKE = keep;
50285349 }
50295350
50305351 void ungroup()
....@@ -5313,13 +5634,28 @@
53135634 cButton clearpanelButton;
53145635 cButton unselectButton;
53155636
5316
- cButton minButton;
5317
- cButton maxButton;
5318
- cButton fullButton;
5319
- cButton undoButton;
5320
- cButton redoButton;
5637
+ cButton restoreCameraButton;
5638
+
53215639 cButton saveButton;
53225640 cButton oneStepButton;
5641
+
5642
+ cButton groupButton;
5643
+ cButton ungroupButton;
5644
+ cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
5648
+
5649
+ cButton gridButton;
5650
+ cButton boxButton;
5651
+ cButton sphereButton;
5652
+ cButton coneButton;
5653
+ cButton torusButton;
5654
+ cButton superButton;
5655
+ cButton kleinButton;
5656
+ cButton particlesButton;
5657
+ cButton overlayButton;
5658
+ cButton lightButton;
53235659
53245660 cButton screenfitButton;
53255661 cButton screenfitpointButton;
....@@ -5341,11 +5677,11 @@
53415677 //JTree jTree;
53425678 private MenuItem lookAtItem;
53435679 private MenuItem lookFromItem;
5344
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
53455681 private MenuItem cutItem;
53465682 private MenuItem undoItem;
53475683 private MenuItem redoItem;
5348
- private MenuItem duplicateItem;
5684
+ private JMenuItem duplicateItem;
53495685 private MenuItem cloneItem;
53505686 private MenuItem cloneSupportItem;
53515687 private MenuItem overwriteGeoItem;
....@@ -5373,7 +5709,7 @@
53735709 private MenuItem pasteLinkItem;
53745710 private MenuItem pasteCloneItem;
53755711 private MenuItem pasteExpandItem;
5376
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
53775713 private MenuItem clearAllItem;
53785714 private MenuItem genUVItem;
53795715 private MenuItem genNormalsMESHItem;
....@@ -5433,7 +5769,7 @@
54335769 private MenuItem frontItem;
54345770 private MenuItem cameraItem;
54355771 private MenuItem compositeItem;
5436
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
54375773 private MenuItem physicsItem;
54385774 private MenuItem frameselectorItem;
54395775 private MenuItem scriptNodeItem;
....@@ -5507,5 +5843,5 @@
55075843
55085844 Menu cameraMenu;
55095845 MenuItem editCameraItem;
5510
- MenuItem revertCameraItem;
5846
+ MenuItem restoreCameraItem;
55115847 }