Normand Briere
2019-07-27 1af7d3700724834e40ad8636bc9a56cdc3b19b15
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -80,10 +86,22 @@
8086 SetupViews(objEditor);
8187
8288 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8397 }
8498
8599 void CloneSelection(boolean supports)
86100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
87105 // Object3D keep = GrafreeD.clipboard;
88106 //Object3D obj;
89107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +112,7 @@
94112
95113 makeSomething(clone, i==group.selection.size()-1);
96114 }
115
+ Globals.REPLACEONMAKE = keep;
97116 }
98117
99118 void CloneClipboard(boolean supports)
....@@ -150,6 +169,8 @@
150169
151170 void SetupMenu2(GroupEditor oe)
152171 {
172
+ oe.jTree = new cTree();
173
+
153174 Menu menu;
154175 oe.menuBar.add(menu = new Menu("Edit"));
155176 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +181,7 @@
160181 // redoItem = menu.add(new MenuItem("Redo"));
161182 // redoItem.addActionListener(this);
162183 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164185 duplicateItem.addActionListener(this);
165186 cloneItem = menu.add(new MenuItem("Clone"));
166187 cloneItem.addActionListener(this);
....@@ -187,8 +208,8 @@
187208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188209 // pasteExpandItem.addActionListener(this);
189210 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
192213
193214 if (Globals.ADVANCED)
194215 {
....@@ -202,23 +223,23 @@
202223 //zBufferItem.addActionListener(this);
203224 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204225 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
207228
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212241
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222243 toggleHandleItem.addItemListener(this);
223244 toggleHandleItem.setState(CameraPane.HANDLES);
224245
....@@ -273,7 +294,7 @@
273294 {
274295 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275296 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277298 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278299 oe.cameraMenu.add("-");
279300 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +302,7 @@
281302 editLeafItem.addActionListener(this);
282303 lookAtItem.addActionListener(this);
283304 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
305
+ //switchViewItem.addActionListener(this);
285306 }
286307
287308 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +347,29 @@
326347 }
327348
328349 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
331352 backItem = menu.add(new MenuItem("Back"));
332353 backItem.addActionListener(this);
333354 frontItem = menu.add(new MenuItem("Front"));
334355 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
337361 hideItem = menu.add(new MenuItem("Hidden Group"));
338362 hideItem.addActionListener(this);
363
+ }
339364 ungroupItem = menu.add(new MenuItem("Ungroup"));
340365 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
344373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345374 switchGeoItem.addActionListener(this);
346375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +377,6 @@
348377 morphItem = menu.add(new MenuItem("Morph Group"));
349378 morphItem.addActionListener(this);
350379
351
- if (Globals.ADVANCED)
352
- {
353380 menu.add("-");
354381 physicsItem = menu.add(new MenuItem("Physics"));
355382 physicsItem.addActionListener(this);
....@@ -357,13 +384,11 @@
357384 frameselectorItem.addActionListener(this);
358385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359386 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362387 }
363388
364389 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
367392 billboardItem = menu.add(new MenuItem("Billboard"));
368393 billboardItem.addActionListener(this);
369394 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +399,14 @@
374399 shadowYItem.addActionListener(this);
375400 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
377405 if (Globals.ADVANCED)
378406 {
379407 menu.add("-");
380408 linkerItem = menu.add(new MenuItem("Linker"));
381409 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384410 templateItem = menu.add(new MenuItem("Template"));
385411 templateItem.addActionListener(this);
386412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +435,7 @@
409435 genNormalsMESHItem.addActionListener(this);
410436 if (Globals.ADVANCED)
411437 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413439 genNormalsMINEItem.addActionListener(this);
414440 }
415441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -502,10 +528,15 @@
502528 attachBumpItem.addActionListener(this);
503529 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
504530 pigmentBumpItem.addActionListener(this);
531
+ //embedTexturesItem
505532 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
506533 detachPigmentItem.addActionListener(this);
507534 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
508535 detachBumpItem.addActionListener(this);
536
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
537
+ embedTexturesItem.addActionListener(this);
538
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
539
+ deEmbedTexturesItem.addActionListener(this);
509540 menu.add("-");
510541 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
511542 sortbysizeItem.addActionListener(this);
....@@ -532,6 +563,7 @@
532563 buildToolsMenu(menu);
533564 }
534565
566
+
535567 void SetupUI2(ObjEditor oe)
536568 {
537569 // June 2019
....@@ -574,51 +606,79 @@
574606 oe.radioPanel.add(dummyButton);
575607 oe.buttonGroup.add(dummyButton);
576608 */
609
+ cGridBag copyOptionsPanel = new cGridBag();
610
+
611
+ copyOptionsPanel.preferredHeight = 1;
612
+
577613 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578614
579615 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580616 //minButton.setToolTipText("Minimize window");
581617 //minButton.addActionListener(this);
582618
583
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
619
+ if (Globals.ADVANCED)
620
+ {
621
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622
+ maxButton.setToolTipText("Maximize window");
623
+ maxButton.addActionListener(this);
624
+ }
586625
587626 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588627 fullButton.setToolTipText("Full-screen window");
589628 fullButton.addActionListener(this);
590629
591
- oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
630
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
631
+ screenfitButton.setToolTipText("Screen fit");
632
+ screenfitButton.addActionListener(this);
633
+
634
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ restoreCameraButton.setToolTipText("Restore viewpoint");
636
+ restoreCameraButton.addActionListener(this);
594637
595
- oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
638
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ saveButton.setToolTipText("New version");
601640 saveButton.addActionListener(this);
641
+
642
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643
+ undoButton.setToolTipText("Previous version");
644
+ undoButton.addActionListener(this);
645
+ undoButton.setEnabled(false);
602646
603
- oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
647
+ cGridBag updown = new cGridBag().setVertical(true);
648
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ restoreButton.setToolTipText("Restore current");
650
+ restoreButton.addActionListener(this);
651
+ restoreButton.setEnabled(false);
652
+
653
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ replaceButton.setToolTipText("Replace current");
655
+ replaceButton.addActionListener(this);
656
+ replaceButton.setEnabled(false);
657
+
658
+ copyOptionsPanel.add(updown);
659
+
660
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
+ redoButton.setToolTipText("Next version");
662
+ redoButton.addActionListener(this);
663
+ redoButton.setEnabled(false);
664
+
665
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604666 liveCB.setToolTipText("Enable animation");
605667 liveCB.addItemListener(this);
606668
607
- oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
608
- fastCB.setToolTipText("Fast mode");
609
- fastCB.addItemListener(this);
610
-
611669 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612670 oneStepButton.setToolTipText("Animate one step forward");
613671 oneStepButton.addActionListener(this);
614672
615
- oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
673
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
674
+ fastCB.setToolTipText("Fast mode");
675
+ fastCB.addItemListener(this);
676
+
677
+ //oe.toolboxPanel.Return();
678
+
679
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
680
+// trackCB.setToolTipText("Enable tracking");
681
+// trackCB.addItemListener(this);
622682
623683 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624684 // screenfitpointButton.addActionListener(this);
....@@ -628,51 +688,129 @@
628688 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629689 snapobjectButton.addActionListener(this);
630690 snapobjectButton.setToolTipText("Snap Object");
691
+
692
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ fourButton.addActionListener(this);
694
+ fourButton.setToolTipText("Show control panel only");
631695 }
632696
633
- oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Highlight selection");
635
- flashSelectionButton.addActionListener(this);
697
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
636698
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");
699
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ twoButton.setToolTipText("Show 3D view only");
641701 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");
702
+ this.fullscreenLayout = twoButton;
703
+
704
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705
+ threeButton.setToolTipText("Show controls and 3D view");
650706 threeButton.addActionListener(this);
651
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- sevenButton.setToolTipText("3-column layout");
653
- sevenButton.addActionListener(this);
707
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ sixButton.setToolTipText("Show 3D view and controls");
709
+ sixButton.addActionListener(this);
710
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+// sevenButton.setToolTipText("3-column layout");
712
+// sevenButton.addActionListener(this);
654713 //
655714
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- rootButton.setToolTipText("Edit selection in new tab");
715
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
716
+ rootButton.setToolTipText("Open selection in new tab");
658717 rootButton.addActionListener(this);
659718
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661720 closeButton.setToolTipText("Close tab");
662721 closeButton.addActionListener(this);
663722 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664723 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
724
+
725
+ // INSERT
726
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ gridButton.setToolTipText("Create grid");
728
+ gridButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ boxButton.setToolTipText("Create box");
732
+ boxButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ sphereButton.setToolTipText("Create sphere");
736
+ sphereButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ coneButton.setToolTipText("Create cone");
740
+ coneButton.addActionListener(this);
741
+
742
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
743
+ torusButton.setToolTipText("Create torus");
744
+ torusButton.addActionListener(this);
745
+
746
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
747
+ superButton.setToolTipText("Create superellipsoid");
748
+ superButton.addActionListener(this);
749
+
750
+ if (Globals.ADVANCED)
751
+ {
752
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ kleinButton.setToolTipText("Create Klein bottle");
754
+ kleinButton.addActionListener(this);
755
+ }
756
+
757
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
758
+ particlesButton.setToolTipText("Create particle system");
759
+ particlesButton.addActionListener(this);
760
+
761
+ oe.toolboxPanel.Return();
762
+
763
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ groupButton.setToolTipText("Create group");
765
+ groupButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ compositeButton.setToolTipText("Create composite");
769
+ compositeButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ switchButton.setToolTipText("Create item switcher");
773
+ switchButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ loopButton.setToolTipText("Create loop");
777
+ loopButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ textureButton.setToolTipText("Create texture");
781
+ textureButton.addActionListener(this);
782
+
783
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
784
+ overlayButton.setToolTipText("Create overlay");
785
+ overlayButton.addActionListener(this);
786
+
787
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
788
+ lightButton.setToolTipText("Create light");
789
+ lightButton.addActionListener(this);
790
+
791
+ for (int i=6; --i>=0;)
792
+ {
793
+ oe.toolboxPanel.Return();
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ oe.toolboxPanel.add(new cGridBag());
797
+ oe.toolboxPanel.add(new cGridBag());
798
+ oe.toolboxPanel.add(new cGridBag());
799
+ oe.toolboxPanel.add(new cGridBag());
800
+ oe.toolboxPanel.add(new cGridBag());
801
+ }
802
+
803
+ // EDIT panel
804
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ editButton.setToolTipText("Pin selection controls");
668806 editButton.addActionListener(this);
669807
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
808
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ uneditButton.setToolTipText("Remove selection controls");
672810 uneditButton.addActionListener(this);
673811
674812 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
813
+ allParamsButton.setToolTipText("Show all controle");
676814 allParamsButton.addActionListener(this);
677815
678816 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +821,13 @@
683821 unselectButton.setToolTipText("Unselect");
684822 unselectButton.addActionListener(this);
685823
824
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
825
+ flashSelectionButton.setToolTipText("Highlight selection");
826
+ flashSelectionButton.addActionListener(this);
827
+
686828 editCommandsPanel.preferredHeight = 1;
687829
830
+ SetPinStates(false);
688831 // oe.treePanel.add(commandsPanel);
689832 // oe.treePanel.Return();
690833
....@@ -703,29 +846,17 @@
703846
704847 JScrollPane jSP;
705848 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
849
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707850 ResetModel();
708851
709852 oe.treePanel.add(jSPPanel);
710853 oe.treePanel.Return();
711854
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;
727855 oe.treePanel.add(copyOptionsPanel);
728856 oe.treePanel.Return();
857
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
858
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
859
+ sliderPane.preferredHeight = 1;
729860
730861 // mainPanel.setDividerLocation(0.5); //1.0);
731862 // mainPanel.setResizeWeight(0.5);
....@@ -748,29 +879,49 @@
748879 dgr.addDragGestureListener(this);
749880 }catch(Exception e) {}
750881 */
751
- radio.layout = sevenButton;
882
+ radio.layout = sixButton; // sevenButton;
752883 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
753884 }
754885
755886 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756887 {
888
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
889
+ colorCB.setToolTipText("Copy color when dropped");
890
+ colorCB.addItemListener(this);
891
+
892
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
893
+ materialCB.setToolTipText("Copy material when dropped");
894
+ materialCB.addItemListener(this);
895
+
896
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
897
+ textureCB.setToolTipText("Copy texture when dropped");
898
+ textureCB.addItemListener(this);
899
+
900
+ panel.Return();
901
+
757902 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758903 boxCB.setToolTipText("Display bounding boxes");
759904 boxCB.addItemListener(this);
760905
761906 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
907
+ zoomBoxCB.setToolTipText("Display only for wheel");
763908 zoomBoxCB.addItemListener(this);
764909
765910 if (true) // Globals.ADVANCED)
766911 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
912
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
913
+// supportCB.setToolTipText("Enable rigging");
914
+// supportCB.addItemListener(this);
915
+
916
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
917
+ freezeCB.setToolTipText("Fast moving camera");
918
+ freezeCB.addItemListener(this);
770919
771920 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772921 // localCB.addItemListener(this);
773922
923
+ panel.Return();
924
+
774925 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775926 crowdCB.setToolTipText("Used for crowds");
776927 crowdCB.addItemListener(this);
....@@ -787,6 +938,8 @@
787938 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788939 // speakerMocapCB.addItemListener(this);
789940
941
+ panel.Return();
942
+
790943 if (false)
791944 {
792945 // handled in scripts
....@@ -801,24 +954,39 @@
801954 //constraints.gridy += 1;
802955 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803956 smoothfocusCB.addItemListener(this);
957
+ panel.Return();
804958 }
805959
806960 //constraints.gridx += 1;
807961 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808962 // debugCB.addItemListener(this);
809963
964
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
965
+ trackCB.setToolTipText("Enable tracking target");
966
+ trackCB.addItemListener(this);
967
+
810968 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
969
+ oeilCB.setToolTipText("Move camera when tracking");
812970 oeilCB.addItemListener(this);
813971
814972 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
973
+ shadowCB.setToolTipText("When live compute shadows");
816974 shadowCB.addItemListener(this);
817975
818
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
- autosaveCB.setToolTipText("Auto-save on structure change");
820
- autosaveCB.addItemListener(this);
976
+ panel.Return();
977
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
978
+ toggleTextureCB.setToolTipText("Load textures");
979
+ toggleTextureCB.addItemListener(this);
980
+
981
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
982
+ toggleSwitchCB.setToolTipText("Choose a single item");
983
+ toggleSwitchCB.addItemListener(this);
984
+
985
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
986
+ autokeepCB.setToolTipText("On structure change");
987
+ autokeepCB.addItemListener(this);
821988
989
+ panel.Return();
822990 if (Globals.ADVANCED)
823991 {
824992 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -829,10 +997,15 @@
829997 }
830998
831999 cGridBag fill = new cGridBag();
832
-
8331000 fill.preferredHeight = 200;
1001
+ cGridBag fill2 = new cGridBag();
1002
+ fill2.preferredHeight = 200;
1003
+ cGridBag fill3 = new cGridBag();
1004
+ fill3.preferredHeight = 200;
8341005
8351006 panel.add(fill);
1007
+ panel.add(fill2);
1008
+ panel.add(fill3);
8361009
8371010 }
8381011
....@@ -840,7 +1013,7 @@
8401013 {
8411014 cRadio radioButton = new cRadio(obj.name);
8421015
843
- // Patch to avoid bug with transparency.
1016
+ // June 2019. Patch to avoid bug with transparency.
8441017 radioButton.hadMaterial = obj.material != null;
8451018 if (!radioButton.hadMaterial)
8461019 {
....@@ -848,7 +1021,7 @@
8481021 }
8491022
8501023 radioButton.SetObject(obj);
851
- radioButton.layout = sevenButton;
1024
+ radioButton.layout = sixButton; // sevenButton;
8521025 radioButton.SetCamera(cameraView.renderCamera, false);
8531026 radioButton.addActionListener(this);
8541027 radioPanel.add(radioButton);
....@@ -868,15 +1041,17 @@
8681041 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8691042 }
8701043
871
- cCheckBox liveCB;
1044
+ cToggleButton liveCB;
8721045 cCheckBox supportCB;
8731046 cCheckBox localCB;
8741047 cCheckBox crowdCB;
8751048 cCheckBox smoothCB;
876
- cCheckBox fastCB;
1049
+ cToggleButton fastCB;
8771050 cCheckBox slowCB;
8781051 cCheckBox boxCB;
8791052 cCheckBox zoomBoxCB;
1053
+ cCheckBox freezeCB;
1054
+ //cToggleButton trackCB;
8801055 cCheckBox trackCB;
8811056 cCheckBox smoothfocusCB;
8821057 // JCheckBox speakerMocapCB;
....@@ -886,7 +1061,7 @@
8861061
8871062 cCheckBox oeilCB;
8881063 cCheckBox shadowCB;
889
- cCheckBox autosaveCB;
1064
+ cCheckBox autokeepCB;
8901065 cCheckBox lookAtCB;
8911066
8921067 // static int COLOR = 1;
....@@ -994,9 +1169,13 @@
9941169 {
9951170 Globals.COMPUTESHADOWWHENLIVE ^= true;
9961171 }
997
- else if(e.getSource() == autosaveCB)
1172
+ else if(e.getSource() == freezeCB)
9981173 {
999
- Globals.SAVEONMAKE ^= true;
1174
+ Globals.FREEZEONMOVE ^= true;
1175
+ }
1176
+ else if(e.getSource() == autokeepCB)
1177
+ {
1178
+ Globals.REPLACEONMAKE ^= true;
10001179 }
10011180 else if(e.getSource() == lookAtCB)
10021181 {
....@@ -1014,7 +1193,8 @@
10141193
10151194 /**/
10161195 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1017
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1196
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1197
+ TreePath path = objEditor.jTree.getSelectionPath();
10181198 if ((path == null) || (path.getPathCount() <= 1)) {
10191199 // We can't move the root node or an empty selection
10201200 return;
....@@ -1077,8 +1257,6 @@
10771257 }
10781258 }
10791259
1080
- String string = (String) object;
1081
-
10821260 System.out.println("Transfer = " + object + "; drop : " + target);
10831261 // if( object instanceof java.io.File[])
10841262 // {
....@@ -1086,6 +1264,8 @@
10861264 // objEditor.DropFile((java.io.File[]) object, true);
10871265 // return;
10881266 // }
1267
+
1268
+ String string = object.toString();
10891269
10901270 // File path for Mac and Windows
10911271 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1131,23 +1311,33 @@
11311311
11321312 assert target == objEditor.jTree;
11331313 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1314
+ Object3D destinationLeaf;
11341315 try {
1135
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1316
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11361317 } catch (Exception e) {
11371318 System.out.println("destinationPath : " + destinationPath);
11381319 return;
11391320 }
11401321
1141
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1322
+ for (int i=group.selection.size(); --i>=0;)
11421323 {
1324
+ Object3D child = (Object3D)group.selection.elementAt(i);
1325
+
1326
+ // Cannot move into itself
1327
+ if (child == destinationLeaf)
1328
+ return;
1329
+ }
1330
+
1331
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1332
+// {
11431333 loadClipboard(true);
11441334 objEditor.jTree.setSelectionPath(destinationPath);
11451335 pasteInto(false, false);
1146
- } else {
1147
- loadClipboard(false);
1148
- objEditor.jTree.setSelectionPath(destinationPath);
1149
- pasteInto(false, false); // true); // ???
1150
- }
1336
+// } else {
1337
+// loadClipboard(false);
1338
+// objEditor.jTree.setSelectionPath(destinationPath);
1339
+// pasteInto(false, false); // true); // ???
1340
+// }
11511341 }
11521342 public void dropActionChanged(DropTargetDragEvent dtde)
11531343 // Called if the user has modified the current drop gesture
....@@ -1252,22 +1442,30 @@
12521442 {
12531443 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12541444 //heightFieldItem.addActionListener(this);
1255
- gridItem = menu.add(new MenuItem("Grid"));
1256
- gridItem.addActionListener(this);
1257
- rectoidItem = menu.add(new MenuItem("Box"));
1258
- rectoidItem.addActionListener(this);
1259
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1260
- ellipsoidItem.addActionListener(this);
1261
- coneItem = menu.add(new MenuItem("Cone"));
1262
- coneItem.addActionListener(this);
1263
- torusItem = menu.add(new MenuItem("Torus"));
1264
- torusItem.addActionListener(this);
1265
- superItem = menu.add(new MenuItem("Superellipsoid"));
1266
- superItem.addActionListener(this);
1445
+// gridItem = menu.add(new MenuItem("Grid"));
1446
+// gridItem.addActionListener(this);
1447
+// rectoidItem = menu.add(new MenuItem("Box"));
1448
+// rectoidItem.addActionListener(this);
1449
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1450
+// ellipsoidItem.addActionListener(this);
1451
+// coneItem = menu.add(new MenuItem("Cone"));
1452
+// coneItem.addActionListener(this);
1453
+// torusItem = menu.add(new MenuItem("Torus"));
1454
+// torusItem.addActionListener(this);
1455
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1456
+// superItem.addActionListener(this);
1457
+
1458
+ cameraItem = menu.add(new MenuItem("Camera"));
1459
+ cameraItem.addActionListener(this);
1460
+
1461
+ if (!Globals.ADVANCED)
1462
+ {
12671463 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12681464 kleinItem.addActionListener(this);
1269
- particleItem = menu.add(new MenuItem("Particle system"));
1270
- particleItem.addActionListener(this);
1465
+ }
1466
+
1467
+// particleItem = menu.add(new MenuItem("Particle system"));
1468
+// particleItem.addActionListener(this);
12711469 if (Globals.ADVANCED)
12721470 {
12731471 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1293,15 +1491,15 @@
12931491 }
12941492 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12951493 bezierItem.addActionListener(this);
1296
- overlayItem = menu.add(new MenuItem("Overlay"));
1297
- overlayItem.addActionListener(this);
1298
- lightItem = menu.add(new MenuItem("Light"));
1299
- lightItem.addActionListener(this);
1494
+// overlayItem = menu.add(new MenuItem("Overlay"));
1495
+// overlayItem.addActionListener(this);
1496
+// lightItem = menu.add(new MenuItem("Light"));
1497
+// lightItem.addActionListener(this);
13001498 menu.add("-");
13011499 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13021500 //superLoopItem.addActionListener(this);
1303
- loopItem = menu.add(new MenuItem("Loop"));
1304
- loopItem.addActionListener(this);
1501
+// loopItem = menu.add(new MenuItem("Loop"));
1502
+// loopItem.addActionListener(this);
13051503 doubleItem = menu.add(new MenuItem("Fork"));
13061504 doubleItem.addActionListener(this);
13071505 if (Globals.ADVANCED)
....@@ -1317,6 +1515,9 @@
13171515 animationItem.addItemListener(this);
13181516 animationItem.setState(Globals.ANIMATION);
13191517
1518
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1519
+ archiveItem.addActionListener(this);
1520
+
13201521 menu.add("-");
13211522 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13221523 parseverticesItem.addActionListener(this);
....@@ -1329,6 +1530,8 @@
13291530 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13301531 reduce34MorphItem.addActionListener(this);
13311532 menu.add("-");
1533
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1534
+ memoryItem.addActionListener(this);
13321535 menu.add(computeAOItem = new MenuItem("Compute AO"));
13331536 computeAOItem.addActionListener(this);
13341537
....@@ -1337,8 +1540,6 @@
13371540 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13381541 mirrorItem.addActionListener(this);
13391542 menu.add("-");
1340
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1341
- memoryItem.addActionListener(this);
13421543 menu.add(analyzeItem = new MenuItem("Analyze"));
13431544 analyzeItem.addActionListener(this);
13441545 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1486,6 +1687,30 @@
14861687
14871688 makeSomething(shadow);
14881689 }
1690
+
1691
+ private void ClearUnpinned()
1692
+ {
1693
+ //for (Object3D obj : listUI)
1694
+ for (int i=listUI.size(); --i>=0;)
1695
+ {
1696
+ Object3D obj = listUI.elementAt(i);
1697
+ if (!obj.pinned)
1698
+ {
1699
+ obj.CloseUI();
1700
+ listUI.remove(i);
1701
+ }
1702
+ }
1703
+ }
1704
+
1705
+ private void EditElement(Object3D elem, boolean newWindow)
1706
+ {
1707
+ // if (!(elem instanceof Composite))
1708
+ // newWindow = false;
1709
+ listUI.add(elem);
1710
+ elem.openEditWindow(this, newWindow); //, false);
1711
+ System.out.println("edit : " + elem);
1712
+ elem.editWindow.refreshContents(true); // ? new
1713
+ }
14891714
14901715 /**
14911716 * applyExample
....@@ -1730,7 +1955,7 @@
17301955 {
17311956 ScreenFit();
17321957 } else
1733
- if (source == switchItem)
1958
+ if (source == switchViewItem)
17341959 {
17351960 cVector v1 = new cVector();
17361961 cVector v2 = new cVector();
....@@ -1739,11 +1964,11 @@
17391964 objEditor.cameraView.renderCamera.setAim(v2, v1);
17401965 objEditor.cameraView.repaint();
17411966 } else
1742
- if (source == rectoidItem)
1967
+ if (source == rectoidItem || source == boxButton)
17431968 {
17441969 makeSomething(new Box());
17451970 } else
1746
- if (source == particleItem)
1971
+ if (source == particleItem || source == particlesButton)
17471972 {
17481973 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17491974 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1822,27 +2047,27 @@
18222047
18232048 makeSomething(obj);
18242049 } else
1825
- if (source == gridItem)
2050
+ if (source == gridItem || source == gridButton)
18262051 {
18272052 makeSomething(new Grid());
18282053 } else
1829
- if (source == ellipsoidItem)
2054
+ if (source == ellipsoidItem || source == sphereButton)
18302055 {
18312056 makeSomething(new Sphere());
18322057 } else
1833
- if (source == coneItem)
2058
+ if (source == coneItem || source == coneButton)
18342059 {
18352060 makeSomething(new Cone());
18362061 } else
1837
- if (source == torusItem)
2062
+ if (source == torusItem || source == torusButton)
18382063 {
18392064 makeSomething(new Torus());
18402065 } else
1841
- if (source == superItem)
2066
+ if (source == superItem || source == superButton)
18422067 {
18432068 makeSomething(new Superellipsoid());
18442069 } else
1845
- if (source == kleinItem)
2070
+ if (source == kleinItem || source == kleinButton)
18462071 {
18472072 makeSomething(new Klein());
18482073 } else
....@@ -1862,7 +2087,7 @@
18622087 {
18632088 makeSomething(new BezierSurface());
18642089 } else
1865
- if (source == overlayItem)
2090
+ if (source == overlayItem || source == overlayButton)
18662091 {
18672092 /*
18682093 Object3D obj = new BezierSurface(5,8);
....@@ -1910,7 +2135,7 @@
19102135 s.setup();
19112136 makeSomething(s);
19122137 } else
1913
- if (source == lightItem)
2138
+ if (source == lightItem || source == lightButton)
19142139 {
19152140 makeSomething(new Light());
19162141 } else
....@@ -1960,30 +2185,30 @@
19602185
19612186 group(g);
19622187 } else
1963
- if (source == loopItem)
2188
+ if (source == loopItem || source == loopButton)
19642189 {
19652190 Composite csg = new GroupLeaf();
19662191 csg.count = 5;
19672192 group(csg);
1968
- Composite child = new cGroup();
2193
+ Composite child = new cGroup("Branch");
19692194 csg.addChild(child);
19702195 child.addChild(csg);
19712196 } else
19722197 if (source == doubleItem)
19732198 {
1974
- Composite csg = new GroupLeaf();
2199
+ Composite csg = new GroupLeaf("Fork");
19752200 csg.count = 5;
19762201 group(csg);
1977
- Composite child = new cGroup();
2202
+ Composite child = new cGroup("Branch A");
19782203 csg.addChild(child);
19792204 child.addChild(csg);
1980
- child = new cGroup();
2205
+ child = new cGroup("Branch B");
19812206 csg.addChild(child);
19822207 child.addChild(csg);
19832208 } else
19842209 if (source == tripleItem)
19852210 {
1986
- Composite csg = new GroupLeaf();
2211
+ Composite csg = new GroupLeaf("Trident");
19872212 csg.count = 4;
19882213 group(csg);
19892214 Composite child = new cGroup();
....@@ -2047,15 +2272,31 @@
20472272 } else
20482273 if (source == undoButton)
20492274 {
2275
+ // Go to previous version
2276
+ //if (!Undo())
2277
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20502278 Undo();
2279
+ } else
2280
+ if (source == restoreButton)
2281
+ {
2282
+ // Restore current version
2283
+ Restore();
2284
+ } else
2285
+ if (source == replaceButton)
2286
+ {
2287
+ // Overwrite current version
2288
+ Replace();
20512289 } else
20522290 if (source == redoButton)
20532291 {
2292
+ // Go to next version
20542293 Redo();
20552294 } else
20562295 if (source == saveButton)
20572296 {
2058
- Save();
2297
+ // Save a new version
2298
+ if (!Save(true))
2299
+ java.awt.Toolkit.getDefaultToolkit().beep();
20592300 } else
20602301 if (source == oneStepButton)
20612302 {
....@@ -2064,17 +2305,14 @@
20642305 } else
20652306 if (source == screenfitButton)
20662307 {
2067
- //Reload(lastConverter, lastFilename, true);
20682308 ScreenFit();
20692309 } else
20702310 if (source == screenfitpointButton)
20712311 {
2072
- //Reload(lastConverter, lastFilename, true);
20732312 ScreenFitPoint();
20742313 } else
20752314 if (source == snapobjectButton)
20762315 {
2077
- //Reload(lastConverter, lastFilename, true);
20782316 SnapObject();
20792317 } else
20802318 // if (event.getSource() == recompileButton)
....@@ -2438,7 +2676,7 @@
24382676 {
24392677 StepAll();
24402678 } else
2441
- if (source == clearItem) // || event.getSource() == clearButton)
2679
+ if (source == deleteItem) // || event.getSource() == clearButton)
24422680 {
24432681 //int indices[] = jList.getSelectedIndices();
24442682 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2450,9 +2688,9 @@
24502688 {
24512689 ClearSelection(true);
24522690 } else
2453
- if (source == grabItem)
2691
+ if (source == grabItem || source == groupButton)
24542692 {
2455
- group(new cGroup(), true);
2693
+ group(new cGroup(), false); // true);
24562694 } else
24572695 if (source == hideItem)
24582696 {
....@@ -2470,11 +2708,11 @@
24702708 {
24712709 makeSomething(new Camera());
24722710 } else
2473
- if (source == compositeItem)
2711
+ if (source == compositeItem || source == compositeButton)
24742712 {
24752713 group(new Composite());
24762714 } else
2477
- if (source == randomItem)
2715
+ if (source == switchItem || source == switchButton)
24782716 {
24792717 RandomNode random = new RandomNode();
24802718 group(random);
....@@ -2576,7 +2814,7 @@
25762814 {
25772815 group(new cLinker());
25782816 } else
2579
- if (source == textureItem)
2817
+ if (source == textureItem || source == textureButton)
25802818 {
25812819 group(new TextureNode());
25822820 } else
....@@ -2596,17 +2834,30 @@
25962834 {
25972835 CastShadow(2);
25982836 } else
2599
- if (source == ungroupItem)
2837
+ if (source == ungroupItem || source == ungroupButton)
26002838 {
2601
- //ungroup();
2839
+ boolean hasRoot = false;
2840
+
26022841 for (int i=0; i<group.selection.size(); i++)
26032842 {
2604
- Ungroup(group.selection.get(i));
2843
+ if (group.selection.get(i) == group)
2844
+ {
2845
+ hasRoot = true;
2846
+ break;
2847
+ }
26052848 }
26062849
2607
- ClearSelection(false);
2608
-
2609
- refreshContents();
2850
+ if (!hasRoot)
2851
+ {
2852
+ for (int i=0; i<group.selection.size(); i++)
2853
+ {
2854
+ Ungroup(group.selection.get(i));
2855
+ }
2856
+
2857
+ ClearSelection(false);
2858
+
2859
+ refreshContents();
2860
+ }
26102861 } else
26112862 if (source == genUVItem)
26122863 {
....@@ -2907,7 +3158,7 @@
29073158 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
29083159 {
29093160 obj = (Object3D)e.nextElement();
2910
- obj.SetBumpTexture(null);
3161
+ obj.ResetBumpTexture();
29113162 }
29123163
29133164 refreshContents();
....@@ -2923,6 +3174,31 @@
29233174
29243175 refreshContents();
29253176 } else
3177
+ if (source == embedTexturesItem)
3178
+ {
3179
+ Object3D obj;
3180
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3181
+ {
3182
+ obj = (Object3D)e.nextElement();
3183
+ obj.EmbedTextures(true);
3184
+ }
3185
+
3186
+ refreshContents();
3187
+ } else
3188
+ if (source == deEmbedTexturesItem)
3189
+ {
3190
+ Object3D obj;
3191
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3192
+ {
3193
+ obj = (Object3D)e.nextElement();
3194
+ obj.EmbedTextures(false);
3195
+ }
3196
+
3197
+ CameraPane.texturepigment.clear();
3198
+ CameraPane.texturebump.clear();
3199
+
3200
+ refreshContents();
3201
+ } else
29263202 if (source == flashSelectionButton)
29273203 {
29283204 CameraPane.flash = true;
....@@ -2934,6 +3210,10 @@
29343210 if (source == twoButton)
29353211 {
29363212 radio.layout = twoButton;
3213
+
3214
+ if (CameraPane.FULLSCREEN)
3215
+ fullscreenLayout = radio.layout;
3216
+
29373217 // bug
29383218 //gridPanel.setDividerLocation(1.0);
29393219 //bigPanel.setDividerLocation(0.0);
....@@ -2989,6 +3269,9 @@
29893269 {
29903270 radio.layout = threeButton;
29913271
3272
+ if (CameraPane.FULLSCREEN)
3273
+ fullscreenLayout = radio.layout;
3274
+
29923275 // bigThree.remove(scenePanel);
29933276 // bigThree.remove(centralPanel);
29943277 // bigThree.remove(XYZPanel);
....@@ -3017,8 +3300,8 @@
30173300 // centralPanel.setVisible(true);
30183301 // XYZPanel.setVisible(true);
30193302 bigThree.ClearUI();
3303
+ bigThree.add(scenePanel);
30203304 bigThree.add(centralPanel);
3021
- bigThree.add(XYZPanel);
30223305 bigThree.FlushUI();
30233306
30243307 cameraView.requestFocusInWindow();
....@@ -3026,6 +3309,9 @@
30263309 if (source == fourButton)
30273310 {
30283311 radio.layout = fourButton;
3312
+
3313
+ if (CameraPane.FULLSCREEN)
3314
+ fullscreenLayout = radio.layout;
30293315
30303316 // bigThree.remove(scenePanel);
30313317 // bigThree.remove(centralPanel);
....@@ -3064,6 +3350,9 @@
30643350 {
30653351 radio.layout = sixButton;
30663352
3353
+ if (CameraPane.FULLSCREEN)
3354
+ fullscreenLayout = radio.layout;
3355
+
30673356 // bigThree.remove(scenePanel);
30683357 // bigThree.remove(centralPanel);
30693358 // bigThree.remove(XYZPanel);
....@@ -3092,8 +3381,8 @@
30923381 // centralPanel.setVisible(true);
30933382 // XYZPanel.setVisible(false);
30943383 bigThree.ClearUI();
3095
- bigThree.add(scenePanel);
30963384 bigThree.add(centralPanel);
3385
+ bigThree.add(scenePanel);
30973386 bigThree.FlushUI();
30983387
30993388 cameraView.requestFocusInWindow();
....@@ -3101,6 +3390,9 @@
31013390 if (source == sevenButton)
31023391 {
31033392 radio.layout = sevenButton;
3393
+
3394
+ if (CameraPane.FULLSCREEN)
3395
+ fullscreenLayout = radio.layout;
31043396
31053397 // bigThree.remove(scenePanel);
31063398 // bigThree.remove(centralPanel);
....@@ -3182,6 +3474,12 @@
31823474 } else
31833475 if (source == editItem || source == editButton)
31843476 {
3477
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3478
+ {
3479
+ Object3D child = (Object3D)e.nextElement();
3480
+ child.pinned = true;
3481
+ }
3482
+
31853483 EditSelection(false);
31863484 } else
31873485 if (source == uneditButton)
....@@ -3191,6 +3489,7 @@
31913489 Object3D child = (Object3D)e.nextElement();
31923490 if(child.editWindow != null)
31933491 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3492
+ child.pinned = false;
31943493 child.CloseUI();
31953494 listUI.remove(child);
31963495
....@@ -3207,6 +3506,7 @@
32073506 //copy.ClearUI();
32083507 for (Object3D obj : listUI)
32093508 {
3509
+ obj.pinned = false;
32103510 obj.CloseUI();
32113511 }
32123512 listUI.clear();
....@@ -3216,7 +3516,7 @@
32163516 {
32173517 assert(copy == group);
32183518
3219
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3519
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32203520
32213521 for (Object3D obj : listUI)
32223522 {
....@@ -3265,6 +3565,9 @@
32653565 }
32663566
32673567 copy = group;
3568
+
3569
+ SetUndoStates();
3570
+
32683571 //Globals.theRenderer.object = group;
32693572 if(!useclient)
32703573 {
....@@ -3291,6 +3594,13 @@
32913594 currentLayout = sevenButton;
32923595 */
32933596 radio.layout.doClick();
3597
+
3598
+ ClearUnpinned();
3599
+ //Grafreed.Assert(group != null);
3600
+ //Grafreed.Assert(group.selection != null);
3601
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3602
+ if (group.selection == null || group.selection.size() == 1)
3603
+ EditSelection(false);
32943604 keepparent = group.parent;
32953605 // PARENT = NULL or not???
32963606 //group.parent = null; // ROOT
....@@ -3304,7 +3614,7 @@
33043614 cameraView.ProtectCamera();
33053615 cameraView.repaint();
33063616 return;
3307
- } else if (event.getSource() == revertCameraItem)
3617
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33083618 {
33093619 cameraView.RevertCamera();
33103620 cameraView.repaint();
....@@ -3883,7 +4193,7 @@
38834193
38844194 try
38854195 {
3886
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4196
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
38874197 }
38884198 catch (Exception e)
38894199 {
....@@ -4358,28 +4668,25 @@
43584668 // }
43594669 // }
43604670
4361
- static boolean allparams = true;
4362
-
4363
- static Vector<Object3D> listUI = new Vector<Object3D>();
4364
-
43654671 void EditSelection(boolean newWindow)
43664672 {
4673
+ if (group.selection == null)
4674
+ {
4675
+ EditElement(group, newWindow); // ? new
4676
+ return;
4677
+ }
4678
+
43674679 // aConstraints.gridy = 0;
43684680 for (int i=0; i<group.selection.size(); i++)
43694681 {
43704682 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43714683 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4372
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4684
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43734685
43744686 Object3D elem = (Object3D)group.selection.elementAt(i);
43754687 if(elem != group || !newWindow)
43764688 {
4377
- // if (!(elem instanceof Composite))
4378
- // newWindow = false;
4379
- listUI.add(elem);
4380
- elem.openEditWindow(this, newWindow); //, false);
4381
- System.out.println("edit : " + elem);
4382
- elem.editWindow.refreshContents(true); // ? new
4689
+ EditElement(elem, newWindow); // ? new
43834690 }
43844691 }
43854692 }
....@@ -4454,7 +4761,8 @@
44544761 //new Exception().printStackTrace();
44554762
44564763 freezemodel = true;
4457
-
4764
+ ClearUnpinned();
4765
+
44584766 /**/
44594767 //switch (event.id)
44604768 {
....@@ -4487,7 +4795,7 @@
44874795 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44884796 // a camera
44894797 {
4490
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4798
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44914799 {
44924800 CameraPane.camerachangeframe = 0; // don't refuse it
44934801 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4496,6 +4804,13 @@
44964804 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44974805 }
44984806
4807
+ if (tps != null && tps.length == 1)
4808
+ {
4809
+ EditSelection(false);
4810
+ }
4811
+
4812
+ SetPinStates(tps != null && tps.length > 0);
4813
+
44994814 refreshContents();
45004815 //return true;
45014816 }
....@@ -4505,9 +4820,18 @@
45054820 freezemodel = false;
45064821 }
45074822
4823
+ void SetPinStates(boolean enabled)
4824
+ {
4825
+ editButton.setEnabled(enabled);
4826
+ uneditButton.setEnabled(enabled);
4827
+ unselectButton.setEnabled(enabled);
4828
+ flashSelectionButton.setEnabled(enabled);
4829
+ }
4830
+
45084831 void refreshContents(boolean cp)
45094832 {
4510
- if (!Globals.MOUSEDRAGGED)
4833
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4834
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45114835 {
45124836 objEditor.ClearInfo(); // .GetMaterial());
45134837
....@@ -4606,8 +4930,8 @@
46064930
46074931 if (cut)
46084932 {
4609
- if (Globals.SAVEONMAKE)
4610
- Save();
4933
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4934
+// Save();
46114935 //int indices[] = jList.getSelectedIndices();
46124936 //for (int i = indices.length - 1; i >= 0; i--)
46134937 //jList.remove(indices[i]);
....@@ -4710,6 +5034,10 @@
47105034
47115035 void paste(boolean expand)
47125036 {
5037
+ if (Globals.REPLACEONMAKE)
5038
+ Save();
5039
+ boolean keep = Globals.REPLACEONMAKE;
5040
+ Globals.REPLACEONMAKE = false;
47135041 // if (GrafreeD.clipboard == null)
47145042 // return;
47155043 boolean first = true;
....@@ -4769,6 +5097,7 @@
47695097 Grafreed.clipboard.get(0).parent = keepparent;
47705098 }
47715099
5100
+ Globals.REPLACEONMAKE = keep;
47725101 ResetModel();
47735102 refreshContents();
47745103 }
....@@ -4904,6 +5233,10 @@
49045233
49055234 void group(Object3D csg, boolean grab)
49065235 {
5236
+ if (Globals.REPLACEONMAKE)
5237
+ Save();
5238
+ boolean keep = Globals.REPLACEONMAKE;
5239
+ Globals.REPLACEONMAKE = false;
49075240 if (//false) // why??
49085241 !group.selection.isEmpty())
49095242 {
....@@ -5017,10 +5350,15 @@
50175350 //node.add(csg);
50185351 //makeSomething(node);
50195352 makeSomething(csg);
5353
+ Globals.REPLACEONMAKE = keep;
50205354 }
50215355
50225356 void Ungroup(Object3D g)
50235357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
50245362 if (g instanceof HiddenObject)
50255363 {
50265364 HiddenObject h = (HiddenObject) g;
....@@ -5037,6 +5375,7 @@
50375375 objEditor.makeSomething(g.get(i), false);
50385376 }
50395377 }
5378
+ Globals.REPLACEONMAKE = keep;
50405379 }
50415380
50425381 void ungroup()
....@@ -5325,13 +5664,28 @@
53255664 cButton clearpanelButton;
53265665 cButton unselectButton;
53275666
5328
- cButton minButton;
5329
- cButton maxButton;
5330
- cButton fullButton;
5331
- cButton undoButton;
5332
- cButton redoButton;
5667
+ cButton restoreCameraButton;
5668
+
53335669 cButton saveButton;
53345670 cButton oneStepButton;
5671
+
5672
+ cButton groupButton;
5673
+ cButton ungroupButton;
5674
+ cButton compositeButton;
5675
+ cButton switchButton;
5676
+ cButton loopButton;
5677
+ cButton textureButton;
5678
+
5679
+ cButton gridButton;
5680
+ cButton boxButton;
5681
+ cButton sphereButton;
5682
+ cButton coneButton;
5683
+ cButton torusButton;
5684
+ cButton superButton;
5685
+ cButton kleinButton;
5686
+ cButton particlesButton;
5687
+ cButton overlayButton;
5688
+ cButton lightButton;
53355689
53365690 cButton screenfitButton;
53375691 cButton screenfitpointButton;
....@@ -5353,11 +5707,11 @@
53535707 //JTree jTree;
53545708 private MenuItem lookAtItem;
53555709 private MenuItem lookFromItem;
5356
- private MenuItem switchItem;
5710
+ private MenuItem switchViewItem;
53575711 private MenuItem cutItem;
53585712 private MenuItem undoItem;
53595713 private MenuItem redoItem;
5360
- private MenuItem duplicateItem;
5714
+ private JMenuItem duplicateItem;
53615715 private MenuItem cloneItem;
53625716 private MenuItem cloneSupportItem;
53635717 private MenuItem overwriteGeoItem;
....@@ -5385,7 +5739,7 @@
53855739 private MenuItem pasteLinkItem;
53865740 private MenuItem pasteCloneItem;
53875741 private MenuItem pasteExpandItem;
5388
- private MenuItem clearItem;
5742
+ private MenuItem deleteItem;
53895743 private MenuItem clearAllItem;
53905744 private MenuItem genUVItem;
53915745 private MenuItem genNormalsMESHItem;
....@@ -5445,7 +5799,7 @@
54455799 private MenuItem frontItem;
54465800 private MenuItem cameraItem;
54475801 private MenuItem compositeItem;
5448
- private MenuItem randomItem;
5802
+ private MenuItem switchItem;
54495803 private MenuItem physicsItem;
54505804 private MenuItem frameselectorItem;
54515805 private MenuItem scriptNodeItem;
....@@ -5469,6 +5823,8 @@
54695823 private MenuItem attachBumpItem;
54705824 private MenuItem detachBumpItem;
54715825 private MenuItem pigmentBumpItem;
5826
+ private MenuItem embedTexturesItem;
5827
+ private MenuItem deEmbedTexturesItem;
54725828
54735829 private MenuItem particleItem;
54745830 private MenuItem ragdollItem;
....@@ -5519,5 +5875,5 @@
55195875
55205876 Menu cameraMenu;
55215877 MenuItem editCameraItem;
5522
- MenuItem revertCameraItem;
5878
+ MenuItem restoreCameraItem;
55235879 }