Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -74,6 +80,12 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
7789 SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +110,7 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
....@@ -150,6 +167,8 @@
150167
151168 void SetupMenu2(GroupEditor oe)
152169 {
170
+ oe.jTree = new cTree();
171
+
153172 Menu menu;
154173 oe.menuBar.add(menu = new Menu("Edit"));
155174 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +179,7 @@
160179 // redoItem = menu.add(new MenuItem("Redo"));
161180 // redoItem.addActionListener(this);
162181 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164183 duplicateItem.addActionListener(this);
165184 cloneItem = menu.add(new MenuItem("Clone"));
166185 cloneItem.addActionListener(this);
....@@ -187,8 +206,8 @@
187206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188207 // pasteExpandItem.addActionListener(this);
189208 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
192211
193212 if (Globals.ADVANCED)
194213 {
....@@ -202,23 +221,23 @@
202221 //zBufferItem.addActionListener(this);
203222 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204223 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
207226
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212239
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222241 toggleHandleItem.addItemListener(this);
223242 toggleHandleItem.setState(CameraPane.HANDLES);
224243
....@@ -273,7 +292,7 @@
273292 {
274293 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275294 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277296 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278297 oe.cameraMenu.add("-");
279298 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +300,7 @@
281300 editLeafItem.addActionListener(this);
282301 lookAtItem.addActionListener(this);
283302 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
303
+ //switchViewItem.addActionListener(this);
285304 }
286305
287306 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +345,29 @@
326345 }
327346
328347 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
331350 backItem = menu.add(new MenuItem("Back"));
332351 backItem.addActionListener(this);
333352 frontItem = menu.add(new MenuItem("Front"));
334353 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
337359 hideItem = menu.add(new MenuItem("Hidden Group"));
338360 hideItem.addActionListener(this);
361
+ }
339362 ungroupItem = menu.add(new MenuItem("Ungroup"));
340363 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
344371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345372 switchGeoItem.addActionListener(this);
346373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +375,6 @@
348375 morphItem = menu.add(new MenuItem("Morph Group"));
349376 morphItem.addActionListener(this);
350377
351
- if (Globals.ADVANCED)
352
- {
353378 menu.add("-");
354379 physicsItem = menu.add(new MenuItem("Physics"));
355380 physicsItem.addActionListener(this);
....@@ -357,13 +382,11 @@
357382 frameselectorItem.addActionListener(this);
358383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359384 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362385 }
363386
364387 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
367390 billboardItem = menu.add(new MenuItem("Billboard"));
368391 billboardItem.addActionListener(this);
369392 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +397,14 @@
374397 shadowYItem.addActionListener(this);
375398 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
377403 if (Globals.ADVANCED)
378404 {
379405 menu.add("-");
380406 linkerItem = menu.add(new MenuItem("Linker"));
381407 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384408 templateItem = menu.add(new MenuItem("Template"));
385409 templateItem.addActionListener(this);
386410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +433,7 @@
409433 genNormalsMESHItem.addActionListener(this);
410434 if (Globals.ADVANCED)
411435 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413437 genNormalsMINEItem.addActionListener(this);
414438 }
415439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -532,6 +556,7 @@
532556 buildToolsMenu(menu);
533557 }
534558
559
+
535560 void SetupUI2(ObjEditor oe)
536561 {
537562 // June 2019
....@@ -574,51 +599,79 @@
574599 oe.radioPanel.add(dummyButton);
575600 oe.buttonGroup.add(dummyButton);
576601 */
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
605
+
577606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578607
579608 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580609 //minButton.setToolTipText("Minimize window");
581610 //minButton.addActionListener(this);
582611
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
586618
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588620 fullButton.setToolTipText("Full-screen window");
589621 fullButton.addActionListener(this);
590622
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
594630
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
601633 saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
602639
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604659 liveCB.setToolTipText("Enable animation");
605660 liveCB.addItemListener(this);
606661
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608663 oneStepButton.setToolTipText("Animate one step forward");
609664 oneStepButton.addActionListener(this);
610665
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612667 fastCB.setToolTipText("Fast mode");
613668 fastCB.addItemListener(this);
614669
615
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
622675
623676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624677 // screenfitpointButton.addActionListener(this);
....@@ -630,49 +683,127 @@
630683 snapobjectButton.setToolTipText("Snap Object");
631684 }
632685
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
636687
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638
-
639
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640
- twoButton.setToolTipText("Show center view only");
641
- twoButton.addActionListener(this);
642688 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643689 fourButton.addActionListener(this);
644690 fourButton.setToolTipText("Show left panel only");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
645697 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- sixButton.setToolTipText("2-column layout left");
698
+ sixButton.setToolTipText("Show left and right");
647699 sixButton.addActionListener(this);
648
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
- threeButton.setToolTipText("2-column layout right");
650
- threeButton.addActionListener(this);
651
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- sevenButton.setToolTipText("3-column layout");
653
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
654706 //
655707
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- rootButton.setToolTipText("Edit selection in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
658710 rootButton.addActionListener(this);
659711
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661713 closeButton.setToolTipText("Close tab");
662714 closeButton.addActionListener(this);
663715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664716 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
717
+
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
749
+
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
668799 editButton.addActionListener(this);
669800
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
672803 uneditButton.addActionListener(this);
673804
674805 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
806
+ allParamsButton.setToolTipText("Show all controle");
676807 allParamsButton.addActionListener(this);
677808
678809 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +814,13 @@
683814 unselectButton.setToolTipText("Unselect");
684815 unselectButton.addActionListener(this);
685816
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
820
+
686821 editCommandsPanel.preferredHeight = 1;
687822
823
+ SetPinStates(false);
688824 // oe.treePanel.add(commandsPanel);
689825 // oe.treePanel.Return();
690826
....@@ -703,29 +839,17 @@
703839
704840 JScrollPane jSP;
705841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707843 ResetModel();
708844
709845 oe.treePanel.add(jSPPanel);
710846 oe.treePanel.Return();
711847
712
- cGridBag copyOptionsPanel = new cGridBag();
713
-
714
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
- colorCB.setToolTipText("Copy color when dropped");
716
- colorCB.addItemListener(this);
717
-
718
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
- materialCB.setToolTipText("Copy material when dropped");
720
- materialCB.addItemListener(this);
721
-
722
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
- textureCB.setToolTipText("Copy texture when dropped");
724
- textureCB.addItemListener(this);
725
-
726
- copyOptionsPanel.preferredHeight = 1;
727848 oe.treePanel.add(copyOptionsPanel);
728849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
729853
730854 // mainPanel.setDividerLocation(0.5); //1.0);
731855 // mainPanel.setResizeWeight(0.5);
....@@ -748,29 +872,49 @@
748872 dgr.addDragGestureListener(this);
749873 }catch(Exception e) {}
750874 */
751
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
752876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
753877 }
754878
755879 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756880 {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
757895 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758896 boxCB.setToolTipText("Display bounding boxes");
759897 boxCB.addItemListener(this);
760898
761899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
763901 zoomBoxCB.addItemListener(this);
764902
765903 if (true) // Globals.ADVANCED)
766904 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
770912
771913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772914 // localCB.addItemListener(this);
773915
916
+ panel.Return();
917
+
774918 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775919 crowdCB.setToolTipText("Used for crowds");
776920 crowdCB.addItemListener(this);
....@@ -787,6 +931,8 @@
787931 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788932 // speakerMocapCB.addItemListener(this);
789933
934
+ panel.Return();
935
+
790936 if (false)
791937 {
792938 // handled in scripts
....@@ -801,34 +947,74 @@
801947 //constraints.gridy += 1;
802948 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803949 smoothfocusCB.addItemListener(this);
950
+ panel.Return();
804951 }
805952
806953 //constraints.gridx += 1;
807954 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808955 // debugCB.addItemListener(this);
809956
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
810961 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
811963 oeilCB.addItemListener(this);
812964
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
813985 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
814986 lookAtCB.setToolTipText("Look-at target");
815987 lookAtCB.addItemListener(this);
988
+ }
816989
817990 }
818991
819992 cGridBag fill = new cGridBag();
820
-
821993 fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
822998
823999 panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
8241002
8251003 }
8261004
8271005 void EditObject(Object3D obj)
8281006 {
8291007 cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
8301016 radioButton.SetObject(obj);
831
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
8321018 radioButton.SetCamera(cameraView.renderCamera, false);
8331019 radioButton.addActionListener(this);
8341020 radioPanel.add(radioButton);
....@@ -848,23 +1034,28 @@
8481034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8491035 }
8501036
851
- JCheckBox liveCB;
852
- JCheckBox supportCB;
853
- JCheckBox localCB;
854
- JCheckBox crowdCB;
855
- JCheckBox smoothCB;
856
- JCheckBox fastCB;
857
- JCheckBox slowCB;
858
- JCheckBox boxCB;
859
- JCheckBox zoomBoxCB;
860
- JCheckBox trackCB;
861
- JCheckBox smoothfocusCB;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
8621050 // JCheckBox speakerMocapCB;
863
- JCheckBox speakerCameraCB;
864
- JCheckBox speakerFocusCB;
865
- JCheckBox debugCB;
866
- JCheckBox oeilCB;
867
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
8681059
8691060 // static int COLOR = 1;
8701061 // static int MATERIAL = 2;
....@@ -872,9 +1063,9 @@
8721063
8731064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8741065
875
- JCheckBox colorCB;
876
- JCheckBox materialCB;
877
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
8781069
8791070 public void itemStateChanged(ItemEvent e)
8801071 {
....@@ -967,6 +1158,18 @@
9671158 {
9681159 cameraView.ToggleOeil();
9691160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
9701173 else if(e.getSource() == lookAtCB)
9711174 {
9721175 cameraView.ToggleLookAt();
....@@ -983,7 +1186,8 @@
9831186
9841187 /**/
9851188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
986
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
9871191 if ((path == null) || (path.getPathCount() <= 1)) {
9881192 // We can't move the root node or an empty selection
9891193 return;
....@@ -1046,8 +1250,6 @@
10461250 }
10471251 }
10481252
1049
- String string = (String) object;
1050
-
10511253 System.out.println("Transfer = " + object + "; drop : " + target);
10521254 // if( object instanceof java.io.File[])
10531255 // {
....@@ -1055,6 +1257,8 @@
10551257 // objEditor.DropFile((java.io.File[]) object, true);
10561258 // return;
10571259 // }
1260
+
1261
+ String string = object.toString();
10581262
10591263 // File path for Mac and Windows
10601264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1100,23 +1304,33 @@
11001304
11011305 assert target == objEditor.jTree;
11021306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
11031308 try {
1104
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11051310 } catch (Exception e) {
11061311 System.out.println("destinationPath : " + destinationPath);
11071312 return;
11081313 }
11091314
1110
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
11111316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
11121326 loadClipboard(true);
11131327 objEditor.jTree.setSelectionPath(destinationPath);
11141328 pasteInto(false, false);
1115
- } else {
1116
- loadClipboard(false);
1117
- objEditor.jTree.setSelectionPath(destinationPath);
1118
- pasteInto(false, false); // true); // ???
1119
- }
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
11201334 }
11211335 public void dropActionChanged(DropTargetDragEvent dtde)
11221336 // Called if the user has modified the current drop gesture
....@@ -1221,22 +1435,30 @@
12211435 {
12221436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12231437 //heightFieldItem.addActionListener(this);
1224
- gridItem = menu.add(new MenuItem("Grid"));
1225
- gridItem.addActionListener(this);
1226
- rectoidItem = menu.add(new MenuItem("Box"));
1227
- rectoidItem.addActionListener(this);
1228
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1229
- ellipsoidItem.addActionListener(this);
1230
- coneItem = menu.add(new MenuItem("Cone"));
1231
- coneItem.addActionListener(this);
1232
- torusItem = menu.add(new MenuItem("Torus"));
1233
- torusItem.addActionListener(this);
1234
- superItem = menu.add(new MenuItem("Superellipsoid"));
1235
- superItem.addActionListener(this);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
12361456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12371457 kleinItem.addActionListener(this);
1238
- particleItem = menu.add(new MenuItem("Particle system"));
1239
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
12401462 if (Globals.ADVANCED)
12411463 {
12421464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1262,15 +1484,15 @@
12621484 }
12631485 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12641486 bezierItem.addActionListener(this);
1265
- overlayItem = menu.add(new MenuItem("Overlay"));
1266
- overlayItem.addActionListener(this);
1267
- lightItem = menu.add(new MenuItem("Light"));
1268
- lightItem.addActionListener(this);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
12691491 menu.add("-");
12701492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12711493 //superLoopItem.addActionListener(this);
1272
- loopItem = menu.add(new MenuItem("Loop"));
1273
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
12741496 doubleItem = menu.add(new MenuItem("Fork"));
12751497 doubleItem.addActionListener(this);
12761498 if (Globals.ADVANCED)
....@@ -1286,6 +1508,9 @@
12861508 animationItem.addItemListener(this);
12871509 animationItem.setState(Globals.ANIMATION);
12881510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
12891514 menu.add("-");
12901515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12911516 parseverticesItem.addActionListener(this);
....@@ -1298,6 +1523,8 @@
12981523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12991524 reduce34MorphItem.addActionListener(this);
13001525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
13011528 menu.add(computeAOItem = new MenuItem("Compute AO"));
13021529 computeAOItem.addActionListener(this);
13031530
....@@ -1306,8 +1533,6 @@
13061533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13071534 mirrorItem.addActionListener(this);
13081535 menu.add("-");
1309
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1310
- memoryItem.addActionListener(this);
13111536 menu.add(analyzeItem = new MenuItem("Analyze"));
13121537 analyzeItem.addActionListener(this);
13131538 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1455,6 +1680,30 @@
14551680
14561681 makeSomething(shadow);
14571682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
14581707
14591708 /**
14601709 * applyExample
....@@ -1699,7 +1948,7 @@
16991948 {
17001949 ScreenFit();
17011950 } else
1702
- if (source == switchItem)
1951
+ if (source == switchViewItem)
17031952 {
17041953 cVector v1 = new cVector();
17051954 cVector v2 = new cVector();
....@@ -1708,11 +1957,11 @@
17081957 objEditor.cameraView.renderCamera.setAim(v2, v1);
17091958 objEditor.cameraView.repaint();
17101959 } else
1711
- if (source == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
17121961 {
17131962 makeSomething(new Box());
17141963 } else
1715
- if (source == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
17161965 {
17171966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17181967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1791,27 +2040,27 @@
17912040
17922041 makeSomething(obj);
17932042 } else
1794
- if (source == gridItem)
2043
+ if (source == gridItem || source == gridButton)
17952044 {
17962045 makeSomething(new Grid());
17972046 } else
1798
- if (source == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
17992048 {
18002049 makeSomething(new Sphere());
18012050 } else
1802
- if (source == coneItem)
2051
+ if (source == coneItem || source == coneButton)
18032052 {
18042053 makeSomething(new Cone());
18052054 } else
1806
- if (source == torusItem)
2055
+ if (source == torusItem || source == torusButton)
18072056 {
18082057 makeSomething(new Torus());
18092058 } else
1810
- if (source == superItem)
2059
+ if (source == superItem || source == superButton)
18112060 {
18122061 makeSomething(new Superellipsoid());
18132062 } else
1814
- if (source == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
18152064 {
18162065 makeSomething(new Klein());
18172066 } else
....@@ -1831,7 +2080,7 @@
18312080 {
18322081 makeSomething(new BezierSurface());
18332082 } else
1834
- if (source == overlayItem)
2083
+ if (source == overlayItem || source == overlayButton)
18352084 {
18362085 /*
18372086 Object3D obj = new BezierSurface(5,8);
....@@ -1879,7 +2128,7 @@
18792128 s.setup();
18802129 makeSomething(s);
18812130 } else
1882
- if (source == lightItem)
2131
+ if (source == lightItem || source == lightButton)
18832132 {
18842133 makeSomething(new Light());
18852134 } else
....@@ -1929,30 +2178,30 @@
19292178
19302179 group(g);
19312180 } else
1932
- if (source == loopItem)
2181
+ if (source == loopItem || source == loopButton)
19332182 {
19342183 Composite csg = new GroupLeaf();
19352184 csg.count = 5;
19362185 group(csg);
1937
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
19382187 csg.addChild(child);
19392188 child.addChild(csg);
19402189 } else
19412190 if (source == doubleItem)
19422191 {
1943
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
19442193 csg.count = 5;
19452194 group(csg);
1946
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
19472196 csg.addChild(child);
19482197 child.addChild(csg);
1949
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
19502199 csg.addChild(child);
19512200 child.addChild(csg);
19522201 } else
19532202 if (source == tripleItem)
19542203 {
1955
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
19562205 csg.count = 4;
19572206 group(csg);
19582207 Composite child = new cGroup();
....@@ -2016,15 +2265,31 @@
20162265 } else
20172266 if (source == undoButton)
20182267 {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20192271 Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
20202282 } else
20212283 if (source == redoButton)
20222284 {
2285
+ // Go to next version
20232286 Redo();
20242287 } else
20252288 if (source == saveButton)
20262289 {
2027
- Save();
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
20282293 } else
20292294 if (source == oneStepButton)
20302295 {
....@@ -2033,17 +2298,14 @@
20332298 } else
20342299 if (source == screenfitButton)
20352300 {
2036
- //Reload(lastConverter, lastFilename, true);
20372301 ScreenFit();
20382302 } else
20392303 if (source == screenfitpointButton)
20402304 {
2041
- //Reload(lastConverter, lastFilename, true);
20422305 ScreenFitPoint();
20432306 } else
20442307 if (source == snapobjectButton)
20452308 {
2046
- //Reload(lastConverter, lastFilename, true);
20472309 SnapObject();
20482310 } else
20492311 // if (event.getSource() == recompileButton)
....@@ -2407,7 +2669,7 @@
24072669 {
24082670 StepAll();
24092671 } else
2410
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
24112673 {
24122674 //int indices[] = jList.getSelectedIndices();
24132675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2419,9 +2681,9 @@
24192681 {
24202682 ClearSelection(true);
24212683 } else
2422
- if (source == grabItem)
2684
+ if (source == grabItem || source == groupButton)
24232685 {
2424
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
24252687 } else
24262688 if (source == hideItem)
24272689 {
....@@ -2439,11 +2701,11 @@
24392701 {
24402702 makeSomething(new Camera());
24412703 } else
2442
- if (source == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
24432705 {
24442706 group(new Composite());
24452707 } else
2446
- if (source == randomItem)
2708
+ if (source == switchItem || source == switchButton)
24472709 {
24482710 RandomNode random = new RandomNode();
24492711 group(random);
....@@ -2545,7 +2807,7 @@
25452807 {
25462808 group(new cLinker());
25472809 } else
2548
- if (source == textureItem)
2810
+ if (source == textureItem || source == textureButton)
25492811 {
25502812 group(new TextureNode());
25512813 } else
....@@ -2565,17 +2827,30 @@
25652827 {
25662828 CastShadow(2);
25672829 } else
2568
- if (source == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
25692831 {
2570
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
25712834 for (int i=0; i<group.selection.size(); i++)
25722835 {
2573
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
25742841 }
25752842
2576
- ClearSelection(false);
2577
-
2578
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
25792854 } else
25802855 if (source == genUVItem)
25812856 {
....@@ -2903,6 +3178,10 @@
29033178 if (source == twoButton)
29043179 {
29053180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
29063185 // bug
29073186 //gridPanel.setDividerLocation(1.0);
29083187 //bigPanel.setDividerLocation(0.0);
....@@ -2958,6 +3237,9 @@
29583237 {
29593238 radio.layout = threeButton;
29603239
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
3242
+
29613243 // bigThree.remove(scenePanel);
29623244 // bigThree.remove(centralPanel);
29633245 // bigThree.remove(XYZPanel);
....@@ -2996,6 +3278,9 @@
29963278 {
29973279 radio.layout = fourButton;
29983280
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
3283
+
29993284 // bigThree.remove(scenePanel);
30003285 // bigThree.remove(centralPanel);
30013286 // bigThree.remove(XYZPanel);
....@@ -3032,6 +3317,9 @@
30323317 if (source == sixButton)
30333318 {
30343319 radio.layout = sixButton;
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
30353323
30363324 // bigThree.remove(scenePanel);
30373325 // bigThree.remove(centralPanel);
....@@ -3070,6 +3358,9 @@
30703358 if (source == sevenButton)
30713359 {
30723360 radio.layout = sevenButton;
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
30733364
30743365 // bigThree.remove(scenePanel);
30753366 // bigThree.remove(centralPanel);
....@@ -3126,12 +3417,19 @@
31263417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31273418 {
31283419 ab = (cRadio)e.nextElement();
3129
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31303421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
31313428 buttonGroup.remove(ab);
31323429 radioPanel.remove(ab);
31333430
3134
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
31353433 // ab.GetObject().objectUI = null; // ?????????
31363434
31373435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3144,6 +3442,12 @@
31443442 } else
31453443 if (source == editItem || source == editButton)
31463444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
31473451 EditSelection(false);
31483452 } else
31493453 if (source == uneditButton)
....@@ -3153,6 +3457,7 @@
31533457 Object3D child = (Object3D)e.nextElement();
31543458 if(child.editWindow != null)
31553459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
31563461 child.CloseUI();
31573462 listUI.remove(child);
31583463
....@@ -3169,6 +3474,7 @@
31693474 //copy.ClearUI();
31703475 for (Object3D obj : listUI)
31713476 {
3477
+ obj.pinned = false;
31723478 obj.CloseUI();
31733479 }
31743480 listUI.clear();
....@@ -3178,7 +3484,7 @@
31783484 {
31793485 assert(copy == group);
31803486
3181
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31823488
31833489 for (Object3D obj : listUI)
31843490 {
....@@ -3227,6 +3533,9 @@
32273533 }
32283534
32293535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
32303539 //Globals.theRenderer.object = group;
32313540 if(!useclient)
32323541 {
....@@ -3245,6 +3554,7 @@
32453554
32463555 // fix "+" issue
32473556 //group.editWindow = this;
3557
+ group.manipWindow = this;
32483558
32493559 /*
32503560 currentLayout = radio.layout;
....@@ -3252,6 +3562,13 @@
32523562 currentLayout = sevenButton;
32533563 */
32543564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
32553572 keepparent = group.parent;
32563573 // PARENT = NULL or not???
32573574 //group.parent = null; // ROOT
....@@ -3265,7 +3582,7 @@
32653582 cameraView.ProtectCamera();
32663583 cameraView.repaint();
32673584 return;
3268
- } else if (event.getSource() == revertCameraItem)
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32693586 {
32703587 cameraView.RevertCamera();
32713588 cameraView.repaint();
....@@ -4319,28 +4636,25 @@
43194636 // }
43204637 // }
43214638
4322
- static boolean allparams = true;
4323
-
4324
- static Vector<Object3D> listUI = new Vector<Object3D>();
4325
-
43264639 void EditSelection(boolean newWindow)
43274640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
43284647 // aConstraints.gridy = 0;
43294648 for (int i=0; i<group.selection.size(); i++)
43304649 {
43314650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43324651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4333
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43344653
43354654 Object3D elem = (Object3D)group.selection.elementAt(i);
43364655 if(elem != group || !newWindow)
43374656 {
4338
- // if (!(elem instanceof Composite))
4339
- // newWindow = false;
4340
- listUI.add(elem);
4341
- elem.openEditWindow(this, newWindow); //, false);
4342
- System.out.println("edit : " + elem);
4343
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
43444658 }
43454659 }
43464660 }
....@@ -4415,7 +4729,8 @@
44154729 //new Exception().printStackTrace();
44164730
44174731 freezemodel = true;
4418
-
4732
+ ClearUnpinned();
4733
+
44194734 /**/
44204735 //switch (event.id)
44214736 {
....@@ -4448,7 +4763,7 @@
44484763 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44494764 // a camera
44504765 {
4451
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44524767 {
44534768 CameraPane.camerachangeframe = 0; // don't refuse it
44544769 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4457,6 +4772,13 @@
44574772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44584773 }
44594774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
44604782 refreshContents();
44614783 //return true;
44624784 }
....@@ -4466,9 +4788,18 @@
44664788 freezemodel = false;
44674789 }
44684790
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
44694799 void refreshContents(boolean cp)
44704800 {
4471
- if (!Globals.MOUSEDRAGGED)
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44724803 {
44734804 objEditor.ClearInfo(); // .GetMaterial());
44744805
....@@ -4567,7 +4898,8 @@
45674898
45684899 if (cut)
45694900 {
4570
- Save();
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
45714903 //int indices[] = jList.getSelectedIndices();
45724904 //for (int i = indices.length - 1; i >= 0; i--)
45734905 //jList.remove(indices[i]);
....@@ -4670,6 +5002,10 @@
46705002
46715003 void paste(boolean expand)
46725004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
46735009 // if (GrafreeD.clipboard == null)
46745010 // return;
46755011 boolean first = true;
....@@ -4729,6 +5065,7 @@
47295065 Grafreed.clipboard.get(0).parent = keepparent;
47305066 }
47315067
5068
+ Globals.REPLACEONMAKE = keep;
47325069 ResetModel();
47335070 refreshContents();
47345071 }
....@@ -4864,6 +5201,10 @@
48645201
48655202 void group(Object3D csg, boolean grab)
48665203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
48675208 if (//false) // why??
48685209 !group.selection.isEmpty())
48695210 {
....@@ -4977,10 +5318,15 @@
49775318 //node.add(csg);
49785319 //makeSomething(node);
49795320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
49805322 }
49815323
49825324 void Ungroup(Object3D g)
49835325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
49845330 if (g instanceof HiddenObject)
49855331 {
49865332 HiddenObject h = (HiddenObject) g;
....@@ -4997,6 +5343,7 @@
49975343 objEditor.makeSomething(g.get(i), false);
49985344 }
49995345 }
5346
+ Globals.REPLACEONMAKE = keep;
50005347 }
50015348
50025349 void ungroup()
....@@ -5285,13 +5632,28 @@
52855632 cButton clearpanelButton;
52865633 cButton unselectButton;
52875634
5288
- cButton minButton;
5289
- cButton maxButton;
5290
- cButton fullButton;
5291
- cButton undoButton;
5292
- cButton redoButton;
5635
+ cButton restoreCameraButton;
5636
+
52935637 cButton saveButton;
52945638 cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
52955657
52965658 cButton screenfitButton;
52975659 cButton screenfitpointButton;
....@@ -5313,11 +5675,11 @@
53135675 //JTree jTree;
53145676 private MenuItem lookAtItem;
53155677 private MenuItem lookFromItem;
5316
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
53175679 private MenuItem cutItem;
53185680 private MenuItem undoItem;
53195681 private MenuItem redoItem;
5320
- private MenuItem duplicateItem;
5682
+ private JMenuItem duplicateItem;
53215683 private MenuItem cloneItem;
53225684 private MenuItem cloneSupportItem;
53235685 private MenuItem overwriteGeoItem;
....@@ -5345,7 +5707,7 @@
53455707 private MenuItem pasteLinkItem;
53465708 private MenuItem pasteCloneItem;
53475709 private MenuItem pasteExpandItem;
5348
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
53495711 private MenuItem clearAllItem;
53505712 private MenuItem genUVItem;
53515713 private MenuItem genNormalsMESHItem;
....@@ -5405,7 +5767,7 @@
54055767 private MenuItem frontItem;
54065768 private MenuItem cameraItem;
54075769 private MenuItem compositeItem;
5408
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
54095771 private MenuItem physicsItem;
54105772 private MenuItem frameselectorItem;
54115773 private MenuItem scriptNodeItem;
....@@ -5479,5 +5841,5 @@
54795841
54805842 Menu cameraMenu;
54815843 MenuItem editCameraItem;
5482
- MenuItem revertCameraItem;
5844
+ MenuItem restoreCameraItem;
54835845 }