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);
....@@ -176,7 +197,6 @@
176197 copyItem.addActionListener(this);
177198 pasteItem = menu.add(new MenuItem("Paste"));
178199 pasteItem.addActionListener(this);
179
- menu.add("-");
180200
181201 menu.add("-");
182202 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -188,8 +208,8 @@
188208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189209 // pasteExpandItem.addActionListener(this);
190210 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
193213
194214 if (Globals.ADVANCED)
195215 {
....@@ -203,23 +223,23 @@
203223 //zBufferItem.addActionListener(this);
204224 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205225 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
208228
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- 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);
213241
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223243 toggleHandleItem.addItemListener(this);
224244 toggleHandleItem.setState(CameraPane.HANDLES);
225245
....@@ -274,7 +294,7 @@
274294 {
275295 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276296 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278298 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279299 oe.cameraMenu.add("-");
280300 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +302,7 @@
282302 editLeafItem.addActionListener(this);
283303 lookAtItem.addActionListener(this);
284304 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
305
+ //switchViewItem.addActionListener(this);
286306 }
287307
288308 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +347,29 @@
327347 }
328348
329349 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
332352 backItem = menu.add(new MenuItem("Back"));
333353 backItem.addActionListener(this);
334354 frontItem = menu.add(new MenuItem("Front"));
335355 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
338361 hideItem = menu.add(new MenuItem("Hidden Group"));
339362 hideItem.addActionListener(this);
363
+ }
340364 ungroupItem = menu.add(new MenuItem("Ungroup"));
341365 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- 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
+ {
345373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346374 switchGeoItem.addActionListener(this);
347375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +377,6 @@
349377 morphItem = menu.add(new MenuItem("Morph Group"));
350378 morphItem.addActionListener(this);
351379
352
- if (Globals.ADVANCED)
353
- {
354380 menu.add("-");
355381 physicsItem = menu.add(new MenuItem("Physics"));
356382 physicsItem.addActionListener(this);
....@@ -358,30 +384,29 @@
358384 frameselectorItem.addActionListener(this);
359385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360386 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363387 }
364388
365389 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
368392 billboardItem = menu.add(new MenuItem("Billboard"));
369393 billboardItem.addActionListener(this);
370394 csgItem = menu.add(new MenuItem("CSG"));
371395 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
396
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373397 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
398
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375399 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
400
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
378405 if (Globals.ADVANCED)
379406 {
380407 menu.add("-");
381408 linkerItem = menu.add(new MenuItem("Linker"));
382409 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385410 templateItem = menu.add(new MenuItem("Template"));
386411 templateItem.addActionListener(this);
387412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -410,7 +435,7 @@
410435 genNormalsMESHItem.addActionListener(this);
411436 if (Globals.ADVANCED)
412437 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414439 genNormalsMINEItem.addActionListener(this);
415440 }
416441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -533,6 +558,7 @@
533558 buildToolsMenu(menu);
534559 }
535560
561
+
536562 void SetupUI2(ObjEditor oe)
537563 {
538564 // June 2019
....@@ -575,51 +601,79 @@
575601 oe.radioPanel.add(dummyButton);
576602 oe.buttonGroup.add(dummyButton);
577603 */
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
607
+
578608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
579609
580610 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
581611 //minButton.setToolTipText("Minimize window");
582612 //minButton.addActionListener(this);
583613
584
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- maxButton.setToolTipText("Maximize window");
586
- 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
+ }
587620
588
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589622 fullButton.setToolTipText("Full-screen window");
590623 fullButton.addActionListener(this);
591624
592
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
593
- undoButton.setToolTipText("Undo changes");
594
- 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);
595632
596
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- redoButton.setToolTipText("Redo changes");
598
- redoButton.addActionListener(this);
599
-
600
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
- saveButton.setToolTipText("Save changes");
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
602635 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);
603641
604
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
605661 liveCB.setToolTipText("Enable animation");
606662 liveCB.addItemListener(this);
607663
608
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609665 oneStepButton.setToolTipText("Animate one step forward");
610666 oneStepButton.addActionListener(this);
611667
612
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
613669 fastCB.setToolTipText("Fast mode");
614670 fastCB.addItemListener(this);
615671
616
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
617
- trackCB.setToolTipText("Enable tracking");
618
- trackCB.addItemListener(this);
619
-
620
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- screenfitButton.setToolTipText("Screen fit");
622
- screenfitButton.addActionListener(this);
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
623677
624678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
625679 // screenfitpointButton.addActionListener(this);
....@@ -631,65 +685,146 @@
631685 snapobjectButton.setToolTipText("Snap Object");
632686 }
633687
634
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
- flashSelectionButton.setToolTipText("Show selection");
636
- flashSelectionButton.addActionListener(this);
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
637689
638
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
639
-
640
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641
- twoButton.setToolTipText("Show center view only");
642
- twoButton.addActionListener(this);
643
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
690
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644691 fourButton.addActionListener(this);
645692 fourButton.setToolTipText("Show left panel only");
646
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
- sixButton.setToolTipText("2-column layout left");
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
+
699
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ sixButton.setToolTipText("Show left and right");
648701 sixButton.addActionListener(this);
649
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- threeButton.setToolTipText("2-column layout right");
651
- threeButton.addActionListener(this);
652
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653
- sevenButton.setToolTipText("3-column layout");
654
- 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);
655708 //
656709
657
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658
- 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");
659712 rootButton.addActionListener(this);
660713
661
- 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);
662715 closeButton.setToolTipText("Close tab");
663716 closeButton.addActionListener(this);
664717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
665718 //clearButton.addActionListener(this);
666
-
667
- cGridBag commandsPanel = new cGridBag();
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
+ }
668751
669
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
- editButton.setToolTipText("Edit selection");
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");
671801 editButton.addActionListener(this);
672802
673
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
675805 uneditButton.addActionListener(this);
676806
677
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
678
- allParamsButton.setToolTipText("Edit all params");
807
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
808
+ allParamsButton.setToolTipText("Show all controle");
679809 allParamsButton.addActionListener(this);
680810
681
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
811
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682812 clearPanelButton.setToolTipText("Clear edit panel");
683813 clearPanelButton.addActionListener(this);
684814
685
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
815
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686816 unselectButton.setToolTipText("Unselect");
687817 unselectButton.addActionListener(this);
688818
689
- commandsPanel.preferredHeight = 1;
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
690822
691
- oe.treePanel.add(commandsPanel);
692
- oe.treePanel.Return();
823
+ editCommandsPanel.preferredHeight = 1;
824
+
825
+ SetPinStates(false);
826
+// oe.treePanel.add(commandsPanel);
827
+// oe.treePanel.Return();
693828
694829 // oe.aConstraints.gridx += 1;
695830 // oe.aConstraints.weighty = 0;
....@@ -706,29 +841,17 @@
706841
707842 JScrollPane jSP;
708843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
709
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
710845 ResetModel();
711846
712847 oe.treePanel.add(jSPPanel);
713848 oe.treePanel.Return();
714849
715
- cGridBag copyOptionsPanel = new cGridBag();
716
-
717
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
718
- colorCB.setToolTipText("Copy color when dropped");
719
- colorCB.addItemListener(this);
720
-
721
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
722
- materialCB.setToolTipText("Copy material when dropped");
723
- materialCB.addItemListener(this);
724
-
725
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
726
- textureCB.setToolTipText("Copy texture when dropped");
727
- textureCB.addItemListener(this);
728
-
729
- copyOptionsPanel.preferredHeight = 1;
730850 oe.treePanel.add(copyOptionsPanel);
731851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
732855
733856 // mainPanel.setDividerLocation(0.5); //1.0);
734857 // mainPanel.setResizeWeight(0.5);
....@@ -751,29 +874,49 @@
751874 dgr.addDragGestureListener(this);
752875 }catch(Exception e) {}
753876 */
754
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
755878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
756879 }
757880
758881 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
759882 {
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
+
760897 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
761898 boxCB.setToolTipText("Display bounding boxes");
762899 boxCB.addItemListener(this);
763900
764901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
765
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
766903 zoomBoxCB.addItemListener(this);
767904
768905 if (true) // Globals.ADVANCED)
769906 {
770
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
771
- supportCB.setToolTipText("Enable rigging");
772
- 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);
773914
774915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
775916 // localCB.addItemListener(this);
776917
918
+ panel.Return();
919
+
777920 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
778921 crowdCB.setToolTipText("Used for crowds");
779922 crowdCB.addItemListener(this);
....@@ -790,6 +933,8 @@
790933 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
791934 // speakerMocapCB.addItemListener(this);
792935
936
+ panel.Return();
937
+
793938 if (false)
794939 {
795940 // handled in scripts
....@@ -804,34 +949,74 @@
804949 //constraints.gridy += 1;
805950 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
806951 smoothfocusCB.addItemListener(this);
952
+ panel.Return();
807953 }
808954
809955 //constraints.gridx += 1;
810956 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
811957 // debugCB.addItemListener(this);
812958
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
813963 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
814965 oeilCB.addItemListener(this);
815966
967
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
968
+ shadowCB.setToolTipText("When live compute shadows");
969
+ shadowCB.addItemListener(this);
970
+
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
985
+ if (Globals.ADVANCED)
986
+ {
816987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
817988 lookAtCB.setToolTipText("Look-at target");
818989 lookAtCB.addItemListener(this);
990
+ }
819991
820992 }
821993
822994 cGridBag fill = new cGridBag();
823
-
824995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
8251000
8261001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
8271004
8281005 }
8291006
8301007 void EditObject(Object3D obj)
8311008 {
8321009 cRadio radioButton = new cRadio(obj.name);
1010
+
1011
+ // June 2019. Patch to avoid bug with transparency.
1012
+ radioButton.hadMaterial = obj.material != null;
1013
+ if (!radioButton.hadMaterial)
1014
+ {
1015
+ obj.material = new cMaterial();
1016
+ }
1017
+
8331018 radioButton.SetObject(obj);
834
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
8351020 radioButton.SetCamera(cameraView.renderCamera, false);
8361021 radioButton.addActionListener(this);
8371022 radioPanel.add(radioButton);
....@@ -851,23 +1036,28 @@
8511036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8521037 }
8531038
854
- JCheckBox liveCB;
855
- JCheckBox supportCB;
856
- JCheckBox localCB;
857
- JCheckBox crowdCB;
858
- JCheckBox smoothCB;
859
- JCheckBox fastCB;
860
- JCheckBox slowCB;
861
- JCheckBox boxCB;
862
- JCheckBox zoomBoxCB;
863
- JCheckBox trackCB;
864
- JCheckBox smoothfocusCB;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
8651052 // JCheckBox speakerMocapCB;
866
- JCheckBox speakerCameraCB;
867
- JCheckBox speakerFocusCB;
868
- JCheckBox debugCB;
869
- JCheckBox oeilCB;
870
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
8711061
8721062 // static int COLOR = 1;
8731063 // static int MATERIAL = 2;
....@@ -875,9 +1065,9 @@
8751065
8761066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8771067
878
- JCheckBox colorCB;
879
- JCheckBox materialCB;
880
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
8811071
8821072 public void itemStateChanged(ItemEvent e)
8831073 {
....@@ -970,6 +1160,18 @@
9701160 {
9711161 cameraView.ToggleOeil();
9721162 }
1163
+ else if(e.getSource() == shadowCB)
1164
+ {
1165
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1166
+ }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
9731175 else if(e.getSource() == lookAtCB)
9741176 {
9751177 cameraView.ToggleLookAt();
....@@ -986,7 +1188,8 @@
9861188
9871189 /**/
9881190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
989
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
9901193 if ((path == null) || (path.getPathCount() <= 1)) {
9911194 // We can't move the root node or an empty selection
9921195 return;
....@@ -1049,8 +1252,6 @@
10491252 }
10501253 }
10511254
1052
- String string = (String) object;
1053
-
10541255 System.out.println("Transfer = " + object + "; drop : " + target);
10551256 // if( object instanceof java.io.File[])
10561257 // {
....@@ -1058,6 +1259,8 @@
10581259 // objEditor.DropFile((java.io.File[]) object, true);
10591260 // return;
10601261 // }
1262
+
1263
+ String string = object.toString();
10611264
10621265 // File path for Mac and Windows
10631266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1103,23 +1306,33 @@
11031306
11041307 assert target == objEditor.jTree;
11051308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
11061310 try {
1107
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11081312 } catch (Exception e) {
11091313 System.out.println("destinationPath : " + destinationPath);
11101314 return;
11111315 }
11121316
1113
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
11141318 {
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
+// {
11151328 loadClipboard(true);
11161329 objEditor.jTree.setSelectionPath(destinationPath);
11171330 pasteInto(false, false);
1118
- } else {
1119
- loadClipboard(false);
1120
- objEditor.jTree.setSelectionPath(destinationPath);
1121
- pasteInto(false, false); // true); // ???
1122
- }
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
11231336 }
11241337 public void dropActionChanged(DropTargetDragEvent dtde)
11251338 // Called if the user has modified the current drop gesture
....@@ -1224,22 +1437,30 @@
12241437 {
12251438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12261439 //heightFieldItem.addActionListener(this);
1227
- gridItem = menu.add(new MenuItem("Grid"));
1228
- gridItem.addActionListener(this);
1229
- rectoidItem = menu.add(new MenuItem("Box"));
1230
- rectoidItem.addActionListener(this);
1231
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1232
- ellipsoidItem.addActionListener(this);
1233
- coneItem = menu.add(new MenuItem("Cone"));
1234
- coneItem.addActionListener(this);
1235
- torusItem = menu.add(new MenuItem("Torus"));
1236
- torusItem.addActionListener(this);
1237
- superItem = menu.add(new MenuItem("Superellipsoid"));
1238
- 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
+ {
12391458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12401459 kleinItem.addActionListener(this);
1241
- particleItem = menu.add(new MenuItem("Particle system"));
1242
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
12431464 if (Globals.ADVANCED)
12441465 {
12451466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1265,15 +1486,15 @@
12651486 }
12661487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12671488 bezierItem.addActionListener(this);
1268
- overlayItem = menu.add(new MenuItem("Overlay"));
1269
- overlayItem.addActionListener(this);
1270
- lightItem = menu.add(new MenuItem("Light"));
1271
- 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);
12721493 menu.add("-");
12731494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12741495 //superLoopItem.addActionListener(this);
1275
- loopItem = menu.add(new MenuItem("Loop"));
1276
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
12771498 doubleItem = menu.add(new MenuItem("Fork"));
12781499 doubleItem.addActionListener(this);
12791500 if (Globals.ADVANCED)
....@@ -1289,6 +1510,9 @@
12891510 animationItem.addItemListener(this);
12901511 animationItem.setState(Globals.ANIMATION);
12911512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
12921516 menu.add("-");
12931517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12941518 parseverticesItem.addActionListener(this);
....@@ -1301,6 +1525,8 @@
13011525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13021526 reduce34MorphItem.addActionListener(this);
13031527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
13041530 menu.add(computeAOItem = new MenuItem("Compute AO"));
13051531 computeAOItem.addActionListener(this);
13061532
....@@ -1309,8 +1535,6 @@
13091535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13101536 mirrorItem.addActionListener(this);
13111537 menu.add("-");
1312
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1313
- memoryItem.addActionListener(this);
13141538 menu.add(analyzeItem = new MenuItem("Analyze"));
13151539 analyzeItem.addActionListener(this);
13161540 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1454,9 +1678,34 @@
14541678 shadow.material = new cMaterial(obj.material);
14551679 shadow.material.diffuse = 0.0001f;
14561680 shadow.material.specular = 0.0001f;
1681
+ //shadow.projectedVertices[1].x = 300;
14571682
14581683 makeSomething(shadow);
14591684 }
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
+ }
14601709
14611710 /**
14621711 * applyExample
....@@ -1701,7 +1950,7 @@
17011950 {
17021951 ScreenFit();
17031952 } else
1704
- if (source == switchItem)
1953
+ if (source == switchViewItem)
17051954 {
17061955 cVector v1 = new cVector();
17071956 cVector v2 = new cVector();
....@@ -1710,11 +1959,11 @@
17101959 objEditor.cameraView.renderCamera.setAim(v2, v1);
17111960 objEditor.cameraView.repaint();
17121961 } else
1713
- if (source == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
17141963 {
17151964 makeSomething(new Box());
17161965 } else
1717
- if (source == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
17181967 {
17191968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17201969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1793,27 +2042,27 @@
17932042
17942043 makeSomething(obj);
17952044 } else
1796
- if (source == gridItem)
2045
+ if (source == gridItem || source == gridButton)
17972046 {
17982047 makeSomething(new Grid());
17992048 } else
1800
- if (source == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
18012050 {
18022051 makeSomething(new Sphere());
18032052 } else
1804
- if (source == coneItem)
2053
+ if (source == coneItem || source == coneButton)
18052054 {
18062055 makeSomething(new Cone());
18072056 } else
1808
- if (source == torusItem)
2057
+ if (source == torusItem || source == torusButton)
18092058 {
18102059 makeSomething(new Torus());
18112060 } else
1812
- if (source == superItem)
2061
+ if (source == superItem || source == superButton)
18132062 {
18142063 makeSomething(new Superellipsoid());
18152064 } else
1816
- if (source == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
18172066 {
18182067 makeSomething(new Klein());
18192068 } else
....@@ -1833,7 +2082,7 @@
18332082 {
18342083 makeSomething(new BezierSurface());
18352084 } else
1836
- if (source == overlayItem)
2085
+ if (source == overlayItem || source == overlayButton)
18372086 {
18382087 /*
18392088 Object3D obj = new BezierSurface(5,8);
....@@ -1881,7 +2130,7 @@
18812130 s.setup();
18822131 makeSomething(s);
18832132 } else
1884
- if (source == lightItem)
2133
+ if (source == lightItem || source == lightButton)
18852134 {
18862135 makeSomething(new Light());
18872136 } else
....@@ -1931,30 +2180,30 @@
19312180
19322181 group(g);
19332182 } else
1934
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
19352184 {
19362185 Composite csg = new GroupLeaf();
19372186 csg.count = 5;
19382187 group(csg);
1939
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
19402189 csg.addChild(child);
19412190 child.addChild(csg);
19422191 } else
19432192 if (source == doubleItem)
19442193 {
1945
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
19462195 csg.count = 5;
19472196 group(csg);
1948
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
19492198 csg.addChild(child);
19502199 child.addChild(csg);
1951
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
19522201 csg.addChild(child);
19532202 child.addChild(csg);
19542203 } else
19552204 if (source == tripleItem)
19562205 {
1957
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
19582207 csg.count = 4;
19592208 group(csg);
19602209 Composite child = new cGroup();
....@@ -2018,15 +2267,31 @@
20182267 } else
20192268 if (source == undoButton)
20202269 {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20212273 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();
20222284 } else
20232285 if (source == redoButton)
20242286 {
2287
+ // Go to next version
20252288 Redo();
20262289 } else
20272290 if (source == saveButton)
20282291 {
2029
- Save();
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
20302295 } else
20312296 if (source == oneStepButton)
20322297 {
....@@ -2035,17 +2300,14 @@
20352300 } else
20362301 if (source == screenfitButton)
20372302 {
2038
- //Reload(lastConverter, lastFilename, true);
20392303 ScreenFit();
20402304 } else
20412305 if (source == screenfitpointButton)
20422306 {
2043
- //Reload(lastConverter, lastFilename, true);
20442307 ScreenFitPoint();
20452308 } else
20462309 if (source == snapobjectButton)
20472310 {
2048
- //Reload(lastConverter, lastFilename, true);
20492311 SnapObject();
20502312 } else
20512313 // if (event.getSource() == recompileButton)
....@@ -2409,7 +2671,7 @@
24092671 {
24102672 StepAll();
24112673 } else
2412
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
24132675 {
24142676 //int indices[] = jList.getSelectedIndices();
24152677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2421,9 +2683,9 @@
24212683 {
24222684 ClearSelection(true);
24232685 } else
2424
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
24252687 {
2426
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
24272689 } else
24282690 if (source == hideItem)
24292691 {
....@@ -2441,11 +2703,11 @@
24412703 {
24422704 makeSomething(new Camera());
24432705 } else
2444
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
24452707 {
24462708 group(new Composite());
24472709 } else
2448
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
24492711 {
24502712 RandomNode random = new RandomNode();
24512713 group(random);
....@@ -2547,7 +2809,7 @@
25472809 {
25482810 group(new cLinker());
25492811 } else
2550
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
25512813 {
25522814 group(new TextureNode());
25532815 } else
....@@ -2567,17 +2829,30 @@
25672829 {
25682830 CastShadow(2);
25692831 } else
2570
- if (source == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
25712833 {
2572
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
25732836 for (int i=0; i<group.selection.size(); i++)
25742837 {
2575
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
25762843 }
25772844
2578
- ClearSelection(false);
2579
-
2580
- 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
+ }
25812856 } else
25822857 if (source == genUVItem)
25832858 {
....@@ -2905,6 +3180,10 @@
29053180 if (source == twoButton)
29063181 {
29073182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
29083187 // bug
29093188 //gridPanel.setDividerLocation(1.0);
29103189 //bigPanel.setDividerLocation(0.0);
....@@ -2960,6 +3239,9 @@
29603239 {
29613240 radio.layout = threeButton;
29623241
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
3244
+
29633245 // bigThree.remove(scenePanel);
29643246 // bigThree.remove(centralPanel);
29653247 // bigThree.remove(XYZPanel);
....@@ -2998,6 +3280,9 @@
29983280 {
29993281 radio.layout = fourButton;
30003282
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
3285
+
30013286 // bigThree.remove(scenePanel);
30023287 // bigThree.remove(centralPanel);
30033288 // bigThree.remove(XYZPanel);
....@@ -3034,6 +3319,9 @@
30343319 if (source == sixButton)
30353320 {
30363321 radio.layout = sixButton;
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
30373325
30383326 // bigThree.remove(scenePanel);
30393327 // bigThree.remove(centralPanel);
....@@ -3072,6 +3360,9 @@
30723360 if (source == sevenButton)
30733361 {
30743362 radio.layout = sevenButton;
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
30753366
30763367 // bigThree.remove(scenePanel);
30773368 // bigThree.remove(centralPanel);
....@@ -3128,12 +3419,19 @@
31283419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31293420 {
31303421 ab = (cRadio)e.nextElement();
3131
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31323423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
31333430 buttonGroup.remove(ab);
31343431 radioPanel.remove(ab);
31353432
3136
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
31373435 // ab.GetObject().objectUI = null; // ?????????
31383436
31393437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3146,6 +3444,12 @@
31463444 } else
31473445 if (source == editItem || source == editButton)
31483446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
31493453 EditSelection(false);
31503454 } else
31513455 if (source == uneditButton)
....@@ -3155,6 +3459,7 @@
31553459 Object3D child = (Object3D)e.nextElement();
31563460 if(child.editWindow != null)
31573461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
31583463 child.CloseUI();
31593464 listUI.remove(child);
31603465
....@@ -3171,6 +3476,7 @@
31713476 //copy.ClearUI();
31723477 for (Object3D obj : listUI)
31733478 {
3479
+ obj.pinned = false;
31743480 obj.CloseUI();
31753481 }
31763482 listUI.clear();
....@@ -3180,7 +3486,7 @@
31803486 {
31813487 assert(copy == group);
31823488
3183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31843490
31853491 for (Object3D obj : listUI)
31863492 {
....@@ -3229,6 +3535,9 @@
32293535 }
32303536
32313537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
32323541 //Globals.theRenderer.object = group;
32333542 if(!useclient)
32343543 {
....@@ -3247,6 +3556,7 @@
32473556
32483557 // fix "+" issue
32493558 //group.editWindow = this;
3559
+ group.manipWindow = this;
32503560
32513561 /*
32523562 currentLayout = radio.layout;
....@@ -3254,6 +3564,13 @@
32543564 currentLayout = sevenButton;
32553565 */
32563566 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);
32573574 keepparent = group.parent;
32583575 // PARENT = NULL or not???
32593576 //group.parent = null; // ROOT
....@@ -3267,7 +3584,7 @@
32673584 cameraView.ProtectCamera();
32683585 cameraView.repaint();
32693586 return;
3270
- } else if (event.getSource() == revertCameraItem)
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32713588 {
32723589 cameraView.RevertCamera();
32733590 cameraView.repaint();
....@@ -3846,7 +4163,7 @@
38464163
38474164 try
38484165 {
3849
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4166
+ texturedata = Globals.theRenderer.GetTextureData(tex.pigmenttexture, pigment, false, node.texres);
38504167 }
38514168 catch (Exception e)
38524169 {
....@@ -4321,28 +4638,25 @@
43214638 // }
43224639 // }
43234640
4324
- static boolean allparams = true;
4325
-
4326
- static Vector<Object3D> listUI = new Vector<Object3D>();
4327
-
43284641 void EditSelection(boolean newWindow)
43294642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
43304649 // aConstraints.gridy = 0;
43314650 for (int i=0; i<group.selection.size(); i++)
43324651 {
43334652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43344653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4335
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43364655
43374656 Object3D elem = (Object3D)group.selection.elementAt(i);
43384657 if(elem != group || !newWindow)
43394658 {
4340
- // if (!(elem instanceof Composite))
4341
- // newWindow = false;
4342
- listUI.add(elem);
4343
- elem.openEditWindow(this, newWindow); //, false);
4344
- System.out.println("edit : " + elem);
4345
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
43464660 }
43474661 }
43484662 }
....@@ -4417,7 +4731,8 @@
44174731 //new Exception().printStackTrace();
44184732
44194733 freezemodel = true;
4420
-
4734
+ ClearUnpinned();
4735
+
44214736 /**/
44224737 //switch (event.id)
44234738 {
....@@ -4450,7 +4765,7 @@
44504765 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44514766 // a camera
44524767 {
4453
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44544769 {
44554770 CameraPane.camerachangeframe = 0; // don't refuse it
44564771 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4459,6 +4774,13 @@
44594774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44604775 }
44614776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
44624784 refreshContents();
44634785 //return true;
44644786 }
....@@ -4468,9 +4790,18 @@
44684790 freezemodel = false;
44694791 }
44704792
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
44714801 void refreshContents(boolean cp)
44724802 {
4473
- if (!Globals.MOUSEDRAGGED)
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44744805 {
44754806 objEditor.ClearInfo(); // .GetMaterial());
44764807
....@@ -4569,7 +4900,8 @@
45694900
45704901 if (cut)
45714902 {
4572
- Save();
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
45734905 //int indices[] = jList.getSelectedIndices();
45744906 //for (int i = indices.length - 1; i >= 0; i--)
45754907 //jList.remove(indices[i]);
....@@ -4672,6 +5004,10 @@
46725004
46735005 void paste(boolean expand)
46745006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
46755011 // if (GrafreeD.clipboard == null)
46765012 // return;
46775013 boolean first = true;
....@@ -4731,6 +5067,7 @@
47315067 Grafreed.clipboard.get(0).parent = keepparent;
47325068 }
47335069
5070
+ Globals.REPLACEONMAKE = keep;
47345071 ResetModel();
47355072 refreshContents();
47365073 }
....@@ -4866,6 +5203,10 @@
48665203
48675204 void group(Object3D csg, boolean grab)
48685205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
48695210 if (//false) // why??
48705211 !group.selection.isEmpty())
48715212 {
....@@ -4979,10 +5320,15 @@
49795320 //node.add(csg);
49805321 //makeSomething(node);
49815322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
49825324 }
49835325
49845326 void Ungroup(Object3D g)
49855327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
49865332 if (g instanceof HiddenObject)
49875333 {
49885334 HiddenObject h = (HiddenObject) g;
....@@ -4999,6 +5345,7 @@
49995345 objEditor.makeSomething(g.get(i), false);
50005346 }
50015347 }
5348
+ Globals.REPLACEONMAKE = keep;
50025349 }
50035350
50045351 void ungroup()
....@@ -5287,13 +5634,28 @@
52875634 cButton clearpanelButton;
52885635 cButton unselectButton;
52895636
5290
- cButton minButton;
5291
- cButton maxButton;
5292
- cButton fullButton;
5293
- cButton undoButton;
5294
- cButton redoButton;
5637
+ cButton restoreCameraButton;
5638
+
52955639 cButton saveButton;
52965640 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;
52975659
52985660 cButton screenfitButton;
52995661 cButton screenfitpointButton;
....@@ -5315,11 +5677,11 @@
53155677 //JTree jTree;
53165678 private MenuItem lookAtItem;
53175679 private MenuItem lookFromItem;
5318
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
53195681 private MenuItem cutItem;
53205682 private MenuItem undoItem;
53215683 private MenuItem redoItem;
5322
- private MenuItem duplicateItem;
5684
+ private JMenuItem duplicateItem;
53235685 private MenuItem cloneItem;
53245686 private MenuItem cloneSupportItem;
53255687 private MenuItem overwriteGeoItem;
....@@ -5347,7 +5709,7 @@
53475709 private MenuItem pasteLinkItem;
53485710 private MenuItem pasteCloneItem;
53495711 private MenuItem pasteExpandItem;
5350
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
53515713 private MenuItem clearAllItem;
53525714 private MenuItem genUVItem;
53535715 private MenuItem genNormalsMESHItem;
....@@ -5407,7 +5769,7 @@
54075769 private MenuItem frontItem;
54085770 private MenuItem cameraItem;
54095771 private MenuItem compositeItem;
5410
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
54115773 private MenuItem physicsItem;
54125774 private MenuItem frameselectorItem;
54135775 private MenuItem scriptNodeItem;
....@@ -5481,5 +5843,5 @@
54815843
54825844 Menu cameraMenu;
54835845 MenuItem editCameraItem;
5484
- MenuItem revertCameraItem;
5846
+ MenuItem restoreCameraItem;
54855847 }