Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -148,27 +148,18 @@
148148
149149 //JTextField nameField;
150150
151
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
152152 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
168153 Menu menu;
169154 oe.menuBar.add(menu = new Menu("Edit"));
170155 //editItem = menu.add(new MenuItem("Edit"));
171156 //editItem.addActionListener(this);
157
+
158
+// undoItem = menu.add(new MenuItem("Undo"));
159
+// undoItem.addActionListener(this);
160
+// redoItem = menu.add(new MenuItem("Redo"));
161
+// redoItem.addActionListener(this);
162
+// menu.add("-");
172163 duplicateItem = menu.add(new MenuItem("Duplicate"));
173164 duplicateItem.addActionListener(this);
174165 cloneItem = menu.add(new MenuItem("Clone"));
....@@ -185,7 +176,6 @@
185176 copyItem.addActionListener(this);
186177 pasteItem = menu.add(new MenuItem("Paste"));
187178 pasteItem.addActionListener(this);
188
- menu.add("-");
189179
190180 menu.add("-");
191181 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -206,7 +196,94 @@
206196 clearAllItem = menu.add(new MenuItem("Clear All"));
207197 clearAllItem.addActionListener(this);
208198 }
199
+
200
+ menuBar.add(cameraMenu = new Menu("View"));
201
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
202
+ //zBufferItem.addActionListener(this);
203
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204
+ //normalLensItem.addActionListener(this);
205
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
+ revertCameraItem.addActionListener(this);
207
+
208
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
+ toggleFullScreenItem.addItemListener(this);
210
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
+ cameraMenu.add("-");
212
+
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"));
222
+ toggleHandleItem.addItemListener(this);
223
+ toggleHandleItem.setState(CameraPane.HANDLES);
224
+
225
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
226
+ togglePaintItem.addItemListener(this);
227
+ togglePaintItem.setState(CameraPane.PAINTMODE);
228
+
229
+ if (Globals.ADVANCED)
230
+ {
231
+ cameraMenu.add("-");
232
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
233
+ toggleLiveItem.addItemListener(this);
234
+ toggleLiveItem.setState(Globals.isLIVE());
209235
236
+ cameraMenu.add(stepItem = new MenuItem("Step"));
237
+ stepItem.addActionListener(this);
238
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
239
+ // toggleDLItem.addItemListener(this);
240
+ // toggleDLItem.setState(false);
241
+
242
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
243
+ toggleRenderItem.addItemListener(this);
244
+ toggleRenderItem.setState(!CameraPane.frozen);
245
+
246
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247
+ toggleDebugItem.addItemListener(this);
248
+ toggleDebugItem.setState(Globals.DEBUG);
249
+
250
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251
+ toggleFrustumItem.addItemListener(this);
252
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
253
+
254
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
255
+ toggleFootContactItem.addItemListener(this);
256
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
257
+
258
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
259
+ toggleTimelineItem.addItemListener(this);
260
+ }
261
+
262
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
263
+// toggleRootItem.addItemListener(this);
264
+// toggleRootItem.setState(false);
265
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
266
+// animationItem.addItemListener(this);
267
+// animationItem.setState(CameraPane.ANIMATION);
268
+ cameraMenu.add("-");
269
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270
+ editCameraItem.addActionListener(this);
271
+
272
+ if (Globals.ADVANCED)
273
+ {
274
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
+ //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
277
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278
+ oe.cameraMenu.add("-");
279
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
280
+ openWindowItem.addActionListener(this);
281
+ editLeafItem.addActionListener(this);
282
+ lookAtItem.addActionListener(this);
283
+ //lookFromItem.addActinoListener(this);
284
+ //switchItem.addActionListener(this);
285
+ }
286
+
210287 oe.menuBar.add(menu = new Menu("Setting"));
211288 if (Globals.ADVANCED)
212289 {
....@@ -291,11 +368,11 @@
291368 billboardItem.addActionListener(this);
292369 csgItem = menu.add(new MenuItem("CSG"));
293370 csgItem.addActionListener(this);
294
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
295372 shadowXItem.addActionListener(this);
296
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
297374 shadowYItem.addActionListener(this);
298
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
299376 shadowZItem.addActionListener(this);
300377 if (Globals.ADVANCED)
301378 {
....@@ -392,6 +469,14 @@
392469 markleavesItem.addActionListener(this);
393470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394471 unmarkleavesItem.addActionListener(this);
472
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
473
+ rewindleavesItem.addActionListener(this);
474
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
475
+ unrewindleavesItem.addActionListener(this);
476
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
477
+ randomleavesItem.addActionListener(this);
478
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
479
+ unrandomleavesItem.addActionListener(this);
395480 menu.add("-");
396481 flipVItem = menu.add(new MenuItem("Flip V"));
397482 flipVItem.addActionListener(this);
....@@ -443,25 +528,24 @@
443528 oe.menuBar.add(menu = new Menu("Insert"));
444529 buildCreateMenu(menu);
445530
446
- oe.menuBar.add(menu = new Menu("Include"));
447
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
448
- importOBJItem.addActionListener(this);
449
- menu.add("-");
450
- import3DSItem = menu.add(new MenuItem("3DS file..."));
451
- import3DSItem.addActionListener(this);
452
- menu.add("-");
453
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
- importVRMLX3DItem.addActionListener(this);
455
- menu.add("-");
456
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
- importGFDItem.addActionListener(this);
458
-
459531 oe.menuBar.add(menu = new Menu("Tools"));
460532 buildToolsMenu(menu);
461533 }
462534
463535 void SetupUI2(ObjEditor oe)
464536 {
537
+ // June 2019
538
+ if (oe == null)
539
+ {
540
+ //super.SetupUI2(this);
541
+ //return;
542
+ }
543
+
544
+ if (copy != group)
545
+ {
546
+ //super.SetupUI2(this);
547
+ }
548
+
465549 //new Exception().printStackTrace();
466550
467551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -492,11 +576,35 @@
492576 */
493577 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494578
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
582
+
583
+ oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
495603 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496604 liveCB.setToolTipText("Enable animation");
497605 liveCB.addItemListener(this);
498606
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500608 oneStepButton.setToolTipText("Animate one step forward");
501609 oneStepButton.addActionListener(this);
502610
....@@ -504,7 +612,7 @@
504612 fastCB.setToolTipText("Fast mode");
505613 fastCB.addItemListener(this);
506614
507
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
615
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
508616 trackCB.setToolTipText("Enable tracking");
509617 trackCB.addItemListener(this);
510618
....@@ -528,19 +636,19 @@
528636
529637 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530638
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532640 twoButton.setToolTipText("Show center view only");
533641 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535643 fourButton.addActionListener(this);
536644 fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538646 sixButton.setToolTipText("2-column layout left");
539647 sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541649 threeButton.setToolTipText("2-column layout right");
542650 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544652 sevenButton.setToolTipText("3-column layout");
545653 sevenButton.addActionListener(this);
546654 //
....@@ -555,32 +663,30 @@
555663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556664 //clearButton.addActionListener(this);
557665
558
- cGridBag commandsPanel = new cGridBag();
559
-
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561667 editButton.setToolTipText("Edit selection");
562668 editButton.addActionListener(this);
563669
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565671 uneditButton.setToolTipText("Unedit selection");
566672 uneditButton.addActionListener(this);
567673
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569675 allParamsButton.setToolTipText("Edit all params");
570676 allParamsButton.addActionListener(this);
571677
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573679 clearPanelButton.setToolTipText("Clear edit panel");
574680 clearPanelButton.addActionListener(this);
575681
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577683 unselectButton.setToolTipText("Unselect");
578684 unselectButton.addActionListener(this);
579685
580
- commandsPanel.preferredHeight = 1;
686
+ editCommandsPanel.preferredHeight = 1;
581687
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
584690
585691 // oe.aConstraints.gridx += 1;
586692 // oe.aConstraints.weighty = 0;
....@@ -702,11 +808,19 @@
702808 // debugCB.addItemListener(this);
703809
704810 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.setToolTipText("Move camera when tracking target");
705812 oeilCB.addItemListener(this);
706813
814
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
+ shadowCB.setToolTipText("Compute shadows when live");
816
+ shadowCB.addItemListener(this);
817
+
818
+ if (Globals.ADVANCED)
819
+ {
707820 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708821 lookAtCB.setToolTipText("Look-at target");
709822 lookAtCB.addItemListener(this);
823
+ }
710824
711825 }
712826
....@@ -721,6 +835,14 @@
721835 void EditObject(Object3D obj)
722836 {
723837 cRadio radioButton = new cRadio(obj.name);
838
+
839
+ // Patch to avoid bug with transparency.
840
+ radioButton.hadMaterial = obj.material != null;
841
+ if (!radioButton.hadMaterial)
842
+ {
843
+ obj.material = new cMaterial();
844
+ }
845
+
724846 radioButton.SetObject(obj);
725847 radioButton.layout = sevenButton;
726848 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -732,6 +854,8 @@
732854
733855 void SetupViews(ObjEditor oe)
734856 {
857
+ theFrame = this;
858
+
735859 oe.SetupViews();
736860
737861 System.out.println("SetupViews");
....@@ -755,7 +879,9 @@
755879 JCheckBox speakerCameraCB;
756880 JCheckBox speakerFocusCB;
757881 JCheckBox debugCB;
882
+
758883 JCheckBox oeilCB;
884
+ JCheckBox shadowCB;
759885 JCheckBox lookAtCB;
760886
761887 // static int COLOR = 1;
....@@ -794,6 +920,7 @@
794920 } else if(e.getSource() == liveCB)
795921 {
796922 cameraView.ToggleLive();
923
+ refreshContents(false);
797924 }
798925 else if(e.getSource() == supportCB)
799926 {
....@@ -857,6 +984,10 @@
857984 else if(e.getSource() == oeilCB)
858985 {
859986 cameraView.ToggleOeil();
987
+ }
988
+ else if(e.getSource() == shadowCB)
989
+ {
990
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
860991 }
861992 else if(e.getSource() == lookAtCB)
862993 {
....@@ -1201,7 +1332,7 @@
12011332 memoryItem.addActionListener(this);
12021333 menu.add(analyzeItem = new MenuItem("Analyze"));
12031334 analyzeItem.addActionListener(this);
1204
- menu.add(dumpItem = new MenuItem("Dump"));
1335
+ menu.add(dumpItem = new MenuItem("Print"));
12051336 dumpItem.addActionListener(this);
12061337 // menu.add(pathItem = new MenuItem("From-to path"));
12071338 // pathItem.addActionListener(this);
....@@ -1342,6 +1473,7 @@
13421473 shadow.material = new cMaterial(obj.material);
13431474 shadow.material.diffuse = 0.0001f;
13441475 shadow.material.specular = 0.0001f;
1476
+ //shadow.projectedVertices[1].x = 300;
13451477
13461478 makeSomething(shadow);
13471479 }
....@@ -1855,31 +1987,6 @@
18551987 csg.addChild(child);
18561988 child.addChild(csg);
18571989 } else
1858
-
1859
- if (source == importGFDItem)
1860
- {
1861
- ImportGFD();
1862
- } else
1863
- if (source == importVRMLX3DItem)
1864
- {
1865
- ImportVRMLX3D();
1866
- } else
1867
- if (source == import3DSItem)
1868
- {
1869
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1870
- } else
1871
- if (source == importOBJItem)
1872
- {
1873
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1874
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1875
- browser.setVisible(true);
1876
- String filename = browser.getFile();
1877
- if (filename != null && filename.length() > 0)
1878
- {
1879
- String fullname = browser.getDirectory() + filename;
1880
- makeSomething(ReadOBJ(fullname), true);
1881
- }
1882
- } else
18831990 if (source == computeAOItem)
18841991 {
18851992 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1916,6 +2023,30 @@
19162023 if (source == dumpItem)
19172024 {
19182025 DumpObject();
2026
+ } else
2027
+ if (source == minButton)
2028
+ {
2029
+ Minimize();
2030
+ } else
2031
+ if (source == maxButton)
2032
+ {
2033
+ Maximize();
2034
+ } else
2035
+ if (source == fullButton)
2036
+ {
2037
+ ToggleFullScreen();
2038
+ } else
2039
+ if (source == undoButton)
2040
+ {
2041
+ Undo();
2042
+ } else
2043
+ if (source == redoButton)
2044
+ {
2045
+ Redo();
2046
+ } else
2047
+ if (source == saveButton)
2048
+ {
2049
+ Save();
19192050 } else
19202051 if (source == oneStepButton)
19212052 {
....@@ -1970,6 +2101,14 @@
19702101 if (source == cutItem || source == clearButton)
19712102 {
19722103 loadClipboard(true);
2104
+ } else
2105
+ if (source == undoItem)
2106
+ {
2107
+ Undo();
2108
+ } else
2109
+ if (source == redoItem)
2110
+ {
2111
+ Redo();
19732112 } else
19742113 if (source == duplicateItem)
19752114 {
....@@ -2470,7 +2609,7 @@
24702609 } else
24712610 if (source == genNormalsMESHItem)
24722611 {
2473
- GenNormals(true); // TODO
2612
+ GenNormalsMESH();
24742613 } else
24752614 if (source == genNormalsORGANItem)
24762615 {
....@@ -2535,6 +2674,22 @@
25352674 if (source == unmarkleavesItem)
25362675 {
25372676 MarkLeaves(false);
2677
+ } else
2678
+ if (source == rewindleavesItem)
2679
+ {
2680
+ RewindLeaves(true);
2681
+ } else
2682
+ if (source == unrewindleavesItem)
2683
+ {
2684
+ RewindLeaves(false);
2685
+ } else
2686
+ if (source == randomleavesItem)
2687
+ {
2688
+ RandomLeaves(true);
2689
+ } else
2690
+ if (source == unrandomleavesItem)
2691
+ {
2692
+ RandomLeaves(false);
25382693 } else
25392694 if (source == flipVItem)
25402695 {
....@@ -2802,6 +2957,24 @@
28022957 bigThree.ClearUI();
28032958 bigThree.add(centralPanel);
28042959 bigThree.FlushUI();
2960
+
2961
+ cameraView.requestFocusInWindow();
2962
+
2963
+// refreshContents(true);
2964
+//
2965
+// try
2966
+// {
2967
+// java.awt.Robot bot = new java.awt.Robot();
2968
+// int mask = InputEvent.BUTTON1_MASK;
2969
+// bot.mouseMove(100, 100);
2970
+// bot.mousePress(mask);
2971
+// bot.mouseRelease(mask);
2972
+// }
2973
+// catch (Exception e)
2974
+// {
2975
+//
2976
+// }
2977
+
28052978 } else
28062979 if (source == threeButton)
28072980 {
....@@ -2838,6 +3011,8 @@
28383011 bigThree.add(centralPanel);
28393012 bigThree.add(XYZPanel);
28403013 bigThree.FlushUI();
3014
+
3015
+ cameraView.requestFocusInWindow();
28413016 } else
28423017 if (source == fourButton)
28433018 {
....@@ -2873,6 +3048,8 @@
28733048 bigThree.ClearUI();
28743049 bigThree.add(scenePanel);
28753050 bigThree.FlushUI();
3051
+
3052
+ cameraView.requestFocusInWindow();
28763053 } else
28773054 if (source == sixButton)
28783055 {
....@@ -2909,6 +3086,8 @@
29093086 bigThree.add(scenePanel);
29103087 bigThree.add(centralPanel);
29113088 bigThree.FlushUI();
3089
+
3090
+ cameraView.requestFocusInWindow();
29123091 } else
29133092 if (source == sevenButton)
29143093 {
....@@ -2946,6 +3125,8 @@
29463125 bigThree.add(centralPanel);
29473126 bigThree.add(XYZPanel);
29483127 bigThree.FlushUI();
3128
+
3129
+ cameraView.requestFocusInWindow();
29493130 } else
29503131 if (source == rootButton)
29513132 {
....@@ -2957,6 +3138,7 @@
29573138 EditObject(obj);
29583139 }
29593140
3141
+ cameraView.requestFocusInWindow();
29603142 refreshContents(true);
29613143 } else
29623144 if (source == closeButton)
....@@ -2966,8 +3148,14 @@
29663148 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29673149 {
29683150 ab = (cRadio)e.nextElement();
2969
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3151
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29703152 {
3153
+ // Patch to avoid bug with transparency.
3154
+ if (!ab.hadMaterial)
3155
+ {
3156
+ ab.object.material = null;
3157
+ }
3158
+
29713159 buttonGroup.remove(ab);
29723160 radioPanel.remove(ab);
29733161
....@@ -2978,6 +3166,8 @@
29783166 break;
29793167 }
29803168 }
3169
+
3170
+ cameraView.requestFocusInWindow();
29813171 refreshContents(true);
29823172 } else
29833173 if (source == editItem || source == editButton)
....@@ -2994,7 +3184,7 @@
29943184 child.CloseUI();
29953185 listUI.remove(child);
29963186
2997
- child.editWindow = null; // ???????????
3187
+ //child.editWindow = null; // ???????????
29983188 }
29993189 objEditor.ctrlPanel.FlushUI();
30003190 //objEditor.jTree.clearSelection();
....@@ -3081,7 +3271,8 @@
30813271 sideView.object = group;
30823272 }
30833273
3084
-// fix "+" issue group.editWindow = this;
3274
+// fix "+" issue
3275
+ //group.editWindow = this;
30853276
30863277 /*
30873278 currentLayout = radio.layout;
....@@ -3094,8 +3285,23 @@
30943285 //group.parent = null; // ROOT
30953286 //group.attributes = -1;
30963287 ResetModel();
3288
+
3289
+ cameraView.requestFocusInWindow();
30973290 refreshContents(true);
3098
- }
3291
+ } else if (event.getSource() == editCameraItem)
3292
+ {
3293
+ cameraView.ProtectCamera();
3294
+ cameraView.repaint();
3295
+ return;
3296
+ } else if (event.getSource() == revertCameraItem)
3297
+ {
3298
+ cameraView.RevertCamera();
3299
+ cameraView.repaint();
3300
+ return;
3301
+ // } else if (event.getSource() == textureButton)
3302
+ // {
3303
+ // return; // true;
3304
+ }
30993305 else
31003306 {
31013307 //return super.action(event, arg);
....@@ -3104,7 +3310,6 @@
31043310 }
31053311
31063312 boolean useclient = false;
3107
- cRadio radio;
31083313
31093314 void ToggleRoot()
31103315 {
....@@ -3343,7 +3548,8 @@
33433548
33443549 int size = obj.MemorySize();
33453550
3346
- System.err.println((size/1024) + " KB is the size of " + obj);
3551
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3552
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33473553 }
33483554 }
33493555 catch (Exception e)
....@@ -3424,6 +3630,13 @@
34243630 void GenNormals(boolean crease)
34253631 {
34263632 group.GenNormalsS(crease);
3633
+
3634
+ refreshContents();
3635
+ }
3636
+
3637
+ void GenNormalsMESH()
3638
+ {
3639
+ group.GenNormalsMeshS();
34273640
34283641 refreshContents();
34293642 }
....@@ -4051,6 +4264,18 @@
40514264 refreshContents();
40524265 }
40534266
4267
+ void RewindLeaves(boolean hide)
4268
+ {
4269
+ group.selection.RewindLeaves(hide);
4270
+ refreshContents();
4271
+ }
4272
+
4273
+ void RandomLeaves(boolean hide)
4274
+ {
4275
+ group.selection.RandomLeaves(hide);
4276
+ refreshContents();
4277
+ }
4278
+
40544279 void SetTexRes(int tr)
40554280 {
40564281 group.selection.SetTexRes(tr);
....@@ -4226,7 +4451,6 @@
42264451 //case 702: // Event.LIST_DESELECT
42274452 group.deselectAll();
42284453 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4229
- objEditor.ClearInfo(); // .GetMaterial());
42304454 if (tps != null)
42314455 {
42324456 for (int i=0; i < tps.length; i++)
....@@ -4235,10 +4459,8 @@
42354459
42364460 //if (child.parent != null)
42374461 //child.parent.addSelectee(child);
4462
+ objEditor.SetMaterial(child);
42384463 group.addSelectee(child);
4239
- objEditor.SetMaterial(child); // .GetMaterial());
4240
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4241
- System.err.println("info : " + child.GetPath());
42424464 }
42434465 }
42444466 // else
....@@ -4248,16 +4470,17 @@
42484470 // System.err.println("info : " + group.GetPath());
42494471 // }
42504472
4251
- objEditor.SetText(); // jan 2014
4252
-
4253
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4473
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42544474 CameraPane.flash = true;
42554475
4256
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4476
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42574477 // a camera
42584478 {
4259
- CameraPane.camerachangeframe = 0; // don't refuse it
4260
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4479
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4480
+ {
4481
+ CameraPane.camerachangeframe = 0; // don't refuse it
4482
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4483
+ }
42614484 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42624485 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42634486 }
....@@ -4270,6 +4493,26 @@
42704493
42714494 freezemodel = false;
42724495 }
4496
+
4497
+ void refreshContents(boolean cp)
4498
+ {
4499
+ if (!Globals.MOUSEDRAGGED)
4500
+ {
4501
+ objEditor.ClearInfo(); // .GetMaterial());
4502
+
4503
+ for (int i=0; i < group.selection.Size(); i++)
4504
+ {
4505
+ Object3D child = (Object3D) group.selection.get(i);
4506
+
4507
+ objEditor.AddInfo(child, this, true);
4508
+ System.err.println("info : " + child.GetPath());
4509
+ }
4510
+
4511
+ objEditor.SetText(); // jan 2014
4512
+ }
4513
+
4514
+ super.refreshContents(cp);
4515
+ }
42734516
42744517 void linkSomething(Object3D thing)
42754518 {
....@@ -4341,6 +4584,7 @@
43414584 {
43424585 if (group.selection.isEmpty())
43434586 return;
4587
+
43444588 Grafreed.clipboardIsTempGroup = false;
43454589 Composite tGroup = null;
43464590 if (group.selection.size() > 0) // 1)
....@@ -4351,6 +4595,7 @@
43514595
43524596 if (cut)
43534597 {
4598
+ Save();
43544599 //int indices[] = jList.getSelectedIndices();
43554600 //for (int i = indices.length - 1; i >= 0; i--)
43564601 //jList.remove(indices[i]);
....@@ -4440,8 +4685,10 @@
44404685 }
44414686
44424687 }
4688
+
44434689 if (Grafreed.clipboardIsTempGroup)
44444690 Grafreed.clipboard = tGroup;
4691
+
44454692 if (cut)
44464693 {
44474694 ResetModel();
....@@ -4973,21 +5220,6 @@
49735220 }
49745221 */
49755222
4976
- void ImportGFD()
4977
- {
4978
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4979
- browser.show();
4980
- String filename = browser.getFile();
4981
- if (filename != null && filename.length() > 0)
4982
- {
4983
- String fullname = browser.getDirectory() + filename;
4984
-
4985
- //Object3D readobj =
4986
- objEditor.ReadGFD(fullname, objEditor);
4987
- //makeSomething(readobj);
4988
- }
4989
- }
4990
-
49915223 /*
49925224 public void Callback(Object obj)
49935225 {
....@@ -5011,23 +5243,6 @@
50115243 }
50125244 */
50135245
5014
- void ImportVRMLX3D()
5015
- {
5016
- if (Grafreed.standAlone)
5017
- {
5018
- /**/
5019
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5020
- browser.show();
5021
- String filename = browser.getFile();
5022
- if (filename != null && filename.length() > 0)
5023
- {
5024
- String fullname = browser.getDirectory() + filename;
5025
- LoadVRMLX3D(fullname);
5026
- }
5027
- /**/
5028
- }
5029
- }
5030
-
50315246 String GetFile(String dialogName)
50325247 {
50335248 if (Grafreed.standAlone)
....@@ -5098,6 +5313,12 @@
50985313 cButton clearpanelButton;
50995314 cButton unselectButton;
51005315
5316
+ cButton minButton;
5317
+ cButton maxButton;
5318
+ cButton fullButton;
5319
+ cButton undoButton;
5320
+ cButton redoButton;
5321
+ cButton saveButton;
51015322 cButton oneStepButton;
51025323
51035324 cButton screenfitButton;
....@@ -5111,14 +5332,6 @@
51115332
51125333 cButton setsupportButton;
51135334
5114
- cButton twoButton;
5115
- cButton sixButton;
5116
- cButton threeButton;
5117
- cButton sevenButton;
5118
- cButton fourButton; // full panel
5119
- cButton oneButton; // full XYZ
5120
- //cButton currentLayout;
5121
-
51225335 //
51235336 //Composite
51245337 Object3D // to do !!
....@@ -5130,6 +5343,8 @@
51305343 private MenuItem lookFromItem;
51315344 private MenuItem switchItem;
51325345 private MenuItem cutItem;
5346
+ private MenuItem undoItem;
5347
+ private MenuItem redoItem;
51335348 private MenuItem duplicateItem;
51345349 private MenuItem cloneItem;
51355350 private MenuItem cloneSupportItem;
....@@ -5193,6 +5408,10 @@
51935408 private MenuItem showleavesItem;
51945409 private MenuItem markleavesItem;
51955410 private MenuItem unmarkleavesItem;
5411
+ private MenuItem rewindleavesItem;
5412
+ private MenuItem unrewindleavesItem;
5413
+ private MenuItem randomleavesItem;
5414
+ private MenuItem unrandomleavesItem;
51965415
51975416 private MenuItem flipVItem;
51985417 private MenuItem unflipVItem;
....@@ -5276,11 +5495,6 @@
52765495 private MenuItem doubleItem;
52775496 private MenuItem tripleItem;
52785497
5279
- private MenuItem importGFDItem;
5280
- private MenuItem importVRMLX3DItem;
5281
- private MenuItem import3DSItem;
5282
- private MenuItem importOBJItem;
5283
-
52845498 private MenuItem computeAOItem;
52855499 private MenuItem recompileItem;
52865500 private MenuItem editScriptItem;
....@@ -5290,4 +5504,8 @@
52905504 private MenuItem analyzeItem;
52915505 private MenuItem dumpItem;
52925506 //boolean freezemodel = false;
5507
+
5508
+ Menu cameraMenu;
5509
+ MenuItem editCameraItem;
5510
+ MenuItem revertCameraItem;
52935511 }