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);
....@@ -729,8 +851,11 @@
729851 buttonGroup.add(radioButton);
730852 radioButton.doClick();
731853 }
854
+
732855 void SetupViews(ObjEditor oe)
733856 {
857
+ theFrame = this;
858
+
734859 oe.SetupViews();
735860
736861 System.out.println("SetupViews");
....@@ -754,7 +879,9 @@
754879 JCheckBox speakerCameraCB;
755880 JCheckBox speakerFocusCB;
756881 JCheckBox debugCB;
882
+
757883 JCheckBox oeilCB;
884
+ JCheckBox shadowCB;
758885 JCheckBox lookAtCB;
759886
760887 // static int COLOR = 1;
....@@ -793,6 +920,7 @@
793920 } else if(e.getSource() == liveCB)
794921 {
795922 cameraView.ToggleLive();
923
+ refreshContents(false);
796924 }
797925 else if(e.getSource() == supportCB)
798926 {
....@@ -856,6 +984,10 @@
856984 else if(e.getSource() == oeilCB)
857985 {
858986 cameraView.ToggleOeil();
987
+ }
988
+ else if(e.getSource() == shadowCB)
989
+ {
990
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
859991 }
860992 else if(e.getSource() == lookAtCB)
861993 {
....@@ -1200,7 +1332,7 @@
12001332 memoryItem.addActionListener(this);
12011333 menu.add(analyzeItem = new MenuItem("Analyze"));
12021334 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1335
+ menu.add(dumpItem = new MenuItem("Print"));
12041336 dumpItem.addActionListener(this);
12051337 // menu.add(pathItem = new MenuItem("From-to path"));
12061338 // pathItem.addActionListener(this);
....@@ -1341,6 +1473,7 @@
13411473 shadow.material = new cMaterial(obj.material);
13421474 shadow.material.diffuse = 0.0001f;
13431475 shadow.material.specular = 0.0001f;
1476
+ //shadow.projectedVertices[1].x = 300;
13441477
13451478 makeSomething(shadow);
13461479 }
....@@ -1854,31 +1987,6 @@
18541987 csg.addChild(child);
18551988 child.addChild(csg);
18561989 } else
1857
-
1858
- if (source == importGFDItem)
1859
- {
1860
- ImportGFD();
1861
- } else
1862
- if (source == importVRMLX3DItem)
1863
- {
1864
- ImportVRMLX3D();
1865
- } else
1866
- if (source == import3DSItem)
1867
- {
1868
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1869
- } else
1870
- if (source == importOBJItem)
1871
- {
1872
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
- browser.setVisible(true);
1875
- String filename = browser.getFile();
1876
- if (filename != null && filename.length() > 0)
1877
- {
1878
- String fullname = browser.getDirectory() + filename;
1879
- makeSomething(ReadOBJ(fullname), true);
1880
- }
1881
- } else
18821990 if (source == computeAOItem)
18831991 {
18841992 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1915,6 +2023,30 @@
19152023 if (source == dumpItem)
19162024 {
19172025 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();
19182050 } else
19192051 if (source == oneStepButton)
19202052 {
....@@ -1969,6 +2101,14 @@
19692101 if (source == cutItem || source == clearButton)
19702102 {
19712103 loadClipboard(true);
2104
+ } else
2105
+ if (source == undoItem)
2106
+ {
2107
+ Undo();
2108
+ } else
2109
+ if (source == redoItem)
2110
+ {
2111
+ Redo();
19722112 } else
19732113 if (source == duplicateItem)
19742114 {
....@@ -2469,7 +2609,7 @@
24692609 } else
24702610 if (source == genNormalsMESHItem)
24712611 {
2472
- GenNormals(true); // TODO
2612
+ GenNormalsMESH();
24732613 } else
24742614 if (source == genNormalsORGANItem)
24752615 {
....@@ -2534,6 +2674,22 @@
25342674 if (source == unmarkleavesItem)
25352675 {
25362676 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);
25372693 } else
25382694 if (source == flipVItem)
25392695 {
....@@ -2801,6 +2957,24 @@
28012957 bigThree.ClearUI();
28022958 bigThree.add(centralPanel);
28032959 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
+
28042978 } else
28052979 if (source == threeButton)
28062980 {
....@@ -2837,6 +3011,8 @@
28373011 bigThree.add(centralPanel);
28383012 bigThree.add(XYZPanel);
28393013 bigThree.FlushUI();
3014
+
3015
+ cameraView.requestFocusInWindow();
28403016 } else
28413017 if (source == fourButton)
28423018 {
....@@ -2872,6 +3048,8 @@
28723048 bigThree.ClearUI();
28733049 bigThree.add(scenePanel);
28743050 bigThree.FlushUI();
3051
+
3052
+ cameraView.requestFocusInWindow();
28753053 } else
28763054 if (source == sixButton)
28773055 {
....@@ -2908,6 +3086,8 @@
29083086 bigThree.add(scenePanel);
29093087 bigThree.add(centralPanel);
29103088 bigThree.FlushUI();
3089
+
3090
+ cameraView.requestFocusInWindow();
29113091 } else
29123092 if (source == sevenButton)
29133093 {
....@@ -2945,6 +3125,8 @@
29453125 bigThree.add(centralPanel);
29463126 bigThree.add(XYZPanel);
29473127 bigThree.FlushUI();
3128
+
3129
+ cameraView.requestFocusInWindow();
29483130 } else
29493131 if (source == rootButton)
29503132 {
....@@ -2956,6 +3138,7 @@
29563138 EditObject(obj);
29573139 }
29583140
3141
+ cameraView.requestFocusInWindow();
29593142 refreshContents(true);
29603143 } else
29613144 if (source == closeButton)
....@@ -2965,8 +3148,14 @@
29653148 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663149 {
29673150 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3151
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693152 {
3153
+ // Patch to avoid bug with transparency.
3154
+ if (!ab.hadMaterial)
3155
+ {
3156
+ ab.object.material = null;
3157
+ }
3158
+
29703159 buttonGroup.remove(ab);
29713160 radioPanel.remove(ab);
29723161
....@@ -2977,6 +3166,8 @@
29773166 break;
29783167 }
29793168 }
3169
+
3170
+ cameraView.requestFocusInWindow();
29803171 refreshContents(true);
29813172 } else
29823173 if (source == editItem || source == editButton)
....@@ -2993,7 +3184,7 @@
29933184 child.CloseUI();
29943185 listUI.remove(child);
29953186
2996
- child.editWindow = null; // ???????????
3187
+ //child.editWindow = null; // ???????????
29973188 }
29983189 objEditor.ctrlPanel.FlushUI();
29993190 //objEditor.jTree.clearSelection();
....@@ -3079,7 +3270,10 @@
30793270 frontView.object = group;
30803271 sideView.object = group;
30813272 }
3082
- group.editWindow = this;
3273
+
3274
+// fix "+" issue
3275
+ //group.editWindow = this;
3276
+
30833277 /*
30843278 currentLayout = radio.layout;
30853279 if (currentLayout == null)
....@@ -3091,8 +3285,23 @@
30913285 //group.parent = null; // ROOT
30923286 //group.attributes = -1;
30933287 ResetModel();
3288
+
3289
+ cameraView.requestFocusInWindow();
30943290 refreshContents(true);
3095
- }
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
+ }
30963305 else
30973306 {
30983307 //return super.action(event, arg);
....@@ -3101,7 +3310,6 @@
31013310 }
31023311
31033312 boolean useclient = false;
3104
- cRadio radio;
31053313
31063314 void ToggleRoot()
31073315 {
....@@ -3340,7 +3548,8 @@
33403548
33413549 int size = obj.MemorySize();
33423550
3343
- 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)");
33443553 }
33453554 }
33463555 catch (Exception e)
....@@ -3421,6 +3630,13 @@
34213630 void GenNormals(boolean crease)
34223631 {
34233632 group.GenNormalsS(crease);
3633
+
3634
+ refreshContents();
3635
+ }
3636
+
3637
+ void GenNormalsMESH()
3638
+ {
3639
+ group.GenNormalsMeshS();
34243640
34253641 refreshContents();
34263642 }
....@@ -4048,6 +4264,18 @@
40484264 refreshContents();
40494265 }
40504266
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
+
40514279 void SetTexRes(int tr)
40524280 {
40534281 group.selection.SetTexRes(tr);
....@@ -4133,7 +4361,7 @@
41334361 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41344362
41354363 Object3D elem = (Object3D)group.selection.elementAt(i);
4136
- if(elem != group)
4364
+ if(elem != group || !newWindow)
41374365 {
41384366 // if (!(elem instanceof Composite))
41394367 // newWindow = false;
....@@ -4223,7 +4451,6 @@
42234451 //case 702: // Event.LIST_DESELECT
42244452 group.deselectAll();
42254453 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4226
- objEditor.ClearInfo(); // .GetMaterial());
42274454 if (tps != null)
42284455 {
42294456 for (int i=0; i < tps.length; i++)
....@@ -4232,10 +4459,8 @@
42324459
42334460 //if (child.parent != null)
42344461 //child.parent.addSelectee(child);
4462
+ objEditor.SetMaterial(child);
42354463 group.addSelectee(child);
4236
- objEditor.SetMaterial(child); // .GetMaterial());
4237
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4238
- System.err.println("info : " + child.GetPath());
42394464 }
42404465 }
42414466 // else
....@@ -4245,16 +4470,17 @@
42454470 // System.err.println("info : " + group.GetPath());
42464471 // }
42474472
4248
- objEditor.SetText(); // jan 2014
4249
-
4250
- 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))
42514474 CameraPane.flash = true;
42524475
4253
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4476
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42544477 // a camera
42554478 {
4256
- CameraPane.camerachangeframe = 0; // don't refuse it
4257
- 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
+ }
42584484 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42594485 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42604486 }
....@@ -4267,6 +4493,26 @@
42674493
42684494 freezemodel = false;
42694495 }
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
+ }
42704516
42714517 void linkSomething(Object3D thing)
42724518 {
....@@ -4338,6 +4584,7 @@
43384584 {
43394585 if (group.selection.isEmpty())
43404586 return;
4587
+
43414588 Grafreed.clipboardIsTempGroup = false;
43424589 Composite tGroup = null;
43434590 if (group.selection.size() > 0) // 1)
....@@ -4348,6 +4595,7 @@
43484595
43494596 if (cut)
43504597 {
4598
+ Save();
43514599 //int indices[] = jList.getSelectedIndices();
43524600 //for (int i = indices.length - 1; i >= 0; i--)
43534601 //jList.remove(indices[i]);
....@@ -4437,8 +4685,10 @@
44374685 }
44384686
44394687 }
4688
+
44404689 if (Grafreed.clipboardIsTempGroup)
44414690 Grafreed.clipboard = tGroup;
4691
+
44424692 if (cut)
44434693 {
44444694 ResetModel();
....@@ -4970,21 +5220,6 @@
49705220 }
49715221 */
49725222
4973
- void ImportGFD()
4974
- {
4975
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4976
- browser.show();
4977
- String filename = browser.getFile();
4978
- if (filename != null && filename.length() > 0)
4979
- {
4980
- String fullname = browser.getDirectory() + filename;
4981
-
4982
- //Object3D readobj =
4983
- objEditor.ReadGFD(fullname, objEditor);
4984
- //makeSomething(readobj);
4985
- }
4986
- }
4987
-
49885223 /*
49895224 public void Callback(Object obj)
49905225 {
....@@ -5008,23 +5243,6 @@
50085243 }
50095244 */
50105245
5011
- void ImportVRMLX3D()
5012
- {
5013
- if (Grafreed.standAlone)
5014
- {
5015
- /**/
5016
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5017
- browser.show();
5018
- String filename = browser.getFile();
5019
- if (filename != null && filename.length() > 0)
5020
- {
5021
- String fullname = browser.getDirectory() + filename;
5022
- LoadVRMLX3D(fullname);
5023
- }
5024
- /**/
5025
- }
5026
- }
5027
-
50285246 String GetFile(String dialogName)
50295247 {
50305248 if (Grafreed.standAlone)
....@@ -5095,6 +5313,12 @@
50955313 cButton clearpanelButton;
50965314 cButton unselectButton;
50975315
5316
+ cButton minButton;
5317
+ cButton maxButton;
5318
+ cButton fullButton;
5319
+ cButton undoButton;
5320
+ cButton redoButton;
5321
+ cButton saveButton;
50985322 cButton oneStepButton;
50995323
51005324 cButton screenfitButton;
....@@ -5108,14 +5332,6 @@
51085332
51095333 cButton setsupportButton;
51105334
5111
- cButton twoButton;
5112
- cButton sixButton;
5113
- cButton threeButton;
5114
- cButton sevenButton;
5115
- cButton fourButton; // full panel
5116
- cButton oneButton; // full XYZ
5117
- //cButton currentLayout;
5118
-
51195335 //
51205336 //Composite
51215337 Object3D // to do !!
....@@ -5127,6 +5343,8 @@
51275343 private MenuItem lookFromItem;
51285344 private MenuItem switchItem;
51295345 private MenuItem cutItem;
5346
+ private MenuItem undoItem;
5347
+ private MenuItem redoItem;
51305348 private MenuItem duplicateItem;
51315349 private MenuItem cloneItem;
51325350 private MenuItem cloneSupportItem;
....@@ -5190,6 +5408,10 @@
51905408 private MenuItem showleavesItem;
51915409 private MenuItem markleavesItem;
51925410 private MenuItem unmarkleavesItem;
5411
+ private MenuItem rewindleavesItem;
5412
+ private MenuItem unrewindleavesItem;
5413
+ private MenuItem randomleavesItem;
5414
+ private MenuItem unrandomleavesItem;
51935415
51945416 private MenuItem flipVItem;
51955417 private MenuItem unflipVItem;
....@@ -5273,11 +5495,6 @@
52735495 private MenuItem doubleItem;
52745496 private MenuItem tripleItem;
52755497
5276
- private MenuItem importGFDItem;
5277
- private MenuItem importVRMLX3DItem;
5278
- private MenuItem import3DSItem;
5279
- private MenuItem importOBJItem;
5280
-
52815498 private MenuItem computeAOItem;
52825499 private MenuItem recompileItem;
52835500 private MenuItem editScriptItem;
....@@ -5287,4 +5504,8 @@
52875504 private MenuItem analyzeItem;
52885505 private MenuItem dumpItem;
52895506 //boolean freezemodel = false;
5507
+
5508
+ Menu cameraMenu;
5509
+ MenuItem editCameraItem;
5510
+ MenuItem revertCameraItem;
52905511 }