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)
....@@ -189,8 +233,8 @@
189233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190234 // pasteExpandItem.addActionListener(this);
191235 menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
194238
195239 if (Globals.ADVANCED)
196240 {
....@@ -204,23 +248,23 @@
204248 //zBufferItem.addActionListener(this);
205249 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206250 //normalLensItem.addActionListener(this);
207
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
208
- revertCameraItem.addActionListener(this);
251
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
252
+ restoreCameraItem.addActionListener(this);
209253
210
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
- toggleFullScreenItem.addItemListener(this);
212
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
- 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);
214266
215
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
- toggleTextureItem.addItemListener(this);
217
- toggleTextureItem.setState(CameraPane.textureon);
218
-
219
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
- toggleSwitchItem.addItemListener(this);
221
- toggleSwitchItem.setState(CameraPane.SWITCH);
222
-
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
267
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224268 toggleHandleItem.addItemListener(this);
225269 toggleHandleItem.setState(CameraPane.HANDLES);
226270
....@@ -275,7 +319,7 @@
275319 {
276320 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277321 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
322
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279323 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280324 oe.cameraMenu.add("-");
281325 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -283,7 +327,7 @@
283327 editLeafItem.addActionListener(this);
284328 lookAtItem.addActionListener(this);
285329 //lookFromItem.addActinoListener(this);
286
- //switchItem.addActionListener(this);
330
+ //switchViewItem.addActionListener(this);
287331 }
288332
289333 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -328,14 +372,14 @@
328372 }
329373
330374 oe.menuBar.add(menu = new Menu("Group"));
331
- grabItem = menu.add(new MenuItem("Grab"));
332
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
333377 backItem = menu.add(new MenuItem("Back"));
334378 backItem.addActionListener(this);
335379 frontItem = menu.add(new MenuItem("Front"));
336380 frontItem.addActionListener(this);
337
- compositeItem = menu.add(new MenuItem("Composite"));
338
- compositeItem.addActionListener(this);
381
+// compositeItem = menu.add(new MenuItem("Composite"));
382
+// compositeItem.addActionListener(this);
339383
340384 if (Globals.ADVANCED)
341385 {
....@@ -345,10 +389,10 @@
345389 ungroupItem = menu.add(new MenuItem("Ungroup"));
346390 ungroupItem.addActionListener(this);
347391
348
- menu.add("-");
349
-
350
- randomItem = menu.add(new MenuItem("Switch node"));
351
- randomItem.addActionListener(this);
392
+// menu.add("-");
393
+//
394
+// switchItem = menu.add(new MenuItem("Switch node"));
395
+// switchItem.addActionListener(this);
352396 if (Globals.ADVANCED)
353397 {
354398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
....@@ -365,13 +409,11 @@
365409 frameselectorItem.addActionListener(this);
366410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
367411 scriptNodeItem.addActionListener(this);
368
- cameraItem = menu.add(new MenuItem("Camera"));
369
- cameraItem.addActionListener(this);
370412 }
371413
372414 oe.menuBar.add(menu = new Menu("Object"));
373
- textureItem = menu.add(new MenuItem("Texture"));
374
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
375417 billboardItem = menu.add(new MenuItem("Billboard"));
376418 billboardItem.addActionListener(this);
377419 csgItem = menu.add(new MenuItem("CSG"));
....@@ -382,13 +424,14 @@
382424 shadowYItem.addActionListener(this);
383425 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
384426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
385430 if (Globals.ADVANCED)
386431 {
387432 menu.add("-");
388433 linkerItem = menu.add(new MenuItem("Linker"));
389434 linkerItem.addActionListener(this);
390
- attributeItem = menu.add(new MenuItem("Attribute"));
391
- attributeItem.addActionListener(this);
392435 templateItem = menu.add(new MenuItem("Template"));
393436 templateItem.addActionListener(this);
394437 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -417,7 +460,7 @@
417460 genNormalsMESHItem.addActionListener(this);
418461 if (Globals.ADVANCED)
419462 {
420
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
421464 genNormalsMINEItem.addActionListener(this);
422465 }
423466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -510,10 +553,15 @@
510553 attachBumpItem.addActionListener(this);
511554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
512555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
513557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
514558 detachPigmentItem.addActionListener(this);
515559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
516560 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);
517565 menu.add("-");
518566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
519567 sortbysizeItem.addActionListener(this);
....@@ -540,6 +588,7 @@
540588 buildToolsMenu(menu);
541589 }
542590
591
+
543592 void SetupUI2(ObjEditor oe)
544593 {
545594 // June 2019
....@@ -582,53 +631,79 @@
582631 oe.radioPanel.add(dummyButton);
583632 oe.buttonGroup.add(dummyButton);
584633 */
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
637
+
585638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
586639
587640 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588641 //minButton.setToolTipText("Minimize window");
589642 //minButton.addActionListener(this);
590643
591
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- maxButton.setToolTipText("Maximize window");
593
- 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
+ }
594650
595651 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596652 fullButton.setToolTipText("Full-screen window");
597653 fullButton.addActionListener(this);
598654
599
- oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- undoButton.setToolTipText("Undo changes");
601
- 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);
602662
603
- oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
604
- redoButton.setToolTipText("Redo changes");
605
- redoButton.addActionListener(this);
606
-
607
- oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- saveButton.setToolTipText("Save changes");
663
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ saveButton.setToolTipText("New version");
609665 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);
610671
611
- oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", 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);
612691 liveCB.setToolTipText("Enable animation");
613692 liveCB.addItemListener(this);
614693
615
- oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616695 oneStepButton.setToolTipText("Animate one step forward");
617696 oneStepButton.addActionListener(this);
618697
619
- oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
620699 fastCB.setToolTipText("Fast mode");
621700 fastCB.addItemListener(this);
622701
623
- oe.toolboxPanel.Return();
702
+ //oe.toolboxPanel.Return();
624703
625
- oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
626
- trackCB.setToolTipText("Enable tracking");
627
- trackCB.addItemListener(this);
628
-
629
- oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
- screenfitButton.setToolTipText("Screen fit");
631
- screenfitButton.addActionListener(this);
704
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
705
+// trackCB.setToolTipText("Enable tracking");
706
+// trackCB.addItemListener(this);
632707
633708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
634709 // screenfitpointButton.addActionListener(this);
....@@ -638,35 +713,32 @@
638713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639714 snapobjectButton.addActionListener(this);
640715 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");
641720 }
642721
643
- oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
- flashSelectionButton.setToolTipText("Highlight selection");
645
- flashSelectionButton.addActionListener(this);
646
-
647722 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
648723
649
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- 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");
651726 twoButton.addActionListener(this);
652727 this.fullscreenLayout = twoButton;
653728
654
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
655
- fourButton.addActionListener(this);
656
- fourButton.setToolTipText("Show left panel only");
657
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658
- sixButton.setToolTipText("2-column layout left");
659
- sixButton.addActionListener(this);
660
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
- threeButton.setToolTipText("2-column layout right");
729
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ threeButton.setToolTipText("Show controls and 3D view");
662731 threeButton.addActionListener(this);
663
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
- sevenButton.setToolTipText("3-column layout");
665
- 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);
666738 //
667739
668
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
- 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");
670742 rootButton.addActionListener(this);
671743
672744 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -675,30 +747,30 @@
675747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
676748 //clearButton.addActionListener(this);
677749
750
+ cGridBag row1 = new cGridBag();
751
+
678752 // INSERT
679
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680754 gridButton.setToolTipText("Create grid");
681755 gridButton.addActionListener(this);
682756
683
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684758 boxButton.setToolTipText("Create box");
685759 boxButton.addActionListener(this);
686760
687
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688762 sphereButton.setToolTipText("Create sphere");
689763 sphereButton.addActionListener(this);
690764
691
- oe.toolboxPanel.Return();
692
-
693
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694766 coneButton.setToolTipText("Create cone");
695767 coneButton.addActionListener(this);
696768
697
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698770 torusButton.setToolTipText("Create torus");
699771 torusButton.addActionListener(this);
700772
701
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702774 superButton.setToolTipText("Create superellipsoid");
703775 superButton.addActionListener(this);
704776
....@@ -709,29 +781,157 @@
709781 kleinButton.addActionListener(this);
710782 }
711783
712
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713785 particlesButton.setToolTipText("Create particle system");
714786 particlesButton.addActionListener(this);
715787
716
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
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);
717813 overlayButton.setToolTipText("Create overlay");
718814 overlayButton.addActionListener(this);
719815
720
- oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
816
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721817 lightButton.setToolTipText("Create light");
722818 lightButton.addActionListener(this);
723819
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
+
724924 // EDIT panel
725
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
- editButton.setToolTipText("Edit selection");
925
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
926
+ editButton.setToolTipText("Pin selection controls");
727927 editButton.addActionListener(this);
728928
729
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
- uneditButton.setToolTipText("Unedit selection");
929
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
+ uneditButton.setToolTipText("Remove selection controls");
731931 uneditButton.addActionListener(this);
732932
733933 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
734
- allParamsButton.setToolTipText("Edit all params");
934
+ allParamsButton.setToolTipText("Show all controle");
735935 allParamsButton.addActionListener(this);
736936
737937 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -742,8 +942,13 @@
742942 unselectButton.setToolTipText("Unselect");
743943 unselectButton.addActionListener(this);
744944
945
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
946
+ flashSelectionButton.setToolTipText("Highlight selection");
947
+ flashSelectionButton.addActionListener(this);
948
+
745949 editCommandsPanel.preferredHeight = 1;
746950
951
+ SetPinStates(false);
747952 // oe.treePanel.add(commandsPanel);
748953 // oe.treePanel.Return();
749954
....@@ -768,26 +973,14 @@
768973 oe.treePanel.add(jSPPanel);
769974 oe.treePanel.Return();
770975
771
- cGridBag copyOptionsPanel = new cGridBag();
772
-
773
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
774
- colorCB.setToolTipText("Copy color when dropped");
775
- colorCB.addItemListener(this);
776
-
777
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
778
- materialCB.setToolTipText("Copy material when dropped");
779
- materialCB.addItemListener(this);
780
-
781
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
782
- textureCB.setToolTipText("Copy texture when dropped");
783
- textureCB.addItemListener(this);
784
-
785
- copyOptionsPanel.preferredHeight = 1;
786976 oe.treePanel.add(copyOptionsPanel);
787977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
788981
789
-// mainPanel.setDividerLocation(0.5); //1.0);
790
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
791984
792985 //jList.addListSelectionListener(this);
793986 oe.jTree.addTreeSelectionListener(this);
....@@ -795,7 +988,7 @@
795988 //jTree.setEditable(true);
796989 oe.jTree.setDragEnabled(true);
797990 //jTree.setPreferredSize(new Dimension(10,10));
798
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
799992
800993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
801994
....@@ -807,29 +1000,49 @@
8071000 dgr.addDragGestureListener(this);
8081001 }catch(Exception e) {}
8091002 */
810
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
8111004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8121005 }
8131006
8141007 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
8151008 {
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
+
8161023 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
8171024 boxCB.setToolTipText("Display bounding boxes");
8181025 boxCB.addItemListener(this);
8191026
8201027 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
821
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1028
+ zoomBoxCB.setToolTipText("Display only for wheel");
8221029 zoomBoxCB.addItemListener(this);
8231030
8241031 if (true) // Globals.ADVANCED)
8251032 {
826
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
827
- supportCB.setToolTipText("Enable rigging");
828
- 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);
8291040
8301041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
8311042 // localCB.addItemListener(this);
8321043
1044
+ panel.Return();
1045
+
8331046 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
8341047 crowdCB.setToolTipText("Used for crowds");
8351048 crowdCB.addItemListener(this);
....@@ -846,6 +1059,8 @@
8461059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
8471060 // speakerMocapCB.addItemListener(this);
8481061
1062
+ panel.Return();
1063
+
8491064 if (false)
8501065 {
8511066 // handled in scripts
....@@ -860,24 +1075,39 @@
8601075 //constraints.gridy += 1;
8611076 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
8621077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
8631079 }
8641080
8651081 //constraints.gridx += 1;
8661082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
8671083 // debugCB.addItemListener(this);
8681084
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
8691089 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
- oeilCB.setToolTipText("Move camera when tracking target");
1090
+ oeilCB.setToolTipText("Move camera when tracking");
8711091 oeilCB.addItemListener(this);
8721092
8731093 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
- shadowCB.setToolTipText("Compute shadows when live");
1094
+ shadowCB.setToolTipText("When live compute shadows");
8751095 shadowCB.addItemListener(this);
8761096
877
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
- autosaveCB.setToolTipText("Auto-save on structure change");
879
- autosaveCB.addItemListener(this);
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);
8801109
1110
+ panel.Return();
8811111 if (Globals.ADVANCED)
8821112 {
8831113 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -888,10 +1118,15 @@
8881118 }
8891119
8901120 cGridBag fill = new cGridBag();
891
-
8921121 fill.preferredHeight = 200;
1122
+ cGridBag fill2 = new cGridBag();
1123
+ fill2.preferredHeight = 200;
1124
+ cGridBag fill3 = new cGridBag();
1125
+ fill3.preferredHeight = 200;
8931126
8941127 panel.add(fill);
1128
+ panel.add(fill2);
1129
+ panel.add(fill3);
8951130
8961131 }
8971132
....@@ -899,7 +1134,7 @@
8991134 {
9001135 cRadio radioButton = new cRadio(obj.name);
9011136
902
- // Patch to avoid bug with transparency.
1137
+ // June 2019. Patch to avoid bug with transparency.
9031138 radioButton.hadMaterial = obj.material != null;
9041139 if (!radioButton.hadMaterial)
9051140 {
....@@ -907,7 +1142,7 @@
9071142 }
9081143
9091144 radioButton.SetObject(obj);
910
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
9111146 radioButton.SetCamera(cameraView.renderCamera, false);
9121147 radioButton.addActionListener(this);
9131148 radioPanel.add(radioButton);
....@@ -936,7 +1171,9 @@
9361171 cCheckBox slowCB;
9371172 cCheckBox boxCB;
9381173 cCheckBox zoomBoxCB;
939
- cToggleButton trackCB;
1174
+ cCheckBox freezeCB;
1175
+ //cToggleButton trackCB;
1176
+ cCheckBox trackCB;
9401177 cCheckBox smoothfocusCB;
9411178 // JCheckBox speakerMocapCB;
9421179 cCheckBox speakerCameraCB;
....@@ -945,7 +1182,7 @@
9451182
9461183 cCheckBox oeilCB;
9471184 cCheckBox shadowCB;
948
- cCheckBox autosaveCB;
1185
+ cCheckBox autokeepCB;
9491186 cCheckBox lookAtCB;
9501187
9511188 // static int COLOR = 1;
....@@ -1053,9 +1290,13 @@
10531290 {
10541291 Globals.COMPUTESHADOWWHENLIVE ^= true;
10551292 }
1056
- else if(e.getSource() == autosaveCB)
1293
+ else if(e.getSource() == freezeCB)
10571294 {
1058
- Globals.SAVEONMAKE ^= true;
1295
+ Globals.FREEZEONMOVE ^= true;
1296
+ }
1297
+ else if(e.getSource() == autokeepCB)
1298
+ {
1299
+ Globals.REPLACEONMAKE ^= true;
10591300 }
10601301 else if(e.getSource() == lookAtCB)
10611302 {
....@@ -1137,8 +1378,6 @@
11371378 }
11381379 }
11391380
1140
- String string = (String) object;
1141
-
11421381 System.out.println("Transfer = " + object + "; drop : " + target);
11431382 // if( object instanceof java.io.File[])
11441383 // {
....@@ -1146,6 +1385,8 @@
11461385 // objEditor.DropFile((java.io.File[]) object, true);
11471386 // return;
11481387 // }
1388
+
1389
+ String string = object.toString();
11491390
11501391 // File path for Mac and Windows
11511392 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1191,13 +1432,23 @@
11911432
11921433 assert target == objEditor.jTree;
11931434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
11941436 try {
1195
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11961438 } catch (Exception e) {
11971439 System.out.println("destinationPath : " + destinationPath);
11981440 return;
11991441 }
12001442
1443
+ for (int i=group.selection.size(); --i>=0;)
1444
+ {
1445
+ Object3D child = (Object3D)group.selection.elementAt(i);
1446
+
1447
+ // Cannot move into itself
1448
+ if (child == destinationLeaf)
1449
+ return;
1450
+ }
1451
+
12011452 // june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
12021453 // {
12031454 loadClipboard(true);
....@@ -1312,22 +1563,30 @@
13121563 {
13131564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
13141565 //heightFieldItem.addActionListener(this);
1315
- gridItem = menu.add(new MenuItem("Grid"));
1316
- gridItem.addActionListener(this);
1317
- rectoidItem = menu.add(new MenuItem("Box"));
1318
- rectoidItem.addActionListener(this);
1319
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1320
- ellipsoidItem.addActionListener(this);
1321
- coneItem = menu.add(new MenuItem("Cone"));
1322
- coneItem.addActionListener(this);
1323
- torusItem = menu.add(new MenuItem("Torus"));
1324
- torusItem.addActionListener(this);
1325
- superItem = menu.add(new MenuItem("Superellipsoid"));
1326
- 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
+ {
13271584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
13281585 kleinItem.addActionListener(this);
1329
- particleItem = menu.add(new MenuItem("Particle system"));
1330
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
13311590 if (Globals.ADVANCED)
13321591 {
13331592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1353,15 +1612,15 @@
13531612 }
13541613 bezierItem = menu.add(new MenuItem("Bezier Patch"));
13551614 bezierItem.addActionListener(this);
1356
- overlayItem = menu.add(new MenuItem("Overlay"));
1357
- overlayItem.addActionListener(this);
1358
- lightItem = menu.add(new MenuItem("Light"));
1359
- 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);
13601619 menu.add("-");
13611620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13621621 //superLoopItem.addActionListener(this);
1363
- loopItem = menu.add(new MenuItem("Loop"));
1364
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
13651624 doubleItem = menu.add(new MenuItem("Fork"));
13661625 doubleItem.addActionListener(this);
13671626 if (Globals.ADVANCED)
....@@ -1377,6 +1636,9 @@
13771636 animationItem.addItemListener(this);
13781637 animationItem.setState(Globals.ANIMATION);
13791638
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
1641
+
13801642 menu.add("-");
13811643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13821644 parseverticesItem.addActionListener(this);
....@@ -1389,6 +1651,8 @@
13891651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13901652 reduce34MorphItem.addActionListener(this);
13911653 menu.add("-");
1654
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1655
+ memoryItem.addActionListener(this);
13921656 menu.add(computeAOItem = new MenuItem("Compute AO"));
13931657 computeAOItem.addActionListener(this);
13941658
....@@ -1397,8 +1661,6 @@
13971661 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13981662 mirrorItem.addActionListener(this);
13991663 menu.add("-");
1400
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1401
- memoryItem.addActionListener(this);
14021664 menu.add(analyzeItem = new MenuItem("Analyze"));
14031665 analyzeItem.addActionListener(this);
14041666 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1546,6 +1808,30 @@
15461808
15471809 makeSomething(shadow);
15481810 }
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
+ }
15491835
15501836 /**
15511837 * applyExample
....@@ -1790,7 +2076,7 @@
17902076 {
17912077 ScreenFit();
17922078 } else
1793
- if (source == switchItem)
2079
+ if (source == switchViewItem)
17942080 {
17952081 cVector v1 = new cVector();
17962082 cVector v2 = new cVector();
....@@ -1974,6 +2260,23 @@
19742260 {
19752261 makeSomething(new Light());
19762262 } 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
19772280 if (source == csgItem)
19782281 {
19792282 group(new CSG());
....@@ -2020,30 +2323,30 @@
20202323
20212324 group(g);
20222325 } else
2023
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
20242327 {
20252328 Composite csg = new GroupLeaf();
20262329 csg.count = 5;
20272330 group(csg);
2028
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
20292332 csg.addChild(child);
20302333 child.addChild(csg);
20312334 } else
20322335 if (source == doubleItem)
20332336 {
2034
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
20352338 csg.count = 5;
20362339 group(csg);
2037
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
20382341 csg.addChild(child);
20392342 child.addChild(csg);
2040
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
20412344 csg.addChild(child);
20422345 child.addChild(csg);
20432346 } else
20442347 if (source == tripleItem)
20452348 {
2046
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
20472350 csg.count = 4;
20482351 group(csg);
20492352 Composite child = new cGroup();
....@@ -2059,7 +2362,7 @@
20592362 if (source == computeAOItem)
20602363 {
20612364 Globals.drawMode = CameraPane.OCCLUSION;
2062
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
20632366 } else
20642367 if (source == recompileItem)
20652368 {
....@@ -2107,15 +2410,31 @@
21072410 } else
21082411 if (source == undoButton)
21092412 {
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
21102416 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();
21112427 } else
21122428 if (source == redoButton)
21132429 {
2430
+ // Go to next version
21142431 Redo();
21152432 } else
21162433 if (source == saveButton)
21172434 {
2118
- Save();
2435
+ // Save a new version
2436
+ if (!Save(true))
2437
+ java.awt.Toolkit.getDefaultToolkit().beep();
21192438 } else
21202439 if (source == oneStepButton)
21212440 {
....@@ -2124,17 +2443,14 @@
21242443 } else
21252444 if (source == screenfitButton)
21262445 {
2127
- //Reload(lastConverter, lastFilename, true);
21282446 ScreenFit();
21292447 } else
21302448 if (source == screenfitpointButton)
21312449 {
2132
- //Reload(lastConverter, lastFilename, true);
21332450 ScreenFitPoint();
21342451 } else
21352452 if (source == snapobjectButton)
21362453 {
2137
- //Reload(lastConverter, lastFilename, true);
21382454 SnapObject();
21392455 } else
21402456 // if (event.getSource() == recompileButton)
....@@ -2498,7 +2814,7 @@
24982814 {
24992815 StepAll();
25002816 } else
2501
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
25022818 {
25032819 //int indices[] = jList.getSelectedIndices();
25042820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2510,9 +2826,9 @@
25102826 {
25112827 ClearSelection(true);
25122828 } else
2513
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
25142830 {
2515
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
25162832 } else
25172833 if (source == hideItem)
25182834 {
....@@ -2530,11 +2846,11 @@
25302846 {
25312847 makeSomething(new Camera());
25322848 } else
2533
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
25342850 {
25352851 group(new Composite());
25362852 } else
2537
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
25382854 {
25392855 RandomNode random = new RandomNode();
25402856 group(random);
....@@ -2636,7 +2952,7 @@
26362952 {
26372953 group(new cLinker());
26382954 } else
2639
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
26402956 {
26412957 group(new TextureNode());
26422958 } else
....@@ -2658,15 +2974,28 @@
26582974 } else
26592975 if (source == ungroupItem || source == ungroupButton)
26602976 {
2661
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
26622979 for (int i=0; i<group.selection.size(); i++)
26632980 {
2664
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
26652986 }
26662987
2667
- ClearSelection(false);
2668
-
2669
- 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
+ }
26702999 } else
26713000 if (source == genUVItem)
26723001 {
....@@ -2967,7 +3296,7 @@
29673296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
29683297 {
29693298 obj = (Object3D)e.nextElement();
2970
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
29713300 }
29723301
29733302 refreshContents();
....@@ -2981,6 +3310,31 @@
29813310 obj.SetBumpTexture(obj.GetPigmentTexture());
29823311 }
29833312
3313
+ refreshContents();
3314
+ } 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
+
29843338 refreshContents();
29853339 } else
29863340 if (source == flashSelectionButton)
....@@ -3084,8 +3438,8 @@
30843438 // centralPanel.setVisible(true);
30853439 // XYZPanel.setVisible(true);
30863440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
30873442 bigThree.add(centralPanel);
3088
- bigThree.add(XYZPanel);
30893443 bigThree.FlushUI();
30903444
30913445 cameraView.requestFocusInWindow();
....@@ -3165,8 +3519,8 @@
31653519 // centralPanel.setVisible(true);
31663520 // XYZPanel.setVisible(false);
31673521 bigThree.ClearUI();
3168
- bigThree.add(scenePanel);
31693522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
31703524 bigThree.FlushUI();
31713525
31723526 cameraView.requestFocusInWindow();
....@@ -3258,6 +3612,12 @@
32583612 } else
32593613 if (source == editItem || source == editButton)
32603614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
32613621 EditSelection(false);
32623622 } else
32633623 if (source == uneditButton)
....@@ -3267,6 +3627,7 @@
32673627 Object3D child = (Object3D)e.nextElement();
32683628 if(child.editWindow != null)
32693629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
32703631 child.CloseUI();
32713632 listUI.remove(child);
32723633
....@@ -3283,6 +3644,7 @@
32833644 //copy.ClearUI();
32843645 for (Object3D obj : listUI)
32853646 {
3647
+ obj.pinned = false;
32863648 obj.CloseUI();
32873649 }
32883650 listUI.clear();
....@@ -3292,7 +3654,7 @@
32923654 {
32933655 assert(copy == group);
32943656
3295
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32963658
32973659 for (Object3D obj : listUI)
32983660 {
....@@ -3341,6 +3703,9 @@
33413703 }
33423704
33433705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
33443709 //Globals.theRenderer.object = group;
33453710 if(!useclient)
33463711 {
....@@ -3367,6 +3732,13 @@
33673732 currentLayout = sevenButton;
33683733 */
33693734 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);
33703742 keepparent = group.parent;
33713743 // PARENT = NULL or not???
33723744 //group.parent = null; // ROOT
....@@ -3380,7 +3752,7 @@
33803752 cameraView.ProtectCamera();
33813753 cameraView.repaint();
33823754 return;
3383
- } else if (event.getSource() == revertCameraItem)
3755
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33843756 {
33853757 cameraView.RevertCamera();
33863758 cameraView.repaint();
....@@ -3959,7 +4331,7 @@
39594331
39604332 try
39614333 {
3962
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
39634335 }
39644336 catch (Exception e)
39654337 {
....@@ -4434,12 +4806,14 @@
44344806 // }
44354807 // }
44364808
4437
- static boolean allparams = true;
4438
-
4439
- static Vector<Object3D> listUI = new Vector<Object3D>();
4440
-
44414809 void EditSelection(boolean newWindow)
44424810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
44434817 // aConstraints.gridy = 0;
44444818 for (int i=0; i<group.selection.size(); i++)
44454819 {
....@@ -4450,12 +4824,7 @@
44504824 Object3D elem = (Object3D)group.selection.elementAt(i);
44514825 if(elem != group || !newWindow)
44524826 {
4453
- // if (!(elem instanceof Composite))
4454
- // newWindow = false;
4455
- listUI.add(elem);
4456
- elem.openEditWindow(this, newWindow); //, false);
4457
- System.out.println("edit : " + elem);
4458
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
44594828 }
44604829 }
44614830 }
....@@ -4530,7 +4899,8 @@
45304899 //new Exception().printStackTrace();
45314900
45324901 freezemodel = true;
4533
-
4902
+ ClearUnpinned();
4903
+
45344904 /**/
45354905 //switch (event.id)
45364906 {
....@@ -4563,7 +4933,7 @@
45634933 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
45644934 // a camera
45654935 {
4566
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4936
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
45674937 {
45684938 CameraPane.camerachangeframe = 0; // don't refuse it
45694939 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4572,6 +4942,13 @@
45724942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
45734943 }
45744944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
45754952 refreshContents();
45764953 //return true;
45774954 }
....@@ -4581,9 +4958,18 @@
45814958 freezemodel = false;
45824959 }
45834960
4961
+ void SetPinStates(boolean enabled)
4962
+ {
4963
+ editButton.setEnabled(enabled);
4964
+ uneditButton.setEnabled(enabled);
4965
+ unselectButton.setEnabled(enabled);
4966
+ flashSelectionButton.setEnabled(enabled);
4967
+ }
4968
+
45844969 void refreshContents(boolean cp)
45854970 {
4586
- if (!Globals.MOUSEDRAGGED)
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4972
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45874973 {
45884974 objEditor.ClearInfo(); // .GetMaterial());
45894975
....@@ -4682,8 +5068,8 @@
46825068
46835069 if (cut)
46845070 {
4685
- if (Globals.SAVEONMAKE)
4686
- Save();
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
46875073 //int indices[] = jList.getSelectedIndices();
46885074 //for (int i = indices.length - 1; i >= 0; i--)
46895075 //jList.remove(indices[i]);
....@@ -4786,6 +5172,10 @@
47865172
47875173 void paste(boolean expand)
47885174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
47895179 // if (GrafreeD.clipboard == null)
47905180 // return;
47915181 boolean first = true;
....@@ -4845,6 +5235,7 @@
48455235 Grafreed.clipboard.get(0).parent = keepparent;
48465236 }
48475237
5238
+ Globals.REPLACEONMAKE = keep;
48485239 ResetModel();
48495240 refreshContents();
48505241 }
....@@ -4980,6 +5371,10 @@
49805371
49815372 void group(Object3D csg, boolean grab)
49825373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
49835378 if (//false) // why??
49845379 !group.selection.isEmpty())
49855380 {
....@@ -5093,10 +5488,15 @@
50935488 //node.add(csg);
50945489 //makeSomething(node);
50955490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
50965492 }
50975493
50985494 void Ungroup(Object3D g)
50995495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
51005500 if (g instanceof HiddenObject)
51015501 {
51025502 HiddenObject h = (HiddenObject) g;
....@@ -5113,6 +5513,7 @@
51135513 objEditor.makeSomething(g.get(i), false);
51145514 }
51155515 }
5516
+ Globals.REPLACEONMAKE = keep;
51165517 }
51175518
51185519 void ungroup()
....@@ -5401,17 +5802,33 @@
54015802 cButton clearpanelButton;
54025803 cButton unselectButton;
54035804
5404
- cButton minButton;
5405
- cButton maxButton;
5406
- cButton fullButton;
5407
- cButton undoButton;
5408
- cButton redoButton;
5805
+ cButton restoreCameraButton;
5806
+
54095807 cButton saveButton;
54105808 cButton oneStepButton;
54115809
54125810 cButton groupButton;
54135811 cButton ungroupButton;
54145812 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;
54155832
54165833 cButton gridButton;
54175834 cButton boxButton;
....@@ -5444,7 +5861,7 @@
54445861 //JTree jTree;
54455862 private MenuItem lookAtItem;
54465863 private MenuItem lookFromItem;
5447
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
54485865 private MenuItem cutItem;
54495866 private MenuItem undoItem;
54505867 private MenuItem redoItem;
....@@ -5476,7 +5893,7 @@
54765893 private MenuItem pasteLinkItem;
54775894 private MenuItem pasteCloneItem;
54785895 private MenuItem pasteExpandItem;
5479
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
54805897 private MenuItem clearAllItem;
54815898 private MenuItem genUVItem;
54825899 private MenuItem genNormalsMESHItem;
....@@ -5536,7 +5953,7 @@
55365953 private MenuItem frontItem;
55375954 private MenuItem cameraItem;
55385955 private MenuItem compositeItem;
5539
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
55405957 private MenuItem physicsItem;
55415958 private MenuItem frameselectorItem;
55425959 private MenuItem scriptNodeItem;
....@@ -5560,6 +5977,8 @@
55605977 private MenuItem attachBumpItem;
55615978 private MenuItem detachBumpItem;
55625979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
55635982
55645983 private MenuItem particleItem;
55655984 private MenuItem ragdollItem;
....@@ -5610,5 +6029,5 @@
56106029
56116030 Menu cameraMenu;
56126031 MenuItem editCameraItem;
5613
- MenuItem revertCameraItem;
6032
+ MenuItem restoreCameraItem;
56146033 }