Normand Briere
2019-07-28 a434119e65146fe53d612c28e1ee7af532d1b70a
GroupEditor.java
....@@ -23,6 +23,31 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row3)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ skyboxButton.setToolTipText(s);
33
+ skyboxButton.addActionListener(new ActionListener()
34
+ {
35
+ @Override
36
+ public void actionPerformed(ActionEvent e)
37
+ {
38
+ ChangeSkybox(path);
39
+ }
40
+ });
41
+ }
42
+
43
+ public void ChangeSkybox(String name)
44
+ {
45
+ cameraView.envyoff = false;
46
+ cameraView.skyboxname = name;
47
+ cameraView.skyboxext = "jpg";
48
+ cameraView.repaint();
49
+ }
50
+
2651 //ObjEditor objEditor;
2752 public void closeUI2()
2853 {
....@@ -60,6 +85,12 @@
6085 this.copy = this.group = group;
6186 //selectees = this.group.selectees;
6287
88
+ if (copy.versions == null)
89
+ {
90
+ copy.versions = new byte[100][];
91
+ copy.versionindex = -1;
92
+ }
93
+
6394 if(ui)
6495 SetupUI(objEditor);
6596 }
....@@ -80,10 +111,22 @@
80111 SetupViews(objEditor);
81112
82113 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
114
+
115
+ if (copy.versions == null)
116
+ {
117
+ copy.versions = new byte[100][];
118
+ copy.versionindex = -1;
119
+
120
+ Save(true);
121
+ }
83122 }
84123
85124 void CloneSelection(boolean supports)
86125 {
126
+ if (Globals.REPLACEONMAKE)
127
+ Save();
128
+ boolean keep = Globals.REPLACEONMAKE;
129
+ Globals.REPLACEONMAKE = false;
87130 // Object3D keep = GrafreeD.clipboard;
88131 //Object3D obj;
89132 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +137,7 @@
94137
95138 makeSomething(clone, i==group.selection.size()-1);
96139 }
140
+ Globals.REPLACEONMAKE = keep;
97141 }
98142
99143 void CloneClipboard(boolean supports)
....@@ -150,6 +194,8 @@
150194
151195 void SetupMenu2(GroupEditor oe)
152196 {
197
+ oe.jTree = new cTree();
198
+
153199 Menu menu;
154200 oe.menuBar.add(menu = new Menu("Edit"));
155201 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +206,7 @@
160206 // redoItem = menu.add(new MenuItem("Redo"));
161207 // redoItem.addActionListener(this);
162208 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
209
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164210 duplicateItem.addActionListener(this);
165211 cloneItem = menu.add(new MenuItem("Clone"));
166212 cloneItem.addActionListener(this);
....@@ -176,7 +222,6 @@
176222 copyItem.addActionListener(this);
177223 pasteItem = menu.add(new MenuItem("Paste"));
178224 pasteItem.addActionListener(this);
179
- menu.add("-");
180225
181226 menu.add("-");
182227 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -188,8 +233,8 @@
188233 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189234 // pasteExpandItem.addActionListener(this);
190235 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
236
+ deleteItem = menu.add(new MenuItem("Delete"));
237
+ deleteItem.addActionListener(this);
193238
194239 if (Globals.ADVANCED)
195240 {
....@@ -203,23 +248,23 @@
203248 //zBufferItem.addActionListener(this);
204249 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205250 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
251
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
252
+ restoreCameraItem.addActionListener(this);
208253
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- 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);
213266
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
267
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223268 toggleHandleItem.addItemListener(this);
224269 toggleHandleItem.setState(CameraPane.HANDLES);
225270
....@@ -274,7 +319,7 @@
274319 {
275320 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276321 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
322
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278323 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279324 oe.cameraMenu.add("-");
280325 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +327,7 @@
282327 editLeafItem.addActionListener(this);
283328 lookAtItem.addActionListener(this);
284329 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
330
+ //switchViewItem.addActionListener(this);
286331 }
287332
288333 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +372,29 @@
327372 }
328373
329374 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
375
+// grabItem = menu.add(new MenuItem("Grab"));
376
+// grabItem.addActionListener(this);
332377 backItem = menu.add(new MenuItem("Back"));
333378 backItem.addActionListener(this);
334379 frontItem = menu.add(new MenuItem("Front"));
335380 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
381
+// compositeItem = menu.add(new MenuItem("Composite"));
382
+// compositeItem.addActionListener(this);
383
+
384
+ if (Globals.ADVANCED)
385
+ {
338386 hideItem = menu.add(new MenuItem("Hidden Group"));
339387 hideItem.addActionListener(this);
388
+ }
340389 ungroupItem = menu.add(new MenuItem("Ungroup"));
341390 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- randomItem.addActionListener(this);
391
+
392
+// menu.add("-");
393
+//
394
+// switchItem = menu.add(new MenuItem("Switch node"));
395
+// switchItem.addActionListener(this);
396
+ if (Globals.ADVANCED)
397
+ {
345398 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346399 switchGeoItem.addActionListener(this);
347400 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +402,6 @@
349402 morphItem = menu.add(new MenuItem("Morph Group"));
350403 morphItem.addActionListener(this);
351404
352
- if (Globals.ADVANCED)
353
- {
354405 menu.add("-");
355406 physicsItem = menu.add(new MenuItem("Physics"));
356407 physicsItem.addActionListener(this);
....@@ -358,30 +409,29 @@
358409 frameselectorItem.addActionListener(this);
359410 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360411 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363412 }
364413
365414 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
415
+// textureItem = menu.add(new MenuItem("Texture"));
416
+// textureItem.addActionListener(this);
368417 billboardItem = menu.add(new MenuItem("Billboard"));
369418 billboardItem.addActionListener(this);
370419 csgItem = menu.add(new MenuItem("CSG"));
371420 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
421
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373422 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
423
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375424 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
425
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377426 shadowZItem.addActionListener(this);
427
+ attributeItem = menu.add(new MenuItem("Attribute"));
428
+ attributeItem.addActionListener(this);
429
+
378430 if (Globals.ADVANCED)
379431 {
380432 menu.add("-");
381433 linkerItem = menu.add(new MenuItem("Linker"));
382434 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385435 templateItem = menu.add(new MenuItem("Template"));
386436 templateItem.addActionListener(this);
387437 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -410,7 +460,7 @@
410460 genNormalsMESHItem.addActionListener(this);
411461 if (Globals.ADVANCED)
412462 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
463
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414464 genNormalsMINEItem.addActionListener(this);
415465 }
416466 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -503,10 +553,15 @@
503553 attachBumpItem.addActionListener(this);
504554 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
505555 pigmentBumpItem.addActionListener(this);
556
+ //embedTexturesItem
506557 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
507558 detachPigmentItem.addActionListener(this);
508559 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
509560 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);
510565 menu.add("-");
511566 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
512567 sortbysizeItem.addActionListener(this);
....@@ -533,6 +588,7 @@
533588 buildToolsMenu(menu);
534589 }
535590
591
+
536592 void SetupUI2(ObjEditor oe)
537593 {
538594 // June 2019
....@@ -575,51 +631,79 @@
575631 oe.radioPanel.add(dummyButton);
576632 oe.buttonGroup.add(dummyButton);
577633 */
634
+ cGridBag copyOptionsPanel = new cGridBag();
635
+
636
+ copyOptionsPanel.preferredHeight = 2;
637
+
578638 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
579639
580640 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
581641 //minButton.setToolTipText("Minimize window");
582642 //minButton.addActionListener(this);
583643
584
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- maxButton.setToolTipText("Maximize window");
586
- 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
+ }
587650
588
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589652 fullButton.setToolTipText("Full-screen window");
590653 fullButton.addActionListener(this);
591654
592
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
593
- undoButton.setToolTipText("Undo changes");
594
- 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);
595662
596
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- redoButton.setToolTipText("Redo changes");
598
- redoButton.addActionListener(this);
599
-
600
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
- saveButton.setToolTipText("Save changes");
663
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ saveButton.setToolTipText("New version");
602665 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);
603671
604
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
672
+ cGridBag updown = new cGridBag().setVertical(true);
673
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
+ restoreButton.setToolTipText("Restore current");
675
+ restoreButton.addActionListener(this);
676
+ restoreButton.setEnabled(false);
677
+
678
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
+ replaceButton.setToolTipText("Replace current");
680
+ replaceButton.addActionListener(this);
681
+ replaceButton.setEnabled(false);
682
+
683
+ copyOptionsPanel.add(updown);
684
+
685
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
+ redoButton.setToolTipText("Next version");
687
+ redoButton.addActionListener(this);
688
+ redoButton.setEnabled(false);
689
+
690
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
605691 liveCB.setToolTipText("Enable animation");
606692 liveCB.addItemListener(this);
607693
608
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609695 oneStepButton.setToolTipText("Animate one step forward");
610696 oneStepButton.addActionListener(this);
611697
612
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
698
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
613699 fastCB.setToolTipText("Fast mode");
614700 fastCB.addItemListener(this);
615701
616
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
617
- trackCB.setToolTipText("Enable tracking");
618
- trackCB.addItemListener(this);
619
-
620
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- screenfitButton.setToolTipText("Screen fit");
622
- screenfitButton.addActionListener(this);
702
+ //oe.toolboxPanel.Return();
703
+
704
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
705
+// trackCB.setToolTipText("Enable tracking");
706
+// trackCB.addItemListener(this);
623707
624708 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
625709 // screenfitpointButton.addActionListener(this);
....@@ -629,67 +713,244 @@
629713 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630714 snapobjectButton.addActionListener(this);
631715 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");
632720 }
633721
634
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
- flashSelectionButton.setToolTipText("Show selection");
636
- flashSelectionButton.addActionListener(this);
722
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
637723
638
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
639
-
640
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641
- twoButton.setToolTipText("Show center view only");
724
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
+ twoButton.setToolTipText("Show 3D view only");
642726 twoButton.addActionListener(this);
643
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
- fourButton.addActionListener(this);
645
- fourButton.setToolTipText("Show left panel only");
646
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
- sixButton.setToolTipText("2-column layout left");
648
- sixButton.addActionListener(this);
649
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- threeButton.setToolTipText("2-column layout right");
727
+ this.fullscreenLayout = twoButton;
728
+
729
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ threeButton.setToolTipText("Show controls and 3D view");
651731 threeButton.addActionListener(this);
652
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653
- sevenButton.setToolTipText("3-column layout");
654
- 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);
655738 //
656739
657
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658
- 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");
659742 rootButton.addActionListener(this);
660743
661
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662745 closeButton.setToolTipText("Close tab");
663746 closeButton.addActionListener(this);
664747 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
665748 //clearButton.addActionListener(this);
666
-
667
- cGridBag commandsPanel = new cGridBag();
749
+
750
+ cGridBag row1 = new cGridBag();
668751
669
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
- editButton.setToolTipText("Edit selection");
752
+ // INSERT
753
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
+ gridButton.setToolTipText("Create grid");
755
+ gridButton.addActionListener(this);
756
+
757
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
758
+ boxButton.setToolTipText("Create box");
759
+ boxButton.addActionListener(this);
760
+
761
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ sphereButton.setToolTipText("Create sphere");
763
+ sphereButton.addActionListener(this);
764
+
765
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ coneButton.setToolTipText("Create cone");
767
+ coneButton.addActionListener(this);
768
+
769
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ torusButton.setToolTipText("Create torus");
771
+ torusButton.addActionListener(this);
772
+
773
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
774
+ superButton.setToolTipText("Create superellipsoid");
775
+ superButton.addActionListener(this);
776
+
777
+ if (Globals.ADVANCED)
778
+ {
779
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ kleinButton.setToolTipText("Create Klein bottle");
781
+ kleinButton.addActionListener(this);
782
+ }
783
+
784
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ particlesButton.setToolTipText("Create particle system");
786
+ particlesButton.addActionListener(this);
787
+
788
+ oe.toolboxPanel.add(row1);
789
+
790
+ cGridBag row2 = new cGridBag();
791
+
792
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
793
+ groupButton.setToolTipText("Create group");
794
+ groupButton.addActionListener(this);
795
+
796
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ compositeButton.setToolTipText("Create composite");
798
+ compositeButton.addActionListener(this);
799
+
800
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ switchButton.setToolTipText("Create item switcher");
802
+ switchButton.addActionListener(this);
803
+
804
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
805
+ loopButton.setToolTipText("Create loop");
806
+ loopButton.addActionListener(this);
807
+
808
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ textureButton.setToolTipText("Create texture");
810
+ textureButton.addActionListener(this);
811
+
812
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ overlayButton.setToolTipText("Create overlay");
814
+ overlayButton.addActionListener(this);
815
+
816
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ lightButton.setToolTipText("Create light");
818
+ lightButton.addActionListener(this);
819
+
820
+ oe.toolboxPanel.add(row2);
821
+
822
+ // ENVYMAPS
823
+ cGridBag row3 = new cGridBag();
824
+ row3.preferredHeight = 20;
825
+
826
+ AddSkyboxButton("default", "rgb", row3);
827
+ AddSkyboxButton("default", "cornell", row3);
828
+ AddSkyboxButton("default", "uffizi", row3);
829
+ AddSkyboxButton("default", "CloudyHills", row3);
830
+ AddSkyboxButton("default", "skycube", row3);
831
+
832
+ oe.toolboxPanel.add(row3);
833
+
834
+ cGridBag row4 = new cGridBag();
835
+ row4.preferredHeight = 20;
836
+
837
+ AddSkyboxButton("bridge", "Bridge2", row4);
838
+ AddSkyboxButton("urban", "GamlaStan2", row4);
839
+ AddSkyboxButton("urban", "Parliament", row4);
840
+ AddSkyboxButton("urban", "Roundabout", row4);
841
+
842
+ oe.toolboxPanel.add(row4);
843
+
844
+ cGridBag row5 = new cGridBag();
845
+ row5.preferredHeight = 20;
846
+
847
+ AddSkyboxButton("urban", "SaintLazarusChurch", row5);
848
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row5);
849
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row5);
850
+ AddSkyboxButton("urban", "UnionSquare", row5);
851
+
852
+ oe.toolboxPanel.add(row5);
853
+
854
+ cGridBag row6 = new cGridBag();
855
+ row6.preferredHeight = 20;
856
+
857
+ AddSkyboxButton("park", "BerzeliiPark", row6);
858
+ AddSkyboxButton("park", "Buddha", row6);
859
+ AddSkyboxButton("park", "CNTower2", row6);
860
+ //AddSkyboxButton("park", "Fatbursparken", row6);
861
+ AddSkyboxButton("park", "NiagaraFalls1", row6);
862
+
863
+ oe.toolboxPanel.add(row6);
864
+
865
+ cGridBag row7 = new cGridBag();
866
+ row7.preferredHeight = 20;
867
+
868
+ AddSkyboxButton("park", "NiagaraFalls3", row7);
869
+ AddSkyboxButton("park", "Park", row7);
870
+ //AddSkyboxButton("park", "Park2", row6);
871
+ //AddSkyboxButton("park", "Path", row6);
872
+ AddSkyboxButton("park", "Pond", row7);
873
+ AddSkyboxButton("park", "Skansen", row7);
874
+
875
+ oe.toolboxPanel.add(row7);
876
+
877
+ cGridBag row8 = new cGridBag();
878
+ row8.preferredHeight = 20;
879
+
880
+ AddSkyboxButton("park", "Skansen2", row8);
881
+ AddSkyboxButton("park", "Skansen3", row8);
882
+ AddSkyboxButton("park", "Skansen4", row8);
883
+ AddSkyboxButton("park", "Skansen5", row8);
884
+
885
+ oe.toolboxPanel.add(row8);
886
+
887
+ cGridBag row9 = new cGridBag();
888
+ row9.preferredHeight = 20;
889
+
890
+ AddSkyboxButton("park", "Stairs", row9);
891
+ //AddSkyboxButton("park", "Tantolunden", row6);
892
+ //AddSkyboxButton("park", "Tantolunden3", row6);
893
+ AddSkyboxButton("park", "Tantolunden4", row9);
894
+
895
+ oe.toolboxPanel.add(row9);
896
+/*
897
+BerzeliiPark
898
+Buddha
899
+CNTower2
900
+Fatbursparken
901
+NiagaraFalls1
902
+NiagaraFalls3
903
+Park
904
+Park2
905
+Path
906
+Pond
907
+Skansen
908
+Skansen2
909
+Skansen3
910
+Skansen4
911
+Skansen5
912
+Stairs
913
+Tantolunden
914
+Tantolunden3
915
+Tantolunden4
916
+ */
917
+
918
+ for (int i=1; --i>=0;)
919
+ {
920
+ //oe.toolboxPanel.Return();
921
+ oe.toolboxPanel.add(new cGridBag());
922
+ }
923
+
924
+ // EDIT panel
925
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
926
+ editButton.setToolTipText("Pin selection controls");
671927 editButton.addActionListener(this);
672928
673
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- uneditButton.setToolTipText("Unedit selection");
929
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
+ uneditButton.setToolTipText("Remove selection controls");
675931 uneditButton.addActionListener(this);
676932
677
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
678
- allParamsButton.setToolTipText("Edit all params");
933
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
934
+ allParamsButton.setToolTipText("Show all controle");
679935 allParamsButton.addActionListener(this);
680936
681
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
937
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682938 clearPanelButton.setToolTipText("Clear edit panel");
683939 clearPanelButton.addActionListener(this);
684940
685
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
941
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686942 unselectButton.setToolTipText("Unselect");
687943 unselectButton.addActionListener(this);
688944
689
- commandsPanel.preferredHeight = 1;
945
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
946
+ flashSelectionButton.setToolTipText("Highlight selection");
947
+ flashSelectionButton.addActionListener(this);
690948
691
- oe.treePanel.add(commandsPanel);
692
- oe.treePanel.Return();
949
+ editCommandsPanel.preferredHeight = 1;
950
+
951
+ SetPinStates(false);
952
+// oe.treePanel.add(commandsPanel);
953
+// oe.treePanel.Return();
693954
694955 // oe.aConstraints.gridx += 1;
695956 // oe.aConstraints.weighty = 0;
....@@ -706,32 +967,20 @@
706967
707968 JScrollPane jSP;
708969 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
709
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
970
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
710971 ResetModel();
711972
712973 oe.treePanel.add(jSPPanel);
713974 oe.treePanel.Return();
714975
715
- cGridBag copyOptionsPanel = new cGridBag();
716
-
717
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
718
- colorCB.setToolTipText("Copy color when dropped");
719
- colorCB.addItemListener(this);
720
-
721
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
722
- materialCB.setToolTipText("Copy material when dropped");
723
- materialCB.addItemListener(this);
724
-
725
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
726
- textureCB.setToolTipText("Copy texture when dropped");
727
- textureCB.addItemListener(this);
728
-
729
- copyOptionsPanel.preferredHeight = 1;
730976 oe.treePanel.add(copyOptionsPanel);
731977 oe.treePanel.Return();
978
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
+ sliderPane.preferredHeight = 1;
732981
733
-// mainPanel.setDividerLocation(0.5); //1.0);
734
-// mainPanel.setResizeWeight(0.5);
982
+// mainPanel.setDividerLocation(0.1); //1.0);
983
+ mainPanel.setResizeWeight(0.4);
735984
736985 //jList.addListSelectionListener(this);
737986 oe.jTree.addTreeSelectionListener(this);
....@@ -739,7 +988,7 @@
739988 //jTree.setEditable(true);
740989 oe.jTree.setDragEnabled(true);
741990 //jTree.setPreferredSize(new Dimension(10,10));
742
- jSP.setPreferredSize(new Dimension(100,200));
991
+ //jSP.setPreferredSize(new Dimension(100,200));
743992
744993 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
745994
....@@ -751,29 +1000,49 @@
7511000 dgr.addDragGestureListener(this);
7521001 }catch(Exception e) {}
7531002 */
754
- radio.layout = sevenButton;
1003
+ radio.layout = sixButton; // sevenButton;
7551004 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7561005 }
7571006
7581007 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7591008 {
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
+
7601023 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7611024 boxCB.setToolTipText("Display bounding boxes");
7621025 boxCB.addItemListener(this);
7631026
7641027 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
765
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1028
+ zoomBoxCB.setToolTipText("Display only for wheel");
7661029 zoomBoxCB.addItemListener(this);
7671030
7681031 if (true) // Globals.ADVANCED)
7691032 {
770
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
771
- supportCB.setToolTipText("Enable rigging");
772
- 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);
7731040
7741041 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7751042 // localCB.addItemListener(this);
7761043
1044
+ panel.Return();
1045
+
7771046 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7781047 crowdCB.setToolTipText("Used for crowds");
7791048 crowdCB.addItemListener(this);
....@@ -790,6 +1059,8 @@
7901059 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7911060 // speakerMocapCB.addItemListener(this);
7921061
1062
+ panel.Return();
1063
+
7931064 if (false)
7941065 {
7951066 // handled in scripts
....@@ -804,34 +1075,74 @@
8041075 //constraints.gridy += 1;
8051076 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
8061077 smoothfocusCB.addItemListener(this);
1078
+ panel.Return();
8071079 }
8081080
8091081 //constraints.gridx += 1;
8101082 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
8111083 // debugCB.addItemListener(this);
8121084
1085
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1086
+ trackCB.setToolTipText("Enable tracking target");
1087
+ trackCB.addItemListener(this);
1088
+
8131089 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1090
+ oeilCB.setToolTipText("Move camera when tracking");
8141091 oeilCB.addItemListener(this);
8151092
1093
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1094
+ shadowCB.setToolTipText("When live compute shadows");
1095
+ shadowCB.addItemListener(this);
1096
+
1097
+ panel.Return();
1098
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1099
+ toggleTextureCB.setToolTipText("Load textures");
1100
+ toggleTextureCB.addItemListener(this);
1101
+
1102
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1103
+ toggleSwitchCB.setToolTipText("Choose a single item");
1104
+ toggleSwitchCB.addItemListener(this);
1105
+
1106
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1107
+ autokeepCB.setToolTipText("On structure change");
1108
+ autokeepCB.addItemListener(this);
1109
+
1110
+ panel.Return();
1111
+ if (Globals.ADVANCED)
1112
+ {
8161113 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
8171114 lookAtCB.setToolTipText("Look-at target");
8181115 lookAtCB.addItemListener(this);
1116
+ }
8191117
8201118 }
8211119
8221120 cGridBag fill = new cGridBag();
823
-
8241121 fill.preferredHeight = 200;
1122
+ cGridBag fill2 = new cGridBag();
1123
+ fill2.preferredHeight = 200;
1124
+ cGridBag fill3 = new cGridBag();
1125
+ fill3.preferredHeight = 200;
8251126
8261127 panel.add(fill);
1128
+ panel.add(fill2);
1129
+ panel.add(fill3);
8271130
8281131 }
8291132
8301133 void EditObject(Object3D obj)
8311134 {
8321135 cRadio radioButton = new cRadio(obj.name);
1136
+
1137
+ // June 2019. Patch to avoid bug with transparency.
1138
+ radioButton.hadMaterial = obj.material != null;
1139
+ if (!radioButton.hadMaterial)
1140
+ {
1141
+ obj.material = new cMaterial();
1142
+ }
1143
+
8331144 radioButton.SetObject(obj);
834
- radioButton.layout = sevenButton;
1145
+ radioButton.layout = sixButton; // sevenButton;
8351146 radioButton.SetCamera(cameraView.renderCamera, false);
8361147 radioButton.addActionListener(this);
8371148 radioPanel.add(radioButton);
....@@ -851,23 +1162,28 @@
8511162 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8521163 }
8531164
854
- JCheckBox liveCB;
855
- JCheckBox supportCB;
856
- JCheckBox localCB;
857
- JCheckBox crowdCB;
858
- JCheckBox smoothCB;
859
- JCheckBox fastCB;
860
- JCheckBox slowCB;
861
- JCheckBox boxCB;
862
- JCheckBox zoomBoxCB;
863
- JCheckBox trackCB;
864
- JCheckBox smoothfocusCB;
1165
+ cToggleButton liveCB;
1166
+ cCheckBox supportCB;
1167
+ cCheckBox localCB;
1168
+ cCheckBox crowdCB;
1169
+ cCheckBox smoothCB;
1170
+ cToggleButton fastCB;
1171
+ cCheckBox slowCB;
1172
+ cCheckBox boxCB;
1173
+ cCheckBox zoomBoxCB;
1174
+ cCheckBox freezeCB;
1175
+ //cToggleButton trackCB;
1176
+ cCheckBox trackCB;
1177
+ cCheckBox smoothfocusCB;
8651178 // JCheckBox speakerMocapCB;
866
- JCheckBox speakerCameraCB;
867
- JCheckBox speakerFocusCB;
868
- JCheckBox debugCB;
869
- JCheckBox oeilCB;
870
- JCheckBox lookAtCB;
1179
+ cCheckBox speakerCameraCB;
1180
+ cCheckBox speakerFocusCB;
1181
+ cCheckBox debugCB;
1182
+
1183
+ cCheckBox oeilCB;
1184
+ cCheckBox shadowCB;
1185
+ cCheckBox autokeepCB;
1186
+ cCheckBox lookAtCB;
8711187
8721188 // static int COLOR = 1;
8731189 // static int MATERIAL = 2;
....@@ -875,9 +1191,9 @@
8751191
8761192 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8771193
878
- JCheckBox colorCB;
879
- JCheckBox materialCB;
880
- JCheckBox textureCB;
1194
+ cCheckBox colorCB;
1195
+ cCheckBox materialCB;
1196
+ cCheckBox textureCB;
8811197
8821198 public void itemStateChanged(ItemEvent e)
8831199 {
....@@ -970,6 +1286,18 @@
9701286 {
9711287 cameraView.ToggleOeil();
9721288 }
1289
+ else if(e.getSource() == shadowCB)
1290
+ {
1291
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1292
+ }
1293
+ else if(e.getSource() == freezeCB)
1294
+ {
1295
+ Globals.FREEZEONMOVE ^= true;
1296
+ }
1297
+ else if(e.getSource() == autokeepCB)
1298
+ {
1299
+ Globals.REPLACEONMAKE ^= true;
1300
+ }
9731301 else if(e.getSource() == lookAtCB)
9741302 {
9751303 cameraView.ToggleLookAt();
....@@ -986,7 +1314,8 @@
9861314
9871315 /**/
9881316 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
989
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1317
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1318
+ TreePath path = objEditor.jTree.getSelectionPath();
9901319 if ((path == null) || (path.getPathCount() <= 1)) {
9911320 // We can't move the root node or an empty selection
9921321 return;
....@@ -1049,8 +1378,6 @@
10491378 }
10501379 }
10511380
1052
- String string = (String) object;
1053
-
10541381 System.out.println("Transfer = " + object + "; drop : " + target);
10551382 // if( object instanceof java.io.File[])
10561383 // {
....@@ -1058,6 +1385,8 @@
10581385 // objEditor.DropFile((java.io.File[]) object, true);
10591386 // return;
10601387 // }
1388
+
1389
+ String string = object.toString();
10611390
10621391 // File path for Mac and Windows
10631392 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1103,23 +1432,33 @@
11031432
11041433 assert target == objEditor.jTree;
11051434 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1435
+ Object3D destinationLeaf;
11061436 try {
1107
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1437
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11081438 } catch (Exception e) {
11091439 System.out.println("destinationPath : " + destinationPath);
11101440 return;
11111441 }
11121442
1113
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1443
+ for (int i=group.selection.size(); --i>=0;)
11141444 {
1445
+ Object3D child = (Object3D)group.selection.elementAt(i);
1446
+
1447
+ // Cannot move into itself
1448
+ if (child == destinationLeaf)
1449
+ return;
1450
+ }
1451
+
1452
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1453
+// {
11151454 loadClipboard(true);
11161455 objEditor.jTree.setSelectionPath(destinationPath);
11171456 pasteInto(false, false);
1118
- } else {
1119
- loadClipboard(false);
1120
- objEditor.jTree.setSelectionPath(destinationPath);
1121
- pasteInto(false, false); // true); // ???
1122
- }
1457
+// } else {
1458
+// loadClipboard(false);
1459
+// objEditor.jTree.setSelectionPath(destinationPath);
1460
+// pasteInto(false, false); // true); // ???
1461
+// }
11231462 }
11241463 public void dropActionChanged(DropTargetDragEvent dtde)
11251464 // Called if the user has modified the current drop gesture
....@@ -1224,22 +1563,30 @@
12241563 {
12251564 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12261565 //heightFieldItem.addActionListener(this);
1227
- gridItem = menu.add(new MenuItem("Grid"));
1228
- gridItem.addActionListener(this);
1229
- rectoidItem = menu.add(new MenuItem("Box"));
1230
- rectoidItem.addActionListener(this);
1231
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1232
- ellipsoidItem.addActionListener(this);
1233
- coneItem = menu.add(new MenuItem("Cone"));
1234
- coneItem.addActionListener(this);
1235
- torusItem = menu.add(new MenuItem("Torus"));
1236
- torusItem.addActionListener(this);
1237
- superItem = menu.add(new MenuItem("Superellipsoid"));
1238
- superItem.addActionListener(this);
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
+ {
12391584 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12401585 kleinItem.addActionListener(this);
1241
- particleItem = menu.add(new MenuItem("Particle system"));
1242
- particleItem.addActionListener(this);
1586
+ }
1587
+
1588
+// particleItem = menu.add(new MenuItem("Particle system"));
1589
+// particleItem.addActionListener(this);
12431590 if (Globals.ADVANCED)
12441591 {
12451592 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1265,15 +1612,15 @@
12651612 }
12661613 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12671614 bezierItem.addActionListener(this);
1268
- overlayItem = menu.add(new MenuItem("Overlay"));
1269
- overlayItem.addActionListener(this);
1270
- lightItem = menu.add(new MenuItem("Light"));
1271
- lightItem.addActionListener(this);
1615
+// overlayItem = menu.add(new MenuItem("Overlay"));
1616
+// overlayItem.addActionListener(this);
1617
+// lightItem = menu.add(new MenuItem("Light"));
1618
+// lightItem.addActionListener(this);
12721619 menu.add("-");
12731620 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12741621 //superLoopItem.addActionListener(this);
1275
- loopItem = menu.add(new MenuItem("Loop"));
1276
- loopItem.addActionListener(this);
1622
+// loopItem = menu.add(new MenuItem("Loop"));
1623
+// loopItem.addActionListener(this);
12771624 doubleItem = menu.add(new MenuItem("Fork"));
12781625 doubleItem.addActionListener(this);
12791626 if (Globals.ADVANCED)
....@@ -1289,6 +1636,9 @@
12891636 animationItem.addItemListener(this);
12901637 animationItem.setState(Globals.ANIMATION);
12911638
1639
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1640
+ archiveItem.addActionListener(this);
1641
+
12921642 menu.add("-");
12931643 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12941644 parseverticesItem.addActionListener(this);
....@@ -1301,6 +1651,8 @@
13011651 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13021652 reduce34MorphItem.addActionListener(this);
13031653 menu.add("-");
1654
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1655
+ memoryItem.addActionListener(this);
13041656 menu.add(computeAOItem = new MenuItem("Compute AO"));
13051657 computeAOItem.addActionListener(this);
13061658
....@@ -1309,8 +1661,6 @@
13091661 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13101662 mirrorItem.addActionListener(this);
13111663 menu.add("-");
1312
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1313
- memoryItem.addActionListener(this);
13141664 menu.add(analyzeItem = new MenuItem("Analyze"));
13151665 analyzeItem.addActionListener(this);
13161666 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1454,9 +1804,34 @@
14541804 shadow.material = new cMaterial(obj.material);
14551805 shadow.material.diffuse = 0.0001f;
14561806 shadow.material.specular = 0.0001f;
1807
+ //shadow.projectedVertices[1].x = 300;
14571808
14581809 makeSomething(shadow);
14591810 }
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
+ }
14601835
14611836 /**
14621837 * applyExample
....@@ -1701,7 +2076,7 @@
17012076 {
17022077 ScreenFit();
17032078 } else
1704
- if (source == switchItem)
2079
+ if (source == switchViewItem)
17052080 {
17062081 cVector v1 = new cVector();
17072082 cVector v2 = new cVector();
....@@ -1710,11 +2085,11 @@
17102085 objEditor.cameraView.renderCamera.setAim(v2, v1);
17112086 objEditor.cameraView.repaint();
17122087 } else
1713
- if (source == rectoidItem)
2088
+ if (source == rectoidItem || source == boxButton)
17142089 {
17152090 makeSomething(new Box());
17162091 } else
1717
- if (source == particleItem)
2092
+ if (source == particleItem || source == particlesButton)
17182093 {
17192094 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17202095 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1793,27 +2168,27 @@
17932168
17942169 makeSomething(obj);
17952170 } else
1796
- if (source == gridItem)
2171
+ if (source == gridItem || source == gridButton)
17972172 {
17982173 makeSomething(new Grid());
17992174 } else
1800
- if (source == ellipsoidItem)
2175
+ if (source == ellipsoidItem || source == sphereButton)
18012176 {
18022177 makeSomething(new Sphere());
18032178 } else
1804
- if (source == coneItem)
2179
+ if (source == coneItem || source == coneButton)
18052180 {
18062181 makeSomething(new Cone());
18072182 } else
1808
- if (source == torusItem)
2183
+ if (source == torusItem || source == torusButton)
18092184 {
18102185 makeSomething(new Torus());
18112186 } else
1812
- if (source == superItem)
2187
+ if (source == superItem || source == superButton)
18132188 {
18142189 makeSomething(new Superellipsoid());
18152190 } else
1816
- if (source == kleinItem)
2191
+ if (source == kleinItem || source == kleinButton)
18172192 {
18182193 makeSomething(new Klein());
18192194 } else
....@@ -1833,7 +2208,7 @@
18332208 {
18342209 makeSomething(new BezierSurface());
18352210 } else
1836
- if (source == overlayItem)
2211
+ if (source == overlayItem || source == overlayButton)
18372212 {
18382213 /*
18392214 Object3D obj = new BezierSurface(5,8);
....@@ -1881,10 +2256,27 @@
18812256 s.setup();
18822257 makeSomething(s);
18832258 } else
1884
- if (source == lightItem)
2259
+ if (source == lightItem || source == lightButton)
18852260 {
18862261 makeSomething(new Light());
18872262 } 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
18882280 if (source == csgItem)
18892281 {
18902282 group(new CSG());
....@@ -1931,30 +2323,30 @@
19312323
19322324 group(g);
19332325 } else
1934
- if (source == loopItem)
2326
+ if (source == loopItem || source == loopButton)
19352327 {
19362328 Composite csg = new GroupLeaf();
19372329 csg.count = 5;
19382330 group(csg);
1939
- Composite child = new cGroup();
2331
+ Composite child = new cGroup("Branch");
19402332 csg.addChild(child);
19412333 child.addChild(csg);
19422334 } else
19432335 if (source == doubleItem)
19442336 {
1945
- Composite csg = new GroupLeaf();
2337
+ Composite csg = new GroupLeaf("Fork");
19462338 csg.count = 5;
19472339 group(csg);
1948
- Composite child = new cGroup();
2340
+ Composite child = new cGroup("Branch A");
19492341 csg.addChild(child);
19502342 child.addChild(csg);
1951
- child = new cGroup();
2343
+ child = new cGroup("Branch B");
19522344 csg.addChild(child);
19532345 child.addChild(csg);
19542346 } else
19552347 if (source == tripleItem)
19562348 {
1957
- Composite csg = new GroupLeaf();
2349
+ Composite csg = new GroupLeaf("Trident");
19582350 csg.count = 4;
19592351 group(csg);
19602352 Composite child = new cGroup();
....@@ -1970,7 +2362,7 @@
19702362 if (source == computeAOItem)
19712363 {
19722364 Globals.drawMode = CameraPane.OCCLUSION;
1973
- Globals.theRenderer.repaint();
2365
+ cameraView.repaint();
19742366 } else
19752367 if (source == recompileItem)
19762368 {
....@@ -2018,15 +2410,31 @@
20182410 } else
20192411 if (source == undoButton)
20202412 {
2413
+ // Go to previous version
2414
+ //if (!Undo())
2415
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20212416 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();
20222427 } else
20232428 if (source == redoButton)
20242429 {
2430
+ // Go to next version
20252431 Redo();
20262432 } else
20272433 if (source == saveButton)
20282434 {
2029
- Save();
2435
+ // Save a new version
2436
+ if (!Save(true))
2437
+ java.awt.Toolkit.getDefaultToolkit().beep();
20302438 } else
20312439 if (source == oneStepButton)
20322440 {
....@@ -2035,17 +2443,14 @@
20352443 } else
20362444 if (source == screenfitButton)
20372445 {
2038
- //Reload(lastConverter, lastFilename, true);
20392446 ScreenFit();
20402447 } else
20412448 if (source == screenfitpointButton)
20422449 {
2043
- //Reload(lastConverter, lastFilename, true);
20442450 ScreenFitPoint();
20452451 } else
20462452 if (source == snapobjectButton)
20472453 {
2048
- //Reload(lastConverter, lastFilename, true);
20492454 SnapObject();
20502455 } else
20512456 // if (event.getSource() == recompileButton)
....@@ -2409,7 +2814,7 @@
24092814 {
24102815 StepAll();
24112816 } else
2412
- if (source == clearItem) // || event.getSource() == clearButton)
2817
+ if (source == deleteItem) // || event.getSource() == clearButton)
24132818 {
24142819 //int indices[] = jList.getSelectedIndices();
24152820 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2421,9 +2826,9 @@
24212826 {
24222827 ClearSelection(true);
24232828 } else
2424
- if (source == grabItem)
2829
+ if (source == grabItem || source == groupButton)
24252830 {
2426
- group(new cGroup(), true);
2831
+ group(new cGroup(), false); // true);
24272832 } else
24282833 if (source == hideItem)
24292834 {
....@@ -2441,11 +2846,11 @@
24412846 {
24422847 makeSomething(new Camera());
24432848 } else
2444
- if (source == compositeItem)
2849
+ if (source == compositeItem || source == compositeButton)
24452850 {
24462851 group(new Composite());
24472852 } else
2448
- if (source == randomItem)
2853
+ if (source == switchItem || source == switchButton)
24492854 {
24502855 RandomNode random = new RandomNode();
24512856 group(random);
....@@ -2547,7 +2952,7 @@
25472952 {
25482953 group(new cLinker());
25492954 } else
2550
- if (source == textureItem)
2955
+ if (source == textureItem || source == textureButton)
25512956 {
25522957 group(new TextureNode());
25532958 } else
....@@ -2567,17 +2972,30 @@
25672972 {
25682973 CastShadow(2);
25692974 } else
2570
- if (source == ungroupItem)
2975
+ if (source == ungroupItem || source == ungroupButton)
25712976 {
2572
- //ungroup();
2977
+ boolean hasRoot = false;
2978
+
25732979 for (int i=0; i<group.selection.size(); i++)
25742980 {
2575
- Ungroup(group.selection.get(i));
2981
+ if (group.selection.get(i) == group)
2982
+ {
2983
+ hasRoot = true;
2984
+ break;
2985
+ }
25762986 }
25772987
2578
- ClearSelection(false);
2579
-
2580
- 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
+ }
25812999 } else
25823000 if (source == genUVItem)
25833001 {
....@@ -2878,7 +3296,7 @@
28783296 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28793297 {
28803298 obj = (Object3D)e.nextElement();
2881
- obj.SetBumpTexture(null);
3299
+ obj.ResetBumpTexture();
28823300 }
28833301
28843302 refreshContents();
....@@ -2894,6 +3312,31 @@
28943312
28953313 refreshContents();
28963314 } else
3315
+ if (source == embedTexturesItem)
3316
+ {
3317
+ Object3D obj;
3318
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3319
+ {
3320
+ obj = (Object3D)e.nextElement();
3321
+ obj.EmbedTextures(true);
3322
+ }
3323
+
3324
+ refreshContents();
3325
+ } else
3326
+ if (source == deEmbedTexturesItem)
3327
+ {
3328
+ Object3D obj;
3329
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3330
+ {
3331
+ obj = (Object3D)e.nextElement();
3332
+ obj.EmbedTextures(false);
3333
+ }
3334
+
3335
+ CameraPane.texturepigment.clear();
3336
+ CameraPane.texturebump.clear();
3337
+
3338
+ refreshContents();
3339
+ } else
28973340 if (source == flashSelectionButton)
28983341 {
28993342 CameraPane.flash = true;
....@@ -2905,6 +3348,10 @@
29053348 if (source == twoButton)
29063349 {
29073350 radio.layout = twoButton;
3351
+
3352
+ if (CameraPane.FULLSCREEN)
3353
+ fullscreenLayout = radio.layout;
3354
+
29083355 // bug
29093356 //gridPanel.setDividerLocation(1.0);
29103357 //bigPanel.setDividerLocation(0.0);
....@@ -2960,6 +3407,9 @@
29603407 {
29613408 radio.layout = threeButton;
29623409
3410
+ if (CameraPane.FULLSCREEN)
3411
+ fullscreenLayout = radio.layout;
3412
+
29633413 // bigThree.remove(scenePanel);
29643414 // bigThree.remove(centralPanel);
29653415 // bigThree.remove(XYZPanel);
....@@ -2988,8 +3438,8 @@
29883438 // centralPanel.setVisible(true);
29893439 // XYZPanel.setVisible(true);
29903440 bigThree.ClearUI();
3441
+ bigThree.add(scenePanel);
29913442 bigThree.add(centralPanel);
2992
- bigThree.add(XYZPanel);
29933443 bigThree.FlushUI();
29943444
29953445 cameraView.requestFocusInWindow();
....@@ -2997,6 +3447,9 @@
29973447 if (source == fourButton)
29983448 {
29993449 radio.layout = fourButton;
3450
+
3451
+ if (CameraPane.FULLSCREEN)
3452
+ fullscreenLayout = radio.layout;
30003453
30013454 // bigThree.remove(scenePanel);
30023455 // bigThree.remove(centralPanel);
....@@ -3035,6 +3488,9 @@
30353488 {
30363489 radio.layout = sixButton;
30373490
3491
+ if (CameraPane.FULLSCREEN)
3492
+ fullscreenLayout = radio.layout;
3493
+
30383494 // bigThree.remove(scenePanel);
30393495 // bigThree.remove(centralPanel);
30403496 // bigThree.remove(XYZPanel);
....@@ -3063,8 +3519,8 @@
30633519 // centralPanel.setVisible(true);
30643520 // XYZPanel.setVisible(false);
30653521 bigThree.ClearUI();
3066
- bigThree.add(scenePanel);
30673522 bigThree.add(centralPanel);
3523
+ bigThree.add(scenePanel);
30683524 bigThree.FlushUI();
30693525
30703526 cameraView.requestFocusInWindow();
....@@ -3072,6 +3528,9 @@
30723528 if (source == sevenButton)
30733529 {
30743530 radio.layout = sevenButton;
3531
+
3532
+ if (CameraPane.FULLSCREEN)
3533
+ fullscreenLayout = radio.layout;
30753534
30763535 // bigThree.remove(scenePanel);
30773536 // bigThree.remove(centralPanel);
....@@ -3128,12 +3587,19 @@
31283587 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31293588 {
31303589 ab = (cRadio)e.nextElement();
3131
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3590
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31323591 {
3592
+ // Patch to avoid bug with transparency.
3593
+ if (!ab.hadMaterial)
3594
+ {
3595
+ ab.object.material = null;
3596
+ }
3597
+
31333598 buttonGroup.remove(ab);
31343599 radioPanel.remove(ab);
31353600
3136
- ab.GetObject().editWindow = null;
3601
+ //ab.GetObject().editWindow = null;
3602
+ ab.GetObject().manipWindow = null;
31373603 // ab.GetObject().objectUI = null; // ?????????
31383604
31393605 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3146,6 +3612,12 @@
31463612 } else
31473613 if (source == editItem || source == editButton)
31483614 {
3615
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3616
+ {
3617
+ Object3D child = (Object3D)e.nextElement();
3618
+ child.pinned = true;
3619
+ }
3620
+
31493621 EditSelection(false);
31503622 } else
31513623 if (source == uneditButton)
....@@ -3155,6 +3627,7 @@
31553627 Object3D child = (Object3D)e.nextElement();
31563628 if(child.editWindow != null)
31573629 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3630
+ child.pinned = false;
31583631 child.CloseUI();
31593632 listUI.remove(child);
31603633
....@@ -3171,6 +3644,7 @@
31713644 //copy.ClearUI();
31723645 for (Object3D obj : listUI)
31733646 {
3647
+ obj.pinned = false;
31743648 obj.CloseUI();
31753649 }
31763650 listUI.clear();
....@@ -3180,7 +3654,7 @@
31803654 {
31813655 assert(copy == group);
31823656
3183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3657
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31843658
31853659 for (Object3D obj : listUI)
31863660 {
....@@ -3229,6 +3703,9 @@
32293703 }
32303704
32313705 copy = group;
3706
+
3707
+ SetUndoStates();
3708
+
32323709 //Globals.theRenderer.object = group;
32333710 if(!useclient)
32343711 {
....@@ -3247,6 +3724,7 @@
32473724
32483725 // fix "+" issue
32493726 //group.editWindow = this;
3727
+ group.manipWindow = this;
32503728
32513729 /*
32523730 currentLayout = radio.layout;
....@@ -3254,6 +3732,13 @@
32543732 currentLayout = sevenButton;
32553733 */
32563734 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);
32573742 keepparent = group.parent;
32583743 // PARENT = NULL or not???
32593744 //group.parent = null; // ROOT
....@@ -3267,7 +3752,7 @@
32673752 cameraView.ProtectCamera();
32683753 cameraView.repaint();
32693754 return;
3270
- } else if (event.getSource() == revertCameraItem)
3755
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32713756 {
32723757 cameraView.RevertCamera();
32733758 cameraView.repaint();
....@@ -3846,7 +4331,7 @@
38464331
38474332 try
38484333 {
3849
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4334
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
38504335 }
38514336 catch (Exception e)
38524337 {
....@@ -4321,28 +4806,25 @@
43214806 // }
43224807 // }
43234808
4324
- static boolean allparams = true;
4325
-
4326
- static Vector<Object3D> listUI = new Vector<Object3D>();
4327
-
43284809 void EditSelection(boolean newWindow)
43294810 {
4811
+ if (group.selection == null)
4812
+ {
4813
+ EditElement(group, newWindow); // ? new
4814
+ return;
4815
+ }
4816
+
43304817 // aConstraints.gridy = 0;
43314818 for (int i=0; i<group.selection.size(); i++)
43324819 {
43334820 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43344821 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4335
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4822
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43364823
43374824 Object3D elem = (Object3D)group.selection.elementAt(i);
43384825 if(elem != group || !newWindow)
43394826 {
4340
- // if (!(elem instanceof Composite))
4341
- // newWindow = false;
4342
- listUI.add(elem);
4343
- elem.openEditWindow(this, newWindow); //, false);
4344
- System.out.println("edit : " + elem);
4345
- elem.editWindow.refreshContents(true); // ? new
4827
+ EditElement(elem, newWindow); // ? new
43464828 }
43474829 }
43484830 }
....@@ -4417,7 +4899,8 @@
44174899 //new Exception().printStackTrace();
44184900
44194901 freezemodel = true;
4420
-
4902
+ ClearUnpinned();
4903
+
44214904 /**/
44224905 //switch (event.id)
44234906 {
....@@ -4450,7 +4933,7 @@
44504933 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44514934 // a camera
44524935 {
4453
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4936
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44544937 {
44554938 CameraPane.camerachangeframe = 0; // don't refuse it
44564939 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4459,6 +4942,13 @@
44594942 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44604943 }
44614944
4945
+ if (tps != null && tps.length == 1)
4946
+ {
4947
+ EditSelection(false);
4948
+ }
4949
+
4950
+ SetPinStates(tps != null && tps.length > 0);
4951
+
44624952 refreshContents();
44634953 //return true;
44644954 }
....@@ -4468,9 +4958,18 @@
44684958 freezemodel = false;
44694959 }
44704960
4961
+ void SetPinStates(boolean enabled)
4962
+ {
4963
+ editButton.setEnabled(enabled);
4964
+ uneditButton.setEnabled(enabled);
4965
+ unselectButton.setEnabled(enabled);
4966
+ flashSelectionButton.setEnabled(enabled);
4967
+ }
4968
+
44714969 void refreshContents(boolean cp)
44724970 {
4473
- if (!Globals.MOUSEDRAGGED)
4971
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4972
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44744973 {
44754974 objEditor.ClearInfo(); // .GetMaterial());
44764975
....@@ -4569,7 +5068,8 @@
45695068
45705069 if (cut)
45715070 {
4572
- Save();
5071
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5072
+// Save();
45735073 //int indices[] = jList.getSelectedIndices();
45745074 //for (int i = indices.length - 1; i >= 0; i--)
45755075 //jList.remove(indices[i]);
....@@ -4672,6 +5172,10 @@
46725172
46735173 void paste(boolean expand)
46745174 {
5175
+ if (Globals.REPLACEONMAKE)
5176
+ Save();
5177
+ boolean keep = Globals.REPLACEONMAKE;
5178
+ Globals.REPLACEONMAKE = false;
46755179 // if (GrafreeD.clipboard == null)
46765180 // return;
46775181 boolean first = true;
....@@ -4731,6 +5235,7 @@
47315235 Grafreed.clipboard.get(0).parent = keepparent;
47325236 }
47335237
5238
+ Globals.REPLACEONMAKE = keep;
47345239 ResetModel();
47355240 refreshContents();
47365241 }
....@@ -4866,6 +5371,10 @@
48665371
48675372 void group(Object3D csg, boolean grab)
48685373 {
5374
+ if (Globals.REPLACEONMAKE)
5375
+ Save();
5376
+ boolean keep = Globals.REPLACEONMAKE;
5377
+ Globals.REPLACEONMAKE = false;
48695378 if (//false) // why??
48705379 !group.selection.isEmpty())
48715380 {
....@@ -4979,10 +5488,15 @@
49795488 //node.add(csg);
49805489 //makeSomething(node);
49815490 makeSomething(csg);
5491
+ Globals.REPLACEONMAKE = keep;
49825492 }
49835493
49845494 void Ungroup(Object3D g)
49855495 {
5496
+ if (Globals.REPLACEONMAKE)
5497
+ Save();
5498
+ boolean keep = Globals.REPLACEONMAKE;
5499
+ Globals.REPLACEONMAKE = false;
49865500 if (g instanceof HiddenObject)
49875501 {
49885502 HiddenObject h = (HiddenObject) g;
....@@ -4999,6 +5513,7 @@
49995513 objEditor.makeSomething(g.get(i), false);
50005514 }
50015515 }
5516
+ Globals.REPLACEONMAKE = keep;
50025517 }
50035518
50045519 void ungroup()
....@@ -5287,13 +5802,44 @@
52875802 cButton clearpanelButton;
52885803 cButton unselectButton;
52895804
5290
- cButton minButton;
5291
- cButton maxButton;
5292
- cButton fullButton;
5293
- cButton undoButton;
5294
- cButton redoButton;
5805
+ cButton restoreCameraButton;
5806
+
52955807 cButton saveButton;
52965808 cButton oneStepButton;
5809
+
5810
+ cButton groupButton;
5811
+ cButton ungroupButton;
5812
+ cButton compositeButton;
5813
+ cButton switchButton;
5814
+ cButton loopButton;
5815
+ cButton textureButton;
5816
+
5817
+ cButton skybox1Button;
5818
+ cButton skybox2Button;
5819
+ cButton skybox3Button;
5820
+ cButton skybox4Button;
5821
+ cButton skybox5Button;
5822
+ cButton skybox6Button;
5823
+ cButton skybox7Button;
5824
+
5825
+ cButton skybox11Button;
5826
+ cButton skybox12Button;
5827
+ cButton skybox13Button;
5828
+ cButton skybox14Button;
5829
+ cButton skybox15Button;
5830
+ cButton skybox16Button;
5831
+ cButton skybox17Button;
5832
+
5833
+ cButton gridButton;
5834
+ cButton boxButton;
5835
+ cButton sphereButton;
5836
+ cButton coneButton;
5837
+ cButton torusButton;
5838
+ cButton superButton;
5839
+ cButton kleinButton;
5840
+ cButton particlesButton;
5841
+ cButton overlayButton;
5842
+ cButton lightButton;
52975843
52985844 cButton screenfitButton;
52995845 cButton screenfitpointButton;
....@@ -5315,11 +5861,11 @@
53155861 //JTree jTree;
53165862 private MenuItem lookAtItem;
53175863 private MenuItem lookFromItem;
5318
- private MenuItem switchItem;
5864
+ private MenuItem switchViewItem;
53195865 private MenuItem cutItem;
53205866 private MenuItem undoItem;
53215867 private MenuItem redoItem;
5322
- private MenuItem duplicateItem;
5868
+ private JMenuItem duplicateItem;
53235869 private MenuItem cloneItem;
53245870 private MenuItem cloneSupportItem;
53255871 private MenuItem overwriteGeoItem;
....@@ -5347,7 +5893,7 @@
53475893 private MenuItem pasteLinkItem;
53485894 private MenuItem pasteCloneItem;
53495895 private MenuItem pasteExpandItem;
5350
- private MenuItem clearItem;
5896
+ private MenuItem deleteItem;
53515897 private MenuItem clearAllItem;
53525898 private MenuItem genUVItem;
53535899 private MenuItem genNormalsMESHItem;
....@@ -5407,7 +5953,7 @@
54075953 private MenuItem frontItem;
54085954 private MenuItem cameraItem;
54095955 private MenuItem compositeItem;
5410
- private MenuItem randomItem;
5956
+ private MenuItem switchItem;
54115957 private MenuItem physicsItem;
54125958 private MenuItem frameselectorItem;
54135959 private MenuItem scriptNodeItem;
....@@ -5431,6 +5977,8 @@
54315977 private MenuItem attachBumpItem;
54325978 private MenuItem detachBumpItem;
54335979 private MenuItem pigmentBumpItem;
5980
+ private MenuItem embedTexturesItem;
5981
+ private MenuItem deEmbedTexturesItem;
54345982
54355983 private MenuItem particleItem;
54365984 private MenuItem ragdollItem;
....@@ -5481,5 +6029,5 @@
54816029
54826030 Menu cameraMenu;
54836031 MenuItem editCameraItem;
5484
- MenuItem revertCameraItem;
6032
+ MenuItem restoreCameraItem;
54856033 }