Normand Briere
2019-07-21 40f408aaee14abd85d391008b4d22977dc586b50
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 = GetButton("icons/add-128.png", !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
587621 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 = GetButton("icons/undo.png", !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 = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !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 = GetCheckBox("icons/run.png", 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(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
608
- fastCB.setToolTipText("Fast mode");
609
- fastCB.addItemListener(this);
610
-
611664 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612665 oneStepButton.setToolTipText("Animate one step forward");
613666 oneStepButton.addActionListener(this);
614667
615
- oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
669
+ fastCB.setToolTipText("Fast mode");
670
+ fastCB.addItemListener(this);
671
+
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 = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Highlight 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,24 +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
818
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
- autosaveCB.setToolTipText("Auto-save on structure change");
820
- autosaveCB.addItemListener(this);
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);
821983
984
+ panel.Return();
822985 if (Globals.ADVANCED)
823986 {
824987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -829,10 +992,15 @@
829992 }
830993
831994 cGridBag fill = new cGridBag();
832
-
833995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
8341000
8351001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
8361004
8371005 }
8381006
....@@ -840,7 +1008,7 @@
8401008 {
8411009 cRadio radioButton = new cRadio(obj.name);
8421010
843
- // Patch to avoid bug with transparency.
1011
+ // June 2019. Patch to avoid bug with transparency.
8441012 radioButton.hadMaterial = obj.material != null;
8451013 if (!radioButton.hadMaterial)
8461014 {
....@@ -848,7 +1016,7 @@
8481016 }
8491017
8501018 radioButton.SetObject(obj);
851
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
8521020 radioButton.SetCamera(cameraView.renderCamera, false);
8531021 radioButton.addActionListener(this);
8541022 radioPanel.add(radioButton);
....@@ -868,15 +1036,17 @@
8681036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8691037 }
8701038
871
- cCheckBox liveCB;
1039
+ cToggleButton liveCB;
8721040 cCheckBox supportCB;
8731041 cCheckBox localCB;
8741042 cCheckBox crowdCB;
8751043 cCheckBox smoothCB;
876
- cCheckBox fastCB;
1044
+ cToggleButton fastCB;
8771045 cCheckBox slowCB;
8781046 cCheckBox boxCB;
8791047 cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
8801050 cCheckBox trackCB;
8811051 cCheckBox smoothfocusCB;
8821052 // JCheckBox speakerMocapCB;
....@@ -886,7 +1056,7 @@
8861056
8871057 cCheckBox oeilCB;
8881058 cCheckBox shadowCB;
889
- cCheckBox autosaveCB;
1059
+ cCheckBox autokeepCB;
8901060 cCheckBox lookAtCB;
8911061
8921062 // static int COLOR = 1;
....@@ -994,9 +1164,13 @@
9941164 {
9951165 Globals.COMPUTESHADOWWHENLIVE ^= true;
9961166 }
997
- else if(e.getSource() == autosaveCB)
1167
+ else if(e.getSource() == freezeCB)
9981168 {
999
- Globals.SAVEONMAKE ^= true;
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
10001174 }
10011175 else if(e.getSource() == lookAtCB)
10021176 {
....@@ -1014,7 +1188,8 @@
10141188
10151189 /**/
10161190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1017
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
10181193 if ((path == null) || (path.getPathCount() <= 1)) {
10191194 // We can't move the root node or an empty selection
10201195 return;
....@@ -1077,8 +1252,6 @@
10771252 }
10781253 }
10791254
1080
- String string = (String) object;
1081
-
10821255 System.out.println("Transfer = " + object + "; drop : " + target);
10831256 // if( object instanceof java.io.File[])
10841257 // {
....@@ -1086,6 +1259,8 @@
10861259 // objEditor.DropFile((java.io.File[]) object, true);
10871260 // return;
10881261 // }
1262
+
1263
+ String string = object.toString();
10891264
10901265 // File path for Mac and Windows
10911266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1131,23 +1306,33 @@
11311306
11321307 assert target == objEditor.jTree;
11331308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
11341310 try {
1135
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11361312 } catch (Exception e) {
11371313 System.out.println("destinationPath : " + destinationPath);
11381314 return;
11391315 }
11401316
1141
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
11421318 {
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
+// {
11431328 loadClipboard(true);
11441329 objEditor.jTree.setSelectionPath(destinationPath);
11451330 pasteInto(false, false);
1146
- } else {
1147
- loadClipboard(false);
1148
- objEditor.jTree.setSelectionPath(destinationPath);
1149
- pasteInto(false, false); // true); // ???
1150
- }
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
11511336 }
11521337 public void dropActionChanged(DropTargetDragEvent dtde)
11531338 // Called if the user has modified the current drop gesture
....@@ -1252,22 +1437,30 @@
12521437 {
12531438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12541439 //heightFieldItem.addActionListener(this);
1255
- gridItem = menu.add(new MenuItem("Grid"));
1256
- gridItem.addActionListener(this);
1257
- rectoidItem = menu.add(new MenuItem("Box"));
1258
- rectoidItem.addActionListener(this);
1259
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1260
- ellipsoidItem.addActionListener(this);
1261
- coneItem = menu.add(new MenuItem("Cone"));
1262
- coneItem.addActionListener(this);
1263
- torusItem = menu.add(new MenuItem("Torus"));
1264
- torusItem.addActionListener(this);
1265
- superItem = menu.add(new MenuItem("Superellipsoid"));
1266
- 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
+ {
12671458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12681459 kleinItem.addActionListener(this);
1269
- particleItem = menu.add(new MenuItem("Particle system"));
1270
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
12711464 if (Globals.ADVANCED)
12721465 {
12731466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1293,15 +1486,15 @@
12931486 }
12941487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12951488 bezierItem.addActionListener(this);
1296
- overlayItem = menu.add(new MenuItem("Overlay"));
1297
- overlayItem.addActionListener(this);
1298
- lightItem = menu.add(new MenuItem("Light"));
1299
- 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);
13001493 menu.add("-");
13011494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13021495 //superLoopItem.addActionListener(this);
1303
- loopItem = menu.add(new MenuItem("Loop"));
1304
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
13051498 doubleItem = menu.add(new MenuItem("Fork"));
13061499 doubleItem.addActionListener(this);
13071500 if (Globals.ADVANCED)
....@@ -1317,6 +1510,9 @@
13171510 animationItem.addItemListener(this);
13181511 animationItem.setState(Globals.ANIMATION);
13191512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
13201516 menu.add("-");
13211517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13221518 parseverticesItem.addActionListener(this);
....@@ -1329,6 +1525,8 @@
13291525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13301526 reduce34MorphItem.addActionListener(this);
13311527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
13321530 menu.add(computeAOItem = new MenuItem("Compute AO"));
13331531 computeAOItem.addActionListener(this);
13341532
....@@ -1337,8 +1535,6 @@
13371535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13381536 mirrorItem.addActionListener(this);
13391537 menu.add("-");
1340
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1341
- memoryItem.addActionListener(this);
13421538 menu.add(analyzeItem = new MenuItem("Analyze"));
13431539 analyzeItem.addActionListener(this);
13441540 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1486,6 +1682,30 @@
14861682
14871683 makeSomething(shadow);
14881684 }
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
+ }
14891709
14901710 /**
14911711 * applyExample
....@@ -1730,7 +1950,7 @@
17301950 {
17311951 ScreenFit();
17321952 } else
1733
- if (source == switchItem)
1953
+ if (source == switchViewItem)
17341954 {
17351955 cVector v1 = new cVector();
17361956 cVector v2 = new cVector();
....@@ -1739,11 +1959,11 @@
17391959 objEditor.cameraView.renderCamera.setAim(v2, v1);
17401960 objEditor.cameraView.repaint();
17411961 } else
1742
- if (source == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
17431963 {
17441964 makeSomething(new Box());
17451965 } else
1746
- if (source == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
17471967 {
17481968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17491969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1822,27 +2042,27 @@
18222042
18232043 makeSomething(obj);
18242044 } else
1825
- if (source == gridItem)
2045
+ if (source == gridItem || source == gridButton)
18262046 {
18272047 makeSomething(new Grid());
18282048 } else
1829
- if (source == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
18302050 {
18312051 makeSomething(new Sphere());
18322052 } else
1833
- if (source == coneItem)
2053
+ if (source == coneItem || source == coneButton)
18342054 {
18352055 makeSomething(new Cone());
18362056 } else
1837
- if (source == torusItem)
2057
+ if (source == torusItem || source == torusButton)
18382058 {
18392059 makeSomething(new Torus());
18402060 } else
1841
- if (source == superItem)
2061
+ if (source == superItem || source == superButton)
18422062 {
18432063 makeSomething(new Superellipsoid());
18442064 } else
1845
- if (source == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
18462066 {
18472067 makeSomething(new Klein());
18482068 } else
....@@ -1862,7 +2082,7 @@
18622082 {
18632083 makeSomething(new BezierSurface());
18642084 } else
1865
- if (source == overlayItem)
2085
+ if (source == overlayItem || source == overlayButton)
18662086 {
18672087 /*
18682088 Object3D obj = new BezierSurface(5,8);
....@@ -1910,7 +2130,7 @@
19102130 s.setup();
19112131 makeSomething(s);
19122132 } else
1913
- if (source == lightItem)
2133
+ if (source == lightItem || source == lightButton)
19142134 {
19152135 makeSomething(new Light());
19162136 } else
....@@ -1960,30 +2180,30 @@
19602180
19612181 group(g);
19622182 } else
1963
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
19642184 {
19652185 Composite csg = new GroupLeaf();
19662186 csg.count = 5;
19672187 group(csg);
1968
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
19692189 csg.addChild(child);
19702190 child.addChild(csg);
19712191 } else
19722192 if (source == doubleItem)
19732193 {
1974
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
19752195 csg.count = 5;
19762196 group(csg);
1977
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
19782198 csg.addChild(child);
19792199 child.addChild(csg);
1980
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
19812201 csg.addChild(child);
19822202 child.addChild(csg);
19832203 } else
19842204 if (source == tripleItem)
19852205 {
1986
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
19872207 csg.count = 4;
19882208 group(csg);
19892209 Composite child = new cGroup();
....@@ -2047,15 +2267,31 @@
20472267 } else
20482268 if (source == undoButton)
20492269 {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20502273 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();
20512284 } else
20522285 if (source == redoButton)
20532286 {
2287
+ // Go to next version
20542288 Redo();
20552289 } else
20562290 if (source == saveButton)
20572291 {
2058
- Save();
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
20592295 } else
20602296 if (source == oneStepButton)
20612297 {
....@@ -2064,17 +2300,14 @@
20642300 } else
20652301 if (source == screenfitButton)
20662302 {
2067
- //Reload(lastConverter, lastFilename, true);
20682303 ScreenFit();
20692304 } else
20702305 if (source == screenfitpointButton)
20712306 {
2072
- //Reload(lastConverter, lastFilename, true);
20732307 ScreenFitPoint();
20742308 } else
20752309 if (source == snapobjectButton)
20762310 {
2077
- //Reload(lastConverter, lastFilename, true);
20782311 SnapObject();
20792312 } else
20802313 // if (event.getSource() == recompileButton)
....@@ -2438,7 +2671,7 @@
24382671 {
24392672 StepAll();
24402673 } else
2441
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
24422675 {
24432676 //int indices[] = jList.getSelectedIndices();
24442677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2450,9 +2683,9 @@
24502683 {
24512684 ClearSelection(true);
24522685 } else
2453
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
24542687 {
2455
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
24562689 } else
24572690 if (source == hideItem)
24582691 {
....@@ -2470,11 +2703,11 @@
24702703 {
24712704 makeSomething(new Camera());
24722705 } else
2473
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
24742707 {
24752708 group(new Composite());
24762709 } else
2477
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
24782711 {
24792712 RandomNode random = new RandomNode();
24802713 group(random);
....@@ -2576,7 +2809,7 @@
25762809 {
25772810 group(new cLinker());
25782811 } else
2579
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
25802813 {
25812814 group(new TextureNode());
25822815 } else
....@@ -2596,17 +2829,30 @@
25962829 {
25972830 CastShadow(2);
25982831 } else
2599
- if (source == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
26002833 {
2601
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
26022836 for (int i=0; i<group.selection.size(); i++)
26032837 {
2604
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
26052843 }
26062844
2607
- ClearSelection(false);
2608
-
2609
- 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
+ }
26102856 } else
26112857 if (source == genUVItem)
26122858 {
....@@ -2934,6 +3180,10 @@
29343180 if (source == twoButton)
29353181 {
29363182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
29373187 // bug
29383188 //gridPanel.setDividerLocation(1.0);
29393189 //bigPanel.setDividerLocation(0.0);
....@@ -2989,6 +3239,9 @@
29893239 {
29903240 radio.layout = threeButton;
29913241
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
3244
+
29923245 // bigThree.remove(scenePanel);
29933246 // bigThree.remove(centralPanel);
29943247 // bigThree.remove(XYZPanel);
....@@ -3027,6 +3280,9 @@
30273280 {
30283281 radio.layout = fourButton;
30293282
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
3285
+
30303286 // bigThree.remove(scenePanel);
30313287 // bigThree.remove(centralPanel);
30323288 // bigThree.remove(XYZPanel);
....@@ -3063,6 +3319,9 @@
30633319 if (source == sixButton)
30643320 {
30653321 radio.layout = sixButton;
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
30663325
30673326 // bigThree.remove(scenePanel);
30683327 // bigThree.remove(centralPanel);
....@@ -3101,6 +3360,9 @@
31013360 if (source == sevenButton)
31023361 {
31033362 radio.layout = sevenButton;
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
31043366
31053367 // bigThree.remove(scenePanel);
31063368 // bigThree.remove(centralPanel);
....@@ -3182,6 +3444,12 @@
31823444 } else
31833445 if (source == editItem || source == editButton)
31843446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
31853453 EditSelection(false);
31863454 } else
31873455 if (source == uneditButton)
....@@ -3191,6 +3459,7 @@
31913459 Object3D child = (Object3D)e.nextElement();
31923460 if(child.editWindow != null)
31933461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
31943463 child.CloseUI();
31953464 listUI.remove(child);
31963465
....@@ -3207,6 +3476,7 @@
32073476 //copy.ClearUI();
32083477 for (Object3D obj : listUI)
32093478 {
3479
+ obj.pinned = false;
32103480 obj.CloseUI();
32113481 }
32123482 listUI.clear();
....@@ -3216,7 +3486,7 @@
32163486 {
32173487 assert(copy == group);
32183488
3219
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32203490
32213491 for (Object3D obj : listUI)
32223492 {
....@@ -3265,6 +3535,9 @@
32653535 }
32663536
32673537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
32683541 //Globals.theRenderer.object = group;
32693542 if(!useclient)
32703543 {
....@@ -3291,6 +3564,13 @@
32913564 currentLayout = sevenButton;
32923565 */
32933566 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);
32943574 keepparent = group.parent;
32953575 // PARENT = NULL or not???
32963576 //group.parent = null; // ROOT
....@@ -3304,7 +3584,7 @@
33043584 cameraView.ProtectCamera();
33053585 cameraView.repaint();
33063586 return;
3307
- } else if (event.getSource() == revertCameraItem)
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33083588 {
33093589 cameraView.RevertCamera();
33103590 cameraView.repaint();
....@@ -3883,7 +4163,7 @@
38834163
38844164 try
38854165 {
3886
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4166
+ texturedata = Globals.theRenderer.GetTextureData(tex.pigmenttexture, pigment, false, node.texres);
38874167 }
38884168 catch (Exception e)
38894169 {
....@@ -4358,28 +4638,25 @@
43584638 // }
43594639 // }
43604640
4361
- static boolean allparams = true;
4362
-
4363
- static Vector<Object3D> listUI = new Vector<Object3D>();
4364
-
43654641 void EditSelection(boolean newWindow)
43664642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
43674649 // aConstraints.gridy = 0;
43684650 for (int i=0; i<group.selection.size(); i++)
43694651 {
43704652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43714653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4372
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43734655
43744656 Object3D elem = (Object3D)group.selection.elementAt(i);
43754657 if(elem != group || !newWindow)
43764658 {
4377
- // if (!(elem instanceof Composite))
4378
- // newWindow = false;
4379
- listUI.add(elem);
4380
- elem.openEditWindow(this, newWindow); //, false);
4381
- System.out.println("edit : " + elem);
4382
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
43834660 }
43844661 }
43854662 }
....@@ -4454,7 +4731,8 @@
44544731 //new Exception().printStackTrace();
44554732
44564733 freezemodel = true;
4457
-
4734
+ ClearUnpinned();
4735
+
44584736 /**/
44594737 //switch (event.id)
44604738 {
....@@ -4487,7 +4765,7 @@
44874765 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44884766 // a camera
44894767 {
4490
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44914769 {
44924770 CameraPane.camerachangeframe = 0; // don't refuse it
44934771 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4496,6 +4774,13 @@
44964774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44974775 }
44984776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
44994784 refreshContents();
45004785 //return true;
45014786 }
....@@ -4505,9 +4790,18 @@
45054790 freezemodel = false;
45064791 }
45074792
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
45084801 void refreshContents(boolean cp)
45094802 {
4510
- if (!Globals.MOUSEDRAGGED)
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45114805 {
45124806 objEditor.ClearInfo(); // .GetMaterial());
45134807
....@@ -4606,8 +4900,8 @@
46064900
46074901 if (cut)
46084902 {
4609
- if (Globals.SAVEONMAKE)
4610
- Save();
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
46114905 //int indices[] = jList.getSelectedIndices();
46124906 //for (int i = indices.length - 1; i >= 0; i--)
46134907 //jList.remove(indices[i]);
....@@ -4710,6 +5004,10 @@
47105004
47115005 void paste(boolean expand)
47125006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
47135011 // if (GrafreeD.clipboard == null)
47145012 // return;
47155013 boolean first = true;
....@@ -4769,6 +5067,7 @@
47695067 Grafreed.clipboard.get(0).parent = keepparent;
47705068 }
47715069
5070
+ Globals.REPLACEONMAKE = keep;
47725071 ResetModel();
47735072 refreshContents();
47745073 }
....@@ -4904,6 +5203,10 @@
49045203
49055204 void group(Object3D csg, boolean grab)
49065205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
49075210 if (//false) // why??
49085211 !group.selection.isEmpty())
49095212 {
....@@ -5017,10 +5320,15 @@
50175320 //node.add(csg);
50185321 //makeSomething(node);
50195322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
50205324 }
50215325
50225326 void Ungroup(Object3D g)
50235327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
50245332 if (g instanceof HiddenObject)
50255333 {
50265334 HiddenObject h = (HiddenObject) g;
....@@ -5037,6 +5345,7 @@
50375345 objEditor.makeSomething(g.get(i), false);
50385346 }
50395347 }
5348
+ Globals.REPLACEONMAKE = keep;
50405349 }
50415350
50425351 void ungroup()
....@@ -5325,13 +5634,28 @@
53255634 cButton clearpanelButton;
53265635 cButton unselectButton;
53275636
5328
- cButton minButton;
5329
- cButton maxButton;
5330
- cButton fullButton;
5331
- cButton undoButton;
5332
- cButton redoButton;
5637
+ cButton restoreCameraButton;
5638
+
53335639 cButton saveButton;
53345640 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;
53355659
53365660 cButton screenfitButton;
53375661 cButton screenfitpointButton;
....@@ -5353,11 +5677,11 @@
53535677 //JTree jTree;
53545678 private MenuItem lookAtItem;
53555679 private MenuItem lookFromItem;
5356
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
53575681 private MenuItem cutItem;
53585682 private MenuItem undoItem;
53595683 private MenuItem redoItem;
5360
- private MenuItem duplicateItem;
5684
+ private JMenuItem duplicateItem;
53615685 private MenuItem cloneItem;
53625686 private MenuItem cloneSupportItem;
53635687 private MenuItem overwriteGeoItem;
....@@ -5385,7 +5709,7 @@
53855709 private MenuItem pasteLinkItem;
53865710 private MenuItem pasteCloneItem;
53875711 private MenuItem pasteExpandItem;
5388
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
53895713 private MenuItem clearAllItem;
53905714 private MenuItem genUVItem;
53915715 private MenuItem genNormalsMESHItem;
....@@ -5445,7 +5769,7 @@
54455769 private MenuItem frontItem;
54465770 private MenuItem cameraItem;
54475771 private MenuItem compositeItem;
5448
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
54495773 private MenuItem physicsItem;
54505774 private MenuItem frameselectorItem;
54515775 private MenuItem scriptNodeItem;
....@@ -5519,5 +5843,5 @@
55195843
55205844 Menu cameraMenu;
55215845 MenuItem editCameraItem;
5522
- MenuItem revertCameraItem;
5846
+ MenuItem restoreCameraItem;
55235847 }