Normand Briere
2019-07-28 a434119e65146fe53d612c28e1ee7af532d1b70a
GroupEditor.java
....@@ -23,6 +23,31 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row3)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ skyboxButton.setToolTipText(s);
33
+ skyboxButton.addActionListener(new ActionListener()
34
+ {
35
+ @Override
36
+ public void actionPerformed(ActionEvent e)
37
+ {
38
+ ChangeSkybox(path);
39
+ }
40
+ });
41
+ }
42
+
43
+ public void ChangeSkybox(String name)
44
+ {
45
+ cameraView.envyoff = false;
46
+ cameraView.skyboxname = name;
47
+ cameraView.skyboxext = "jpg";
48
+ cameraView.repaint();
49
+ }
50
+
2651 //ObjEditor objEditor;
2752 public void closeUI2()
2853 {
....@@ -60,6 +85,12 @@
6085 this.copy = this.group = group;
6186 //selectees = this.group.selectees;
6287
88
+ if (copy.versions == null)
89
+ {
90
+ copy.versions = new byte[100][];
91
+ copy.versionindex = -1;
92
+ }
93
+
6394 if(ui)
6495 SetupUI(objEditor);
6596 }
....@@ -80,10 +111,22 @@
80111 SetupViews(objEditor);
81112
82113 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
114
+
115
+ if (copy.versions == null)
116
+ {
117
+ copy.versions = new byte[100][];
118
+ copy.versionindex = -1;
119
+
120
+ Save(true);
121
+ }
83122 }
84123
85124 void CloneSelection(boolean supports)
86125 {
126
+ if (Globals.REPLACEONMAKE)
127
+ Save();
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
87130 // Object3D keep = GrafreeD.clipboard;
88131 //Object3D obj;
89132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +137,7 @@
94137
95138 makeSomething(clone, i==group.selection.size()-1);
96139 }
140
+ Globals.REPLACEONMAKE = keep;
97141 }
98142
99143 void CloneClipboard(boolean supports)
....@@ -150,6 +194,8 @@
150194
151195 void SetupMenu2(GroupEditor oe)
152196 {
197
+ oe.jTree = new cTree();
198
+
153199 Menu menu;
154200 oe.menuBar.add(menu = new Menu("Edit"));
155201 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +206,7 @@
160206 // redoItem = menu.add(new MenuItem("Redo"));
161207 // redoItem.addActionListener(this);
162208 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
209
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164210 duplicateItem.addActionListener(this);
165211 cloneItem = menu.add(new MenuItem("Clone"));
166212 cloneItem.addActionListener(this);
....@@ -187,8 +233,8 @@
187233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188234 // pasteExpandItem.addActionListener(this);
189235 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
192238
193239 if (Globals.ADVANCED)
194240 {
....@@ -202,23 +248,23 @@
202248 //zBufferItem.addActionListener(this);
203249 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204250 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
251
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
252
+ restoreCameraItem.addActionListener(this);
207253
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
254
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
255
+// toggleFullScreenItem.addItemListener(this);
256
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
257
+// cameraMenu.add("-");
258
+//
259
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
260
+// toggleTextureItem.addItemListener(this);
261
+// toggleTextureItem.setState(CameraPane.textureon);
262
+//
263
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
264
+// toggleSwitchItem.addItemListener(this);
265
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212266
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"));
267
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222268 toggleHandleItem.addItemListener(this);
223269 toggleHandleItem.setState(CameraPane.HANDLES);
224270
....@@ -273,7 +319,7 @@
273319 {
274320 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275321 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
322
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277323 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278324 oe.cameraMenu.add("-");
279325 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +327,7 @@
281327 editLeafItem.addActionListener(this);
282328 lookAtItem.addActionListener(this);
283329 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
330
+ //switchViewItem.addActionListener(this);
285331 }
286332
287333 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +372,29 @@
326372 }
327373
328374 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
331377 backItem = menu.add(new MenuItem("Back"));
332378 backItem.addActionListener(this);
333379 frontItem = menu.add(new MenuItem("Front"));
334380 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
381
+// compositeItem = menu.add(new MenuItem("Composite"));
382
+// compositeItem.addActionListener(this);
383
+
384
+ if (Globals.ADVANCED)
385
+ {
337386 hideItem = menu.add(new MenuItem("Hidden Group"));
338387 hideItem.addActionListener(this);
388
+ }
339389 ungroupItem = menu.add(new MenuItem("Ungroup"));
340390 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
391
+
392
+// menu.add("-");
393
+//
394
+// switchItem = menu.add(new MenuItem("Switch node"));
395
+// switchItem.addActionListener(this);
396
+ if (Globals.ADVANCED)
397
+ {
344398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345399 switchGeoItem.addActionListener(this);
346400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +402,6 @@
348402 morphItem = menu.add(new MenuItem("Morph Group"));
349403 morphItem.addActionListener(this);
350404
351
- if (Globals.ADVANCED)
352
- {
353405 menu.add("-");
354406 physicsItem = menu.add(new MenuItem("Physics"));
355407 physicsItem.addActionListener(this);
....@@ -357,13 +409,11 @@
357409 frameselectorItem.addActionListener(this);
358410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359411 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362412 }
363413
364414 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
367417 billboardItem = menu.add(new MenuItem("Billboard"));
368418 billboardItem.addActionListener(this);
369419 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +424,14 @@
374424 shadowYItem.addActionListener(this);
375425 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
377430 if (Globals.ADVANCED)
378431 {
379432 menu.add("-");
380433 linkerItem = menu.add(new MenuItem("Linker"));
381434 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384435 templateItem = menu.add(new MenuItem("Template"));
385436 templateItem.addActionListener(this);
386437 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +460,7 @@
409460 genNormalsMESHItem.addActionListener(this);
410461 if (Globals.ADVANCED)
411462 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413464 genNormalsMINEItem.addActionListener(this);
414465 }
415466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -502,10 +553,15 @@
502553 attachBumpItem.addActionListener(this);
503554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
504555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
505557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
506558 detachPigmentItem.addActionListener(this);
507559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
508560 detachBumpItem.addActionListener(this);
561
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
562
+ embedTexturesItem.addActionListener(this);
563
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
564
+ deEmbedTexturesItem.addActionListener(this);
509565 menu.add("-");
510566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
511567 sortbysizeItem.addActionListener(this);
....@@ -532,6 +588,7 @@
532588 buildToolsMenu(menu);
533589 }
534590
591
+
535592 void SetupUI2(ObjEditor oe)
536593 {
537594 // June 2019
....@@ -574,51 +631,79 @@
574631 oe.radioPanel.add(dummyButton);
575632 oe.buttonGroup.add(dummyButton);
576633 */
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
637
+
577638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578639
579640 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580641 //minButton.setToolTipText("Minimize window");
581642 //minButton.addActionListener(this);
582643
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
644
+ if (Globals.ADVANCED)
645
+ {
646
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ maxButton.setToolTipText("Maximize window");
648
+ maxButton.addActionListener(this);
649
+ }
586650
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588652 fullButton.setToolTipText("Full-screen window");
589653 fullButton.addActionListener(this);
590654
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
655
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ screenfitButton.setToolTipText("Screen fit");
657
+ screenfitButton.addActionListener(this);
658
+
659
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ restoreCameraButton.setToolTipText("Restore viewpoint");
661
+ restoreCameraButton.addActionListener(this);
594662
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");
663
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ saveButton.setToolTipText("New version");
601665 saveButton.addActionListener(this);
666
+
667
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ undoButton.setToolTipText("Previous version");
669
+ undoButton.addActionListener(this);
670
+ undoButton.setEnabled(false);
602671
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
672
+ cGridBag updown = new cGridBag().setVertical(true);
673
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ restoreButton.setToolTipText("Restore current");
675
+ restoreButton.addActionListener(this);
676
+ restoreButton.setEnabled(false);
677
+
678
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ replaceButton.setToolTipText("Replace current");
680
+ replaceButton.addActionListener(this);
681
+ replaceButton.setEnabled(false);
682
+
683
+ copyOptionsPanel.add(updown);
684
+
685
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ redoButton.setToolTipText("Next version");
687
+ redoButton.addActionListener(this);
688
+ redoButton.setEnabled(false);
689
+
690
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604691 liveCB.setToolTipText("Enable animation");
605692 liveCB.addItemListener(this);
606693
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608695 oneStepButton.setToolTipText("Animate one step forward");
609696 oneStepButton.addActionListener(this);
610697
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612699 fastCB.setToolTipText("Fast mode");
613700 fastCB.addItemListener(this);
614701
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);
702
+ //oe.toolboxPanel.Return();
703
+
704
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
705
+// trackCB.setToolTipText("Enable tracking");
706
+// trackCB.addItemListener(this);
622707
623708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624709 // screenfitpointButton.addActionListener(this);
....@@ -628,51 +713,225 @@
628713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629714 snapobjectButton.addActionListener(this);
630715 snapobjectButton.setToolTipText("Snap Object");
716
+
717
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
718
+ fourButton.addActionListener(this);
719
+ fourButton.setToolTipText("Show control panel only");
631720 }
632721
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
722
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
636723
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");
724
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ twoButton.setToolTipText("Show 3D view only");
641726 twoButton.addActionListener(this);
642
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643
- fourButton.addActionListener(this);
644
- fourButton.setToolTipText("Show left panel only");
645
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- sixButton.setToolTipText("2-column layout left");
647
- sixButton.addActionListener(this);
648
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
- threeButton.setToolTipText("2-column layout right");
727
+ this.fullscreenLayout = twoButton;
728
+
729
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ threeButton.setToolTipText("Show controls and 3D view");
650731 threeButton.addActionListener(this);
651
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- sevenButton.setToolTipText("3-column layout");
653
- sevenButton.addActionListener(this);
732
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
+ sixButton.setToolTipText("Show 3D view and controls");
734
+ sixButton.addActionListener(this);
735
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+// sevenButton.setToolTipText("3-column layout");
737
+// sevenButton.addActionListener(this);
654738 //
655739
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- rootButton.setToolTipText("Edit selection in new tab");
740
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ rootButton.setToolTipText("Open selection in new tab");
658742 rootButton.addActionListener(this);
659743
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661745 closeButton.setToolTipText("Close tab");
662746 closeButton.addActionListener(this);
663747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664748 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
749
+
750
+ cGridBag row1 = new cGridBag();
751
+
752
+ // INSERT
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ gridButton.setToolTipText("Create grid");
755
+ gridButton.addActionListener(this);
756
+
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
758
+ boxButton.setToolTipText("Create box");
759
+ boxButton.addActionListener(this);
760
+
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ sphereButton.setToolTipText("Create sphere");
763
+ sphereButton.addActionListener(this);
764
+
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ coneButton.setToolTipText("Create cone");
767
+ coneButton.addActionListener(this);
768
+
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ torusButton.setToolTipText("Create torus");
771
+ torusButton.addActionListener(this);
772
+
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
774
+ superButton.setToolTipText("Create superellipsoid");
775
+ superButton.addActionListener(this);
776
+
777
+ if (Globals.ADVANCED)
778
+ {
779
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ kleinButton.setToolTipText("Create Klein bottle");
781
+ kleinButton.addActionListener(this);
782
+ }
783
+
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ particlesButton.setToolTipText("Create particle system");
786
+ particlesButton.addActionListener(this);
787
+
788
+ oe.toolboxPanel.add(row1);
789
+
790
+ cGridBag row2 = new cGridBag();
791
+
792
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
793
+ groupButton.setToolTipText("Create group");
794
+ groupButton.addActionListener(this);
795
+
796
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ compositeButton.setToolTipText("Create composite");
798
+ compositeButton.addActionListener(this);
799
+
800
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ switchButton.setToolTipText("Create item switcher");
802
+ switchButton.addActionListener(this);
803
+
804
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ loopButton.setToolTipText("Create loop");
806
+ loopButton.addActionListener(this);
807
+
808
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ textureButton.setToolTipText("Create texture");
810
+ textureButton.addActionListener(this);
811
+
812
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ overlayButton.setToolTipText("Create overlay");
814
+ overlayButton.addActionListener(this);
815
+
816
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ lightButton.setToolTipText("Create light");
818
+ lightButton.addActionListener(this);
819
+
820
+ oe.toolboxPanel.add(row2);
821
+
822
+ // ENVYMAPS
823
+ cGridBag row3 = new cGridBag();
824
+ row3.preferredHeight = 20;
825
+
826
+ AddSkyboxButton("default", "rgb", row3);
827
+ AddSkyboxButton("default", "cornell", row3);
828
+ AddSkyboxButton("default", "uffizi", row3);
829
+ AddSkyboxButton("default", "CloudyHills", row3);
830
+ AddSkyboxButton("default", "skycube", row3);
831
+
832
+ oe.toolboxPanel.add(row3);
833
+
834
+ cGridBag row4 = new cGridBag();
835
+ row4.preferredHeight = 20;
836
+
837
+ AddSkyboxButton("bridge", "Bridge2", row4);
838
+ AddSkyboxButton("urban", "GamlaStan2", row4);
839
+ AddSkyboxButton("urban", "Parliament", row4);
840
+ AddSkyboxButton("urban", "Roundabout", row4);
841
+
842
+ oe.toolboxPanel.add(row4);
843
+
844
+ cGridBag row5 = new cGridBag();
845
+ row5.preferredHeight = 20;
846
+
847
+ AddSkyboxButton("urban", "SaintLazarusChurch", row5);
848
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row5);
849
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row5);
850
+ AddSkyboxButton("urban", "UnionSquare", row5);
851
+
852
+ oe.toolboxPanel.add(row5);
853
+
854
+ cGridBag row6 = new cGridBag();
855
+ row6.preferredHeight = 20;
856
+
857
+ AddSkyboxButton("park", "BerzeliiPark", row6);
858
+ AddSkyboxButton("park", "Buddha", row6);
859
+ AddSkyboxButton("park", "CNTower2", row6);
860
+ //AddSkyboxButton("park", "Fatbursparken", row6);
861
+ AddSkyboxButton("park", "NiagaraFalls1", row6);
862
+
863
+ oe.toolboxPanel.add(row6);
864
+
865
+ cGridBag row7 = new cGridBag();
866
+ row7.preferredHeight = 20;
867
+
868
+ AddSkyboxButton("park", "NiagaraFalls3", row7);
869
+ AddSkyboxButton("park", "Park", row7);
870
+ //AddSkyboxButton("park", "Park2", row6);
871
+ //AddSkyboxButton("park", "Path", row6);
872
+ AddSkyboxButton("park", "Pond", row7);
873
+ AddSkyboxButton("park", "Skansen", row7);
874
+
875
+ oe.toolboxPanel.add(row7);
876
+
877
+ cGridBag row8 = new cGridBag();
878
+ row8.preferredHeight = 20;
879
+
880
+ AddSkyboxButton("park", "Skansen2", row8);
881
+ AddSkyboxButton("park", "Skansen3", row8);
882
+ AddSkyboxButton("park", "Skansen4", row8);
883
+ AddSkyboxButton("park", "Skansen5", row8);
884
+
885
+ oe.toolboxPanel.add(row8);
886
+
887
+ cGridBag row9 = new cGridBag();
888
+ row9.preferredHeight = 20;
889
+
890
+ AddSkyboxButton("park", "Stairs", row9);
891
+ //AddSkyboxButton("park", "Tantolunden", row6);
892
+ //AddSkyboxButton("park", "Tantolunden3", row6);
893
+ AddSkyboxButton("park", "Tantolunden4", row9);
894
+
895
+ oe.toolboxPanel.add(row9);
896
+/*
897
+BerzeliiPark
898
+Buddha
899
+CNTower2
900
+Fatbursparken
901
+NiagaraFalls1
902
+NiagaraFalls3
903
+Park
904
+Park2
905
+Path
906
+Pond
907
+Skansen
908
+Skansen2
909
+Skansen3
910
+Skansen4
911
+Skansen5
912
+Stairs
913
+Tantolunden
914
+Tantolunden3
915
+Tantolunden4
916
+ */
917
+
918
+ for (int i=1; --i>=0;)
919
+ {
920
+ //oe.toolboxPanel.Return();
921
+ oe.toolboxPanel.add(new cGridBag());
922
+ }
923
+
924
+ // EDIT panel
925
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
926
+ editButton.setToolTipText("Pin selection controls");
668927 editButton.addActionListener(this);
669928
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
929
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
+ uneditButton.setToolTipText("Remove selection controls");
672931 uneditButton.addActionListener(this);
673932
674933 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
934
+ allParamsButton.setToolTipText("Show all controle");
676935 allParamsButton.addActionListener(this);
677936
678937 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +942,13 @@
683942 unselectButton.setToolTipText("Unselect");
684943 unselectButton.addActionListener(this);
685944
945
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
946
+ flashSelectionButton.setToolTipText("Highlight selection");
947
+ flashSelectionButton.addActionListener(this);
948
+
686949 editCommandsPanel.preferredHeight = 1;
687950
951
+ SetPinStates(false);
688952 // oe.treePanel.add(commandsPanel);
689953 // oe.treePanel.Return();
690954
....@@ -703,32 +967,20 @@
703967
704968 JScrollPane jSP;
705969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707971 ResetModel();
708972
709973 oe.treePanel.add(jSPPanel);
710974 oe.treePanel.Return();
711975
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;
727976 oe.treePanel.add(copyOptionsPanel);
728977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
729981
730
-// mainPanel.setDividerLocation(0.5); //1.0);
731
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
732984
733985 //jList.addListSelectionListener(this);
734986 oe.jTree.addTreeSelectionListener(this);
....@@ -736,7 +988,7 @@
736988 //jTree.setEditable(true);
737989 oe.jTree.setDragEnabled(true);
738990 //jTree.setPreferredSize(new Dimension(10,10));
739
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
740992
741993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
742994
....@@ -748,29 +1000,49 @@
7481000 dgr.addDragGestureListener(this);
7491001 }catch(Exception e) {}
7501002 */
751
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
7521004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7531005 }
7541006
7551007 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7561008 {
1009
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1010
+ colorCB.setToolTipText("Copy color when dropped");
1011
+ colorCB.addItemListener(this);
1012
+
1013
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1014
+ materialCB.setToolTipText("Copy material when dropped");
1015
+ materialCB.addItemListener(this);
1016
+
1017
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1018
+ textureCB.setToolTipText("Copy texture when dropped");
1019
+ textureCB.addItemListener(this);
1020
+
1021
+ panel.Return();
1022
+
7571023 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7581024 boxCB.setToolTipText("Display bounding boxes");
7591025 boxCB.addItemListener(this);
7601026
7611027 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1028
+ zoomBoxCB.setToolTipText("Display only for wheel");
7631029 zoomBoxCB.addItemListener(this);
7641030
7651031 if (true) // Globals.ADVANCED)
7661032 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
1033
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1034
+// supportCB.setToolTipText("Enable rigging");
1035
+// supportCB.addItemListener(this);
1036
+
1037
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1038
+ freezeCB.setToolTipText("Fast moving camera");
1039
+ freezeCB.addItemListener(this);
7701040
7711041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7721042 // localCB.addItemListener(this);
7731043
1044
+ panel.Return();
1045
+
7741046 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7751047 crowdCB.setToolTipText("Used for crowds");
7761048 crowdCB.addItemListener(this);
....@@ -787,6 +1059,8 @@
7871059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7881060 // speakerMocapCB.addItemListener(this);
7891061
1062
+ panel.Return();
1063
+
7901064 if (false)
7911065 {
7921066 // handled in scripts
....@@ -801,34 +1075,74 @@
8011075 //constraints.gridy += 1;
8021076 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
8031077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
8041079 }
8051080
8061081 //constraints.gridx += 1;
8071082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
8081083 // debugCB.addItemListener(this);
8091084
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
8101089 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1090
+ oeilCB.setToolTipText("Move camera when tracking");
8111091 oeilCB.addItemListener(this);
8121092
1093
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1094
+ shadowCB.setToolTipText("When live compute shadows");
1095
+ shadowCB.addItemListener(this);
1096
+
1097
+ panel.Return();
1098
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1099
+ toggleTextureCB.setToolTipText("Load textures");
1100
+ toggleTextureCB.addItemListener(this);
1101
+
1102
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1103
+ toggleSwitchCB.setToolTipText("Choose a single item");
1104
+ toggleSwitchCB.addItemListener(this);
1105
+
1106
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1107
+ autokeepCB.setToolTipText("On structure change");
1108
+ autokeepCB.addItemListener(this);
1109
+
1110
+ panel.Return();
1111
+ if (Globals.ADVANCED)
1112
+ {
8131113 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
8141114 lookAtCB.setToolTipText("Look-at target");
8151115 lookAtCB.addItemListener(this);
1116
+ }
8161117
8171118 }
8181119
8191120 cGridBag fill = new cGridBag();
820
-
8211121 fill.preferredHeight = 200;
1122
+ cGridBag fill2 = new cGridBag();
1123
+ fill2.preferredHeight = 200;
1124
+ cGridBag fill3 = new cGridBag();
1125
+ fill3.preferredHeight = 200;
8221126
8231127 panel.add(fill);
1128
+ panel.add(fill2);
1129
+ panel.add(fill3);
8241130
8251131 }
8261132
8271133 void EditObject(Object3D obj)
8281134 {
8291135 cRadio radioButton = new cRadio(obj.name);
1136
+
1137
+ // June 2019. Patch to avoid bug with transparency.
1138
+ radioButton.hadMaterial = obj.material != null;
1139
+ if (!radioButton.hadMaterial)
1140
+ {
1141
+ obj.material = new cMaterial();
1142
+ }
1143
+
8301144 radioButton.SetObject(obj);
831
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
8321146 radioButton.SetCamera(cameraView.renderCamera, false);
8331147 radioButton.addActionListener(this);
8341148 radioPanel.add(radioButton);
....@@ -848,23 +1162,28 @@
8481162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8491163 }
8501164
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;
1165
+ cToggleButton liveCB;
1166
+ cCheckBox supportCB;
1167
+ cCheckBox localCB;
1168
+ cCheckBox crowdCB;
1169
+ cCheckBox smoothCB;
1170
+ cToggleButton fastCB;
1171
+ cCheckBox slowCB;
1172
+ cCheckBox boxCB;
1173
+ cCheckBox zoomBoxCB;
1174
+ cCheckBox freezeCB;
1175
+ //cToggleButton trackCB;
1176
+ cCheckBox trackCB;
1177
+ cCheckBox smoothfocusCB;
8621178 // JCheckBox speakerMocapCB;
863
- JCheckBox speakerCameraCB;
864
- JCheckBox speakerFocusCB;
865
- JCheckBox debugCB;
866
- JCheckBox oeilCB;
867
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
8681187
8691188 // static int COLOR = 1;
8701189 // static int MATERIAL = 2;
....@@ -872,9 +1191,9 @@
8721191
8731192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8741193
875
- JCheckBox colorCB;
876
- JCheckBox materialCB;
877
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
8781197
8791198 public void itemStateChanged(ItemEvent e)
8801199 {
....@@ -967,6 +1286,18 @@
9671286 {
9681287 cameraView.ToggleOeil();
9691288 }
1289
+ else if(e.getSource() == shadowCB)
1290
+ {
1291
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1292
+ }
1293
+ else if(e.getSource() == freezeCB)
1294
+ {
1295
+ Globals.FREEZEONMOVE ^= true;
1296
+ }
1297
+ else if(e.getSource() == autokeepCB)
1298
+ {
1299
+ Globals.REPLACEONMAKE ^= true;
1300
+ }
9701301 else if(e.getSource() == lookAtCB)
9711302 {
9721303 cameraView.ToggleLookAt();
....@@ -983,7 +1314,8 @@
9831314
9841315 /**/
9851316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
986
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
9871319 if ((path == null) || (path.getPathCount() <= 1)) {
9881320 // We can't move the root node or an empty selection
9891321 return;
....@@ -1046,8 +1378,6 @@
10461378 }
10471379 }
10481380
1049
- String string = (String) object;
1050
-
10511381 System.out.println("Transfer = " + object + "; drop : " + target);
10521382 // if( object instanceof java.io.File[])
10531383 // {
....@@ -1055,6 +1385,8 @@
10551385 // objEditor.DropFile((java.io.File[]) object, true);
10561386 // return;
10571387 // }
1388
+
1389
+ String string = object.toString();
10581390
10591391 // File path for Mac and Windows
10601392 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1100,23 +1432,33 @@
11001432
11011433 assert target == objEditor.jTree;
11021434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
11031436 try {
1104
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11051438 } catch (Exception e) {
11061439 System.out.println("destinationPath : " + destinationPath);
11071440 return;
11081441 }
11091442
1110
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
11111444 {
1445
+ Object3D child = (Object3D)group.selection.elementAt(i);
1446
+
1447
+ // Cannot move into itself
1448
+ if (child == destinationLeaf)
1449
+ return;
1450
+ }
1451
+
1452
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1453
+// {
11121454 loadClipboard(true);
11131455 objEditor.jTree.setSelectionPath(destinationPath);
11141456 pasteInto(false, false);
1115
- } else {
1116
- loadClipboard(false);
1117
- objEditor.jTree.setSelectionPath(destinationPath);
1118
- pasteInto(false, false); // true); // ???
1119
- }
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
11201462 }
11211463 public void dropActionChanged(DropTargetDragEvent dtde)
11221464 // Called if the user has modified the current drop gesture
....@@ -1221,22 +1563,30 @@
12211563 {
12221564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12231565 //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);
1566
+// gridItem = menu.add(new MenuItem("Grid"));
1567
+// gridItem.addActionListener(this);
1568
+// rectoidItem = menu.add(new MenuItem("Box"));
1569
+// rectoidItem.addActionListener(this);
1570
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1571
+// ellipsoidItem.addActionListener(this);
1572
+// coneItem = menu.add(new MenuItem("Cone"));
1573
+// coneItem.addActionListener(this);
1574
+// torusItem = menu.add(new MenuItem("Torus"));
1575
+// torusItem.addActionListener(this);
1576
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1577
+// superItem.addActionListener(this);
1578
+
1579
+ cameraItem = menu.add(new MenuItem("Camera"));
1580
+ cameraItem.addActionListener(this);
1581
+
1582
+ if (!Globals.ADVANCED)
1583
+ {
12361584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12371585 kleinItem.addActionListener(this);
1238
- particleItem = menu.add(new MenuItem("Particle system"));
1239
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
12401590 if (Globals.ADVANCED)
12411591 {
12421592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1262,15 +1612,15 @@
12621612 }
12631613 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12641614 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);
1615
+// overlayItem = menu.add(new MenuItem("Overlay"));
1616
+// overlayItem.addActionListener(this);
1617
+// lightItem = menu.add(new MenuItem("Light"));
1618
+// lightItem.addActionListener(this);
12691619 menu.add("-");
12701620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12711621 //superLoopItem.addActionListener(this);
1272
- loopItem = menu.add(new MenuItem("Loop"));
1273
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
12741624 doubleItem = menu.add(new MenuItem("Fork"));
12751625 doubleItem.addActionListener(this);
12761626 if (Globals.ADVANCED)
....@@ -1286,6 +1636,9 @@
12861636 animationItem.addItemListener(this);
12871637 animationItem.setState(Globals.ANIMATION);
12881638
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
1641
+
12891642 menu.add("-");
12901643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12911644 parseverticesItem.addActionListener(this);
....@@ -1298,6 +1651,8 @@
12981651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12991652 reduce34MorphItem.addActionListener(this);
13001653 menu.add("-");
1654
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1655
+ memoryItem.addActionListener(this);
13011656 menu.add(computeAOItem = new MenuItem("Compute AO"));
13021657 computeAOItem.addActionListener(this);
13031658
....@@ -1306,8 +1661,6 @@
13061661 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13071662 mirrorItem.addActionListener(this);
13081663 menu.add("-");
1309
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1310
- memoryItem.addActionListener(this);
13111664 menu.add(analyzeItem = new MenuItem("Analyze"));
13121665 analyzeItem.addActionListener(this);
13131666 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1455,6 +1808,30 @@
14551808
14561809 makeSomething(shadow);
14571810 }
1811
+
1812
+ private void ClearUnpinned()
1813
+ {
1814
+ //for (Object3D obj : listUI)
1815
+ for (int i=listUI.size(); --i>=0;)
1816
+ {
1817
+ Object3D obj = listUI.elementAt(i);
1818
+ if (!obj.pinned)
1819
+ {
1820
+ obj.CloseUI();
1821
+ listUI.remove(i);
1822
+ }
1823
+ }
1824
+ }
1825
+
1826
+ private void EditElement(Object3D elem, boolean newWindow)
1827
+ {
1828
+ // if (!(elem instanceof Composite))
1829
+ // newWindow = false;
1830
+ listUI.add(elem);
1831
+ elem.openEditWindow(this, newWindow); //, false);
1832
+ System.out.println("edit : " + elem);
1833
+ elem.editWindow.refreshContents(true); // ? new
1834
+ }
14581835
14591836 /**
14601837 * applyExample
....@@ -1699,7 +2076,7 @@
16992076 {
17002077 ScreenFit();
17012078 } else
1702
- if (source == switchItem)
2079
+ if (source == switchViewItem)
17032080 {
17042081 cVector v1 = new cVector();
17052082 cVector v2 = new cVector();
....@@ -1708,11 +2085,11 @@
17082085 objEditor.cameraView.renderCamera.setAim(v2, v1);
17092086 objEditor.cameraView.repaint();
17102087 } else
1711
- if (source == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
17122089 {
17132090 makeSomething(new Box());
17142091 } else
1715
- if (source == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
17162093 {
17172094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17182095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1791,27 +2168,27 @@
17912168
17922169 makeSomething(obj);
17932170 } else
1794
- if (source == gridItem)
2171
+ if (source == gridItem || source == gridButton)
17952172 {
17962173 makeSomething(new Grid());
17972174 } else
1798
- if (source == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
17992176 {
18002177 makeSomething(new Sphere());
18012178 } else
1802
- if (source == coneItem)
2179
+ if (source == coneItem || source == coneButton)
18032180 {
18042181 makeSomething(new Cone());
18052182 } else
1806
- if (source == torusItem)
2183
+ if (source == torusItem || source == torusButton)
18072184 {
18082185 makeSomething(new Torus());
18092186 } else
1810
- if (source == superItem)
2187
+ if (source == superItem || source == superButton)
18112188 {
18122189 makeSomething(new Superellipsoid());
18132190 } else
1814
- if (source == kleinItem)
2191
+ if (source == kleinItem || source == kleinButton)
18152192 {
18162193 makeSomething(new Klein());
18172194 } else
....@@ -1831,7 +2208,7 @@
18312208 {
18322209 makeSomething(new BezierSurface());
18332210 } else
1834
- if (source == overlayItem)
2211
+ if (source == overlayItem || source == overlayButton)
18352212 {
18362213 /*
18372214 Object3D obj = new BezierSurface(5,8);
....@@ -1879,10 +2256,27 @@
18792256 s.setup();
18802257 makeSomething(s);
18812258 } else
1882
- if (source == lightItem)
2259
+ if (source == lightItem || source == lightButton)
18832260 {
18842261 makeSomething(new Light());
18852262 } else
2263
+// if (source == skybox1Button ||
2264
+// source == skybox2Button ||
2265
+// source == skybox3Button ||
2266
+// source == skybox4Button ||
2267
+// source == skybox5Button ||
2268
+// source == skybox6Button ||
2269
+// source == skybox7Button ||
2270
+// source == skybox11Button ||
2271
+// source == skybox12Button ||
2272
+// source == skybox13Button ||
2273
+// source == skybox14Button ||
2274
+// source == skybox15Button ||
2275
+// source == skybox16Button ||
2276
+// source == skybox17Button)
2277
+// {
2278
+// ChangeSkybox(source);
2279
+// } else
18862280 if (source == csgItem)
18872281 {
18882282 group(new CSG());
....@@ -1929,30 +2323,30 @@
19292323
19302324 group(g);
19312325 } else
1932
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
19332327 {
19342328 Composite csg = new GroupLeaf();
19352329 csg.count = 5;
19362330 group(csg);
1937
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
19382332 csg.addChild(child);
19392333 child.addChild(csg);
19402334 } else
19412335 if (source == doubleItem)
19422336 {
1943
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
19442338 csg.count = 5;
19452339 group(csg);
1946
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
19472341 csg.addChild(child);
19482342 child.addChild(csg);
1949
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
19502344 csg.addChild(child);
19512345 child.addChild(csg);
19522346 } else
19532347 if (source == tripleItem)
19542348 {
1955
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
19562350 csg.count = 4;
19572351 group(csg);
19582352 Composite child = new cGroup();
....@@ -1968,7 +2362,7 @@
19682362 if (source == computeAOItem)
19692363 {
19702364 Globals.drawMode = CameraPane.OCCLUSION;
1971
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
19722366 } else
19732367 if (source == recompileItem)
19742368 {
....@@ -2016,15 +2410,31 @@
20162410 } else
20172411 if (source == undoButton)
20182412 {
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20192416 Undo();
2417
+ } else
2418
+ if (source == restoreButton)
2419
+ {
2420
+ // Restore current version
2421
+ Restore();
2422
+ } else
2423
+ if (source == replaceButton)
2424
+ {
2425
+ // Overwrite current version
2426
+ Replace();
20202427 } else
20212428 if (source == redoButton)
20222429 {
2430
+ // Go to next version
20232431 Redo();
20242432 } else
20252433 if (source == saveButton)
20262434 {
2027
- Save();
2435
+ // Save a new version
2436
+ if (!Save(true))
2437
+ java.awt.Toolkit.getDefaultToolkit().beep();
20282438 } else
20292439 if (source == oneStepButton)
20302440 {
....@@ -2033,17 +2443,14 @@
20332443 } else
20342444 if (source == screenfitButton)
20352445 {
2036
- //Reload(lastConverter, lastFilename, true);
20372446 ScreenFit();
20382447 } else
20392448 if (source == screenfitpointButton)
20402449 {
2041
- //Reload(lastConverter, lastFilename, true);
20422450 ScreenFitPoint();
20432451 } else
20442452 if (source == snapobjectButton)
20452453 {
2046
- //Reload(lastConverter, lastFilename, true);
20472454 SnapObject();
20482455 } else
20492456 // if (event.getSource() == recompileButton)
....@@ -2407,7 +2814,7 @@
24072814 {
24082815 StepAll();
24092816 } else
2410
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
24112818 {
24122819 //int indices[] = jList.getSelectedIndices();
24132820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2419,9 +2826,9 @@
24192826 {
24202827 ClearSelection(true);
24212828 } else
2422
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
24232830 {
2424
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
24252832 } else
24262833 if (source == hideItem)
24272834 {
....@@ -2439,11 +2846,11 @@
24392846 {
24402847 makeSomething(new Camera());
24412848 } else
2442
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
24432850 {
24442851 group(new Composite());
24452852 } else
2446
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
24472854 {
24482855 RandomNode random = new RandomNode();
24492856 group(random);
....@@ -2545,7 +2952,7 @@
25452952 {
25462953 group(new cLinker());
25472954 } else
2548
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
25492956 {
25502957 group(new TextureNode());
25512958 } else
....@@ -2565,17 +2972,30 @@
25652972 {
25662973 CastShadow(2);
25672974 } else
2568
- if (source == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
25692976 {
2570
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
25712979 for (int i=0; i<group.selection.size(); i++)
25722980 {
2573
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
25742986 }
25752987
2576
- ClearSelection(false);
2577
-
2578
- refreshContents();
2988
+ if (!hasRoot)
2989
+ {
2990
+ for (int i=0; i<group.selection.size(); i++)
2991
+ {
2992
+ Ungroup(group.selection.get(i));
2993
+ }
2994
+
2995
+ ClearSelection(false);
2996
+
2997
+ refreshContents();
2998
+ }
25792999 } else
25803000 if (source == genUVItem)
25813001 {
....@@ -2876,7 +3296,7 @@
28763296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28773297 {
28783298 obj = (Object3D)e.nextElement();
2879
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
28803300 }
28813301
28823302 refreshContents();
....@@ -2892,6 +3312,31 @@
28923312
28933313 refreshContents();
28943314 } else
3315
+ if (source == embedTexturesItem)
3316
+ {
3317
+ Object3D obj;
3318
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3319
+ {
3320
+ obj = (Object3D)e.nextElement();
3321
+ obj.EmbedTextures(true);
3322
+ }
3323
+
3324
+ refreshContents();
3325
+ } else
3326
+ if (source == deEmbedTexturesItem)
3327
+ {
3328
+ Object3D obj;
3329
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3330
+ {
3331
+ obj = (Object3D)e.nextElement();
3332
+ obj.EmbedTextures(false);
3333
+ }
3334
+
3335
+ CameraPane.texturepigment.clear();
3336
+ CameraPane.texturebump.clear();
3337
+
3338
+ refreshContents();
3339
+ } else
28953340 if (source == flashSelectionButton)
28963341 {
28973342 CameraPane.flash = true;
....@@ -2903,6 +3348,10 @@
29033348 if (source == twoButton)
29043349 {
29053350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
29063355 // bug
29073356 //gridPanel.setDividerLocation(1.0);
29083357 //bigPanel.setDividerLocation(0.0);
....@@ -2958,6 +3407,9 @@
29583407 {
29593408 radio.layout = threeButton;
29603409
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
3412
+
29613413 // bigThree.remove(scenePanel);
29623414 // bigThree.remove(centralPanel);
29633415 // bigThree.remove(XYZPanel);
....@@ -2986,8 +3438,8 @@
29863438 // centralPanel.setVisible(true);
29873439 // XYZPanel.setVisible(true);
29883440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
29893442 bigThree.add(centralPanel);
2990
- bigThree.add(XYZPanel);
29913443 bigThree.FlushUI();
29923444
29933445 cameraView.requestFocusInWindow();
....@@ -2995,6 +3447,9 @@
29953447 if (source == fourButton)
29963448 {
29973449 radio.layout = fourButton;
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
29983453
29993454 // bigThree.remove(scenePanel);
30003455 // bigThree.remove(centralPanel);
....@@ -3033,6 +3488,9 @@
30333488 {
30343489 radio.layout = sixButton;
30353490
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
3493
+
30363494 // bigThree.remove(scenePanel);
30373495 // bigThree.remove(centralPanel);
30383496 // bigThree.remove(XYZPanel);
....@@ -3061,8 +3519,8 @@
30613519 // centralPanel.setVisible(true);
30623520 // XYZPanel.setVisible(false);
30633521 bigThree.ClearUI();
3064
- bigThree.add(scenePanel);
30653522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
30663524 bigThree.FlushUI();
30673525
30683526 cameraView.requestFocusInWindow();
....@@ -3070,6 +3528,9 @@
30703528 if (source == sevenButton)
30713529 {
30723530 radio.layout = sevenButton;
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
30733534
30743535 // bigThree.remove(scenePanel);
30753536 // bigThree.remove(centralPanel);
....@@ -3126,12 +3587,19 @@
31263587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31273588 {
31283589 ab = (cRadio)e.nextElement();
3129
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31303591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
31313598 buttonGroup.remove(ab);
31323599 radioPanel.remove(ab);
31333600
3134
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
31353603 // ab.GetObject().objectUI = null; // ?????????
31363604
31373605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3144,6 +3612,12 @@
31443612 } else
31453613 if (source == editItem || source == editButton)
31463614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
31473621 EditSelection(false);
31483622 } else
31493623 if (source == uneditButton)
....@@ -3153,6 +3627,7 @@
31533627 Object3D child = (Object3D)e.nextElement();
31543628 if(child.editWindow != null)
31553629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
31563631 child.CloseUI();
31573632 listUI.remove(child);
31583633
....@@ -3169,6 +3644,7 @@
31693644 //copy.ClearUI();
31703645 for (Object3D obj : listUI)
31713646 {
3647
+ obj.pinned = false;
31723648 obj.CloseUI();
31733649 }
31743650 listUI.clear();
....@@ -3178,7 +3654,7 @@
31783654 {
31793655 assert(copy == group);
31803656
3181
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31823658
31833659 for (Object3D obj : listUI)
31843660 {
....@@ -3227,6 +3703,9 @@
32273703 }
32283704
32293705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
32303709 //Globals.theRenderer.object = group;
32313710 if(!useclient)
32323711 {
....@@ -3245,6 +3724,7 @@
32453724
32463725 // fix "+" issue
32473726 //group.editWindow = this;
3727
+ group.manipWindow = this;
32483728
32493729 /*
32503730 currentLayout = radio.layout;
....@@ -3252,6 +3732,13 @@
32523732 currentLayout = sevenButton;
32533733 */
32543734 radio.layout.doClick();
3735
+
3736
+ ClearUnpinned();
3737
+ //Grafreed.Assert(group != null);
3738
+ //Grafreed.Assert(group.selection != null);
3739
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3740
+ if (group.selection == null || group.selection.size() == 1)
3741
+ EditSelection(false);
32553742 keepparent = group.parent;
32563743 // PARENT = NULL or not???
32573744 //group.parent = null; // ROOT
....@@ -3265,7 +3752,7 @@
32653752 cameraView.ProtectCamera();
32663753 cameraView.repaint();
32673754 return;
3268
- } else if (event.getSource() == revertCameraItem)
3755
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32693756 {
32703757 cameraView.RevertCamera();
32713758 cameraView.repaint();
....@@ -3844,7 +4331,7 @@
38444331
38454332 try
38464333 {
3847
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
38484335 }
38494336 catch (Exception e)
38504337 {
....@@ -4319,28 +4806,25 @@
43194806 // }
43204807 // }
43214808
4322
- static boolean allparams = true;
4323
-
4324
- static Vector<Object3D> listUI = new Vector<Object3D>();
4325
-
43264809 void EditSelection(boolean newWindow)
43274810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
43284817 // aConstraints.gridy = 0;
43294818 for (int i=0; i<group.selection.size(); i++)
43304819 {
43314820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43324821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4333
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43344823
43354824 Object3D elem = (Object3D)group.selection.elementAt(i);
43364825 if(elem != group || !newWindow)
43374826 {
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
4827
+ EditElement(elem, newWindow); // ? new
43444828 }
43454829 }
43464830 }
....@@ -4415,7 +4899,8 @@
44154899 //new Exception().printStackTrace();
44164900
44174901 freezemodel = true;
4418
-
4902
+ ClearUnpinned();
4903
+
44194904 /**/
44204905 //switch (event.id)
44214906 {
....@@ -4448,7 +4933,7 @@
44484933 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44494934 // a camera
44504935 {
4451
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4936
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44524937 {
44534938 CameraPane.camerachangeframe = 0; // don't refuse it
44544939 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4457,6 +4942,13 @@
44574942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44584943 }
44594944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
44604952 refreshContents();
44614953 //return true;
44624954 }
....@@ -4466,9 +4958,18 @@
44664958 freezemodel = false;
44674959 }
44684960
4961
+ void SetPinStates(boolean enabled)
4962
+ {
4963
+ editButton.setEnabled(enabled);
4964
+ uneditButton.setEnabled(enabled);
4965
+ unselectButton.setEnabled(enabled);
4966
+ flashSelectionButton.setEnabled(enabled);
4967
+ }
4968
+
44694969 void refreshContents(boolean cp)
44704970 {
4471
- if (!Globals.MOUSEDRAGGED)
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4972
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44724973 {
44734974 objEditor.ClearInfo(); // .GetMaterial());
44744975
....@@ -4567,7 +5068,8 @@
45675068
45685069 if (cut)
45695070 {
4570
- Save();
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
45715073 //int indices[] = jList.getSelectedIndices();
45725074 //for (int i = indices.length - 1; i >= 0; i--)
45735075 //jList.remove(indices[i]);
....@@ -4670,6 +5172,10 @@
46705172
46715173 void paste(boolean expand)
46725174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
46735179 // if (GrafreeD.clipboard == null)
46745180 // return;
46755181 boolean first = true;
....@@ -4729,6 +5235,7 @@
47295235 Grafreed.clipboard.get(0).parent = keepparent;
47305236 }
47315237
5238
+ Globals.REPLACEONMAKE = keep;
47325239 ResetModel();
47335240 refreshContents();
47345241 }
....@@ -4864,6 +5371,10 @@
48645371
48655372 void group(Object3D csg, boolean grab)
48665373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
48675378 if (//false) // why??
48685379 !group.selection.isEmpty())
48695380 {
....@@ -4977,10 +5488,15 @@
49775488 //node.add(csg);
49785489 //makeSomething(node);
49795490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
49805492 }
49815493
49825494 void Ungroup(Object3D g)
49835495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
49845500 if (g instanceof HiddenObject)
49855501 {
49865502 HiddenObject h = (HiddenObject) g;
....@@ -4997,6 +5513,7 @@
49975513 objEditor.makeSomething(g.get(i), false);
49985514 }
49995515 }
5516
+ Globals.REPLACEONMAKE = keep;
50005517 }
50015518
50025519 void ungroup()
....@@ -5285,13 +5802,44 @@
52855802 cButton clearpanelButton;
52865803 cButton unselectButton;
52875804
5288
- cButton minButton;
5289
- cButton maxButton;
5290
- cButton fullButton;
5291
- cButton undoButton;
5292
- cButton redoButton;
5805
+ cButton restoreCameraButton;
5806
+
52935807 cButton saveButton;
52945808 cButton oneStepButton;
5809
+
5810
+ cButton groupButton;
5811
+ cButton ungroupButton;
5812
+ cButton compositeButton;
5813
+ cButton switchButton;
5814
+ cButton loopButton;
5815
+ cButton textureButton;
5816
+
5817
+ cButton skybox1Button;
5818
+ cButton skybox2Button;
5819
+ cButton skybox3Button;
5820
+ cButton skybox4Button;
5821
+ cButton skybox5Button;
5822
+ cButton skybox6Button;
5823
+ cButton skybox7Button;
5824
+
5825
+ cButton skybox11Button;
5826
+ cButton skybox12Button;
5827
+ cButton skybox13Button;
5828
+ cButton skybox14Button;
5829
+ cButton skybox15Button;
5830
+ cButton skybox16Button;
5831
+ cButton skybox17Button;
5832
+
5833
+ cButton gridButton;
5834
+ cButton boxButton;
5835
+ cButton sphereButton;
5836
+ cButton coneButton;
5837
+ cButton torusButton;
5838
+ cButton superButton;
5839
+ cButton kleinButton;
5840
+ cButton particlesButton;
5841
+ cButton overlayButton;
5842
+ cButton lightButton;
52955843
52965844 cButton screenfitButton;
52975845 cButton screenfitpointButton;
....@@ -5313,11 +5861,11 @@
53135861 //JTree jTree;
53145862 private MenuItem lookAtItem;
53155863 private MenuItem lookFromItem;
5316
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
53175865 private MenuItem cutItem;
53185866 private MenuItem undoItem;
53195867 private MenuItem redoItem;
5320
- private MenuItem duplicateItem;
5868
+ private JMenuItem duplicateItem;
53215869 private MenuItem cloneItem;
53225870 private MenuItem cloneSupportItem;
53235871 private MenuItem overwriteGeoItem;
....@@ -5345,7 +5893,7 @@
53455893 private MenuItem pasteLinkItem;
53465894 private MenuItem pasteCloneItem;
53475895 private MenuItem pasteExpandItem;
5348
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
53495897 private MenuItem clearAllItem;
53505898 private MenuItem genUVItem;
53515899 private MenuItem genNormalsMESHItem;
....@@ -5405,7 +5953,7 @@
54055953 private MenuItem frontItem;
54065954 private MenuItem cameraItem;
54075955 private MenuItem compositeItem;
5408
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
54095957 private MenuItem physicsItem;
54105958 private MenuItem frameselectorItem;
54115959 private MenuItem scriptNodeItem;
....@@ -5429,6 +5977,8 @@
54295977 private MenuItem attachBumpItem;
54305978 private MenuItem detachBumpItem;
54315979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
54325982
54335983 private MenuItem particleItem;
54345984 private MenuItem ragdollItem;
....@@ -5479,5 +6029,5 @@
54796029
54806030 Menu cameraMenu;
54816031 MenuItem editCameraItem;
5482
- MenuItem revertCameraItem;
6032
+ MenuItem restoreCameraItem;
54836033 }