Normand Briere
2019-06-24 914255f70cf047897212839cbf3a6722703f4457
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,14 +196,97 @@
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 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217290 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218291 revertMeshItem.addActionListener(this);
219292 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -295,11 +368,11 @@
295368 billboardItem.addActionListener(this);
296369 csgItem = menu.add(new MenuItem("CSG"));
297370 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299372 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301374 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303376 shadowZItem.addActionListener(this);
304377 if (Globals.ADVANCED)
305378 {
....@@ -372,6 +445,10 @@
372445 oe.menuBar.add(menu = new Menu("Attributes"));
373446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
374447 clearMaterialsItem.addActionListener(this);
448
+ resetAllItem = menu.add(new MenuItem("Reset All"));
449
+ resetAllItem.addActionListener(this);
450
+ stepAllItem = menu.add(new MenuItem("Step All"));
451
+ stepAllItem.addActionListener(this);
375452 menu.add("-");
376453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
377454 liveleavesItem.addActionListener(this);
....@@ -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,23 +576,47 @@
492576 */
493577 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494578
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496
- liveCB.setToolTipText("Enabled animation");
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 = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
603
+ oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604
+ liveCB.setToolTipText("Enable animation");
497605 liveCB.addItemListener(this);
498606
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500
- oneStepButton.setToolTipText("Animate one step forward");
501
- oneStepButton.addActionListener(this);
502
-
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
607
+ oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
504608 fastCB.setToolTipText("Fast mode");
505609 fastCB.addItemListener(this);
506610
507
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
611
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
+ oneStepButton.setToolTipText("Animate one step forward");
613
+ oneStepButton.addActionListener(this);
614
+
615
+ oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
508616 trackCB.setToolTipText("Enable tracking");
509617 trackCB.addItemListener(this);
510618
511
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512620 screenfitButton.setToolTipText("Screen fit");
513621 screenfitButton.addActionListener(this);
514622
....@@ -522,25 +630,25 @@
522630 snapobjectButton.setToolTipText("Snap Object");
523631 }
524632
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
633
+ oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ flashSelectionButton.setToolTipText("Highlight selection");
527635 flashSelectionButton.addActionListener(this);
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,23 @@
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
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
+ autosaveCB.setToolTipText("Auto-save on structure change");
820
+ autosaveCB.addItemListener(this);
821
+
822
+ if (Globals.ADVANCED)
823
+ {
707824 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
708825 lookAtCB.setToolTipText("Look-at target");
709826 lookAtCB.addItemListener(this);
827
+ }
710828
711829 }
712830
....@@ -721,6 +839,14 @@
721839 void EditObject(Object3D obj)
722840 {
723841 cRadio radioButton = new cRadio(obj.name);
842
+
843
+ // Patch to avoid bug with transparency.
844
+ radioButton.hadMaterial = obj.material != null;
845
+ if (!radioButton.hadMaterial)
846
+ {
847
+ obj.material = new cMaterial();
848
+ }
849
+
724850 radioButton.SetObject(obj);
725851 radioButton.layout = sevenButton;
726852 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -729,8 +855,11 @@
729855 buttonGroup.add(radioButton);
730856 radioButton.doClick();
731857 }
858
+
732859 void SetupViews(ObjEditor oe)
733860 {
861
+ theFrame = this;
862
+
734863 oe.SetupViews();
735864
736865 System.out.println("SetupViews");
....@@ -739,23 +868,26 @@
739868 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
740869 }
741870
742
- JCheckBox liveCB;
743
- JCheckBox supportCB;
744
- JCheckBox localCB;
745
- JCheckBox crowdCB;
746
- JCheckBox smoothCB;
747
- JCheckBox fastCB;
748
- JCheckBox slowCB;
749
- JCheckBox boxCB;
750
- JCheckBox zoomBoxCB;
751
- JCheckBox trackCB;
752
- JCheckBox smoothfocusCB;
871
+ cCheckBox liveCB;
872
+ cCheckBox supportCB;
873
+ cCheckBox localCB;
874
+ cCheckBox crowdCB;
875
+ cCheckBox smoothCB;
876
+ cCheckBox fastCB;
877
+ cCheckBox slowCB;
878
+ cCheckBox boxCB;
879
+ cCheckBox zoomBoxCB;
880
+ cCheckBox trackCB;
881
+ cCheckBox smoothfocusCB;
753882 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
883
+ cCheckBox speakerCameraCB;
884
+ cCheckBox speakerFocusCB;
885
+ cCheckBox debugCB;
886
+
887
+ cCheckBox oeilCB;
888
+ cCheckBox shadowCB;
889
+ cCheckBox autosaveCB;
890
+ cCheckBox lookAtCB;
759891
760892 // static int COLOR = 1;
761893 // static int MATERIAL = 2;
....@@ -763,9 +895,9 @@
763895
764896 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
765897
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
898
+ cCheckBox colorCB;
899
+ cCheckBox materialCB;
900
+ cCheckBox textureCB;
769901
770902 public void itemStateChanged(ItemEvent e)
771903 {
....@@ -793,6 +925,7 @@
793925 } else if(e.getSource() == liveCB)
794926 {
795927 cameraView.ToggleLive();
928
+ refreshContents(false);
796929 }
797930 else if(e.getSource() == supportCB)
798931 {
....@@ -856,6 +989,14 @@
856989 else if(e.getSource() == oeilCB)
857990 {
858991 cameraView.ToggleOeil();
992
+ }
993
+ else if(e.getSource() == shadowCB)
994
+ {
995
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
996
+ }
997
+ else if(e.getSource() == autosaveCB)
998
+ {
999
+ Globals.SAVEONMAKE ^= true;
8591000 }
8601001 else if(e.getSource() == lookAtCB)
8611002 {
....@@ -1200,7 +1341,7 @@
12001341 memoryItem.addActionListener(this);
12011342 menu.add(analyzeItem = new MenuItem("Analyze"));
12021343 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1344
+ menu.add(dumpItem = new MenuItem("Print"));
12041345 dumpItem.addActionListener(this);
12051346 // menu.add(pathItem = new MenuItem("From-to path"));
12061347 // pathItem.addActionListener(this);
....@@ -1341,6 +1482,7 @@
13411482 shadow.material = new cMaterial(obj.material);
13421483 shadow.material.diffuse = 0.0001f;
13431484 shadow.material.specular = 0.0001f;
1485
+ //shadow.projectedVertices[1].x = 300;
13441486
13451487 makeSomething(shadow);
13461488 }
....@@ -1854,31 +1996,6 @@
18541996 csg.addChild(child);
18551997 child.addChild(csg);
18561998 } 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
18821999 if (source == computeAOItem)
18832000 {
18842001 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1915,6 +2032,30 @@
19152032 if (source == dumpItem)
19162033 {
19172034 DumpObject();
2035
+ } else
2036
+ if (source == minButton)
2037
+ {
2038
+ Minimize();
2039
+ } else
2040
+ if (source == maxButton)
2041
+ {
2042
+ Maximize();
2043
+ } else
2044
+ if (source == fullButton)
2045
+ {
2046
+ ToggleFullScreen();
2047
+ } else
2048
+ if (source == undoButton)
2049
+ {
2050
+ Undo();
2051
+ } else
2052
+ if (source == redoButton)
2053
+ {
2054
+ Redo();
2055
+ } else
2056
+ if (source == saveButton)
2057
+ {
2058
+ Save();
19182059 } else
19192060 if (source == oneStepButton)
19202061 {
....@@ -1969,6 +2110,14 @@
19692110 if (source == cutItem || source == clearButton)
19702111 {
19712112 loadClipboard(true);
2113
+ } else
2114
+ if (source == undoItem)
2115
+ {
2116
+ Undo();
2117
+ } else
2118
+ if (source == redoItem)
2119
+ {
2120
+ Redo();
19722121 } else
19732122 if (source == duplicateItem)
19742123 {
....@@ -2281,7 +2430,7 @@
22812430 {
22822431 RevertMeshes();
22832432 } else
2284
- if (source == resetMeshItem)
2433
+ if (source == resetAllItem)
22852434 {
22862435 ResetAll();
22872436 } else
....@@ -2469,7 +2618,7 @@
24692618 } else
24702619 if (source == genNormalsMESHItem)
24712620 {
2472
- GenNormals(true); // TODO
2621
+ GenNormalsMESH();
24732622 } else
24742623 if (source == genNormalsORGANItem)
24752624 {
....@@ -2534,6 +2683,22 @@
25342683 if (source == unmarkleavesItem)
25352684 {
25362685 MarkLeaves(false);
2686
+ } else
2687
+ if (source == rewindleavesItem)
2688
+ {
2689
+ RewindLeaves(true);
2690
+ } else
2691
+ if (source == unrewindleavesItem)
2692
+ {
2693
+ RewindLeaves(false);
2694
+ } else
2695
+ if (source == randomleavesItem)
2696
+ {
2697
+ RandomLeaves(true);
2698
+ } else
2699
+ if (source == unrandomleavesItem)
2700
+ {
2701
+ RandomLeaves(false);
25372702 } else
25382703 if (source == flipVItem)
25392704 {
....@@ -2801,6 +2966,24 @@
28012966 bigThree.ClearUI();
28022967 bigThree.add(centralPanel);
28032968 bigThree.FlushUI();
2969
+
2970
+ cameraView.requestFocusInWindow();
2971
+
2972
+// refreshContents(true);
2973
+//
2974
+// try
2975
+// {
2976
+// java.awt.Robot bot = new java.awt.Robot();
2977
+// int mask = InputEvent.BUTTON1_MASK;
2978
+// bot.mouseMove(100, 100);
2979
+// bot.mousePress(mask);
2980
+// bot.mouseRelease(mask);
2981
+// }
2982
+// catch (Exception e)
2983
+// {
2984
+//
2985
+// }
2986
+
28042987 } else
28052988 if (source == threeButton)
28062989 {
....@@ -2837,6 +3020,8 @@
28373020 bigThree.add(centralPanel);
28383021 bigThree.add(XYZPanel);
28393022 bigThree.FlushUI();
3023
+
3024
+ cameraView.requestFocusInWindow();
28403025 } else
28413026 if (source == fourButton)
28423027 {
....@@ -2872,6 +3057,8 @@
28723057 bigThree.ClearUI();
28733058 bigThree.add(scenePanel);
28743059 bigThree.FlushUI();
3060
+
3061
+ cameraView.requestFocusInWindow();
28753062 } else
28763063 if (source == sixButton)
28773064 {
....@@ -2908,6 +3095,8 @@
29083095 bigThree.add(scenePanel);
29093096 bigThree.add(centralPanel);
29103097 bigThree.FlushUI();
3098
+
3099
+ cameraView.requestFocusInWindow();
29113100 } else
29123101 if (source == sevenButton)
29133102 {
....@@ -2945,6 +3134,8 @@
29453134 bigThree.add(centralPanel);
29463135 bigThree.add(XYZPanel);
29473136 bigThree.FlushUI();
3137
+
3138
+ cameraView.requestFocusInWindow();
29483139 } else
29493140 if (source == rootButton)
29503141 {
....@@ -2956,6 +3147,7 @@
29563147 EditObject(obj);
29573148 }
29583149
3150
+ cameraView.requestFocusInWindow();
29593151 refreshContents(true);
29603152 } else
29613153 if (source == closeButton)
....@@ -2965,18 +3157,27 @@
29653157 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663158 {
29673159 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3160
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693161 {
3162
+ // Patch to avoid bug with transparency.
3163
+ if (!ab.hadMaterial)
3164
+ {
3165
+ ab.object.material = null;
3166
+ }
3167
+
29703168 buttonGroup.remove(ab);
29713169 radioPanel.remove(ab);
29723170
2973
- ab.GetObject().editWindow = null;
3171
+ //ab.GetObject().editWindow = null;
3172
+ ab.GetObject().manipWindow = null;
29743173 // ab.GetObject().objectUI = null; // ?????????
29753174
29763175 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773176 break;
29783177 }
29793178 }
3179
+
3180
+ cameraView.requestFocusInWindow();
29803181 refreshContents(true);
29813182 } else
29823183 if (source == editItem || source == editButton)
....@@ -2993,7 +3194,7 @@
29933194 child.CloseUI();
29943195 listUI.remove(child);
29953196
2996
- child.editWindow = null; // ???????????
3197
+ //child.editWindow = null; // ???????????
29973198 }
29983199 objEditor.ctrlPanel.FlushUI();
29993200 //objEditor.jTree.clearSelection();
....@@ -3079,7 +3280,11 @@
30793280 frontView.object = group;
30803281 sideView.object = group;
30813282 }
3082
- group.editWindow = this;
3283
+
3284
+// fix "+" issue
3285
+ //group.editWindow = this;
3286
+ group.manipWindow = this;
3287
+
30833288 /*
30843289 currentLayout = radio.layout;
30853290 if (currentLayout == null)
....@@ -3091,8 +3296,23 @@
30913296 //group.parent = null; // ROOT
30923297 //group.attributes = -1;
30933298 ResetModel();
3299
+
3300
+ cameraView.requestFocusInWindow();
30943301 refreshContents(true);
3095
- }
3302
+ } else if (event.getSource() == editCameraItem)
3303
+ {
3304
+ cameraView.ProtectCamera();
3305
+ cameraView.repaint();
3306
+ return;
3307
+ } else if (event.getSource() == revertCameraItem)
3308
+ {
3309
+ cameraView.RevertCamera();
3310
+ cameraView.repaint();
3311
+ return;
3312
+ // } else if (event.getSource() == textureButton)
3313
+ // {
3314
+ // return; // true;
3315
+ }
30963316 else
30973317 {
30983318 //return super.action(event, arg);
....@@ -3101,7 +3321,6 @@
31013321 }
31023322
31033323 boolean useclient = false;
3104
- cRadio radio;
31053324
31063325 void ToggleRoot()
31073326 {
....@@ -3340,7 +3559,8 @@
33403559
33413560 int size = obj.MemorySize();
33423561
3343
- System.err.println((size/1024) + " KB is the size of " + obj);
3562
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3563
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33443564 }
33453565 }
33463566 catch (Exception e)
....@@ -3421,6 +3641,13 @@
34213641 void GenNormals(boolean crease)
34223642 {
34233643 group.GenNormalsS(crease);
3644
+
3645
+ refreshContents();
3646
+ }
3647
+
3648
+ void GenNormalsMESH()
3649
+ {
3650
+ group.GenNormalsMeshS();
34243651
34253652 refreshContents();
34263653 }
....@@ -3652,7 +3879,16 @@
36523879 String pigment = Object3D.GetPigment(tex);
36533880 //String bump = Object3D.GetBump(tex);
36543881
3655
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3882
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3883
+
3884
+ try
3885
+ {
3886
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3887
+ }
3888
+ catch (Exception e)
3889
+ {
3890
+ System.err.println("FAIL: " + node);
3891
+ }
36563892
36573893 double s = v.s;
36583894
....@@ -4039,6 +4275,18 @@
40394275 refreshContents();
40404276 }
40414277
4278
+ void RewindLeaves(boolean hide)
4279
+ {
4280
+ group.selection.RewindLeaves(hide);
4281
+ refreshContents();
4282
+ }
4283
+
4284
+ void RandomLeaves(boolean hide)
4285
+ {
4286
+ group.selection.RandomLeaves(hide);
4287
+ refreshContents();
4288
+ }
4289
+
40424290 void SetTexRes(int tr)
40434291 {
40444292 group.selection.SetTexRes(tr);
....@@ -4124,7 +4372,7 @@
41244372 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41254373
41264374 Object3D elem = (Object3D)group.selection.elementAt(i);
4127
- if(elem != group)
4375
+ if(elem != group || !newWindow)
41284376 {
41294377 // if (!(elem instanceof Composite))
41304378 // newWindow = false;
....@@ -4214,7 +4462,6 @@
42144462 //case 702: // Event.LIST_DESELECT
42154463 group.deselectAll();
42164464 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4217
- objEditor.ClearInfo(); // .GetMaterial());
42184465 if (tps != null)
42194466 {
42204467 for (int i=0; i < tps.length; i++)
....@@ -4223,10 +4470,8 @@
42234470
42244471 //if (child.parent != null)
42254472 //child.parent.addSelectee(child);
4473
+ objEditor.SetMaterial(child);
42264474 group.addSelectee(child);
4227
- objEditor.SetMaterial(child); // .GetMaterial());
4228
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4229
- System.err.println("info : " + child.GetPath());
42304475 }
42314476 }
42324477 // else
....@@ -4236,16 +4481,17 @@
42364481 // System.err.println("info : " + group.GetPath());
42374482 // }
42384483
4239
- objEditor.SetText(); // jan 2014
4240
-
4241
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4484
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42424485 CameraPane.flash = true;
42434486
4244
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4487
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42454488 // a camera
42464489 {
4247
- CameraPane.camerachangeframe = 0; // don't refuse it
4248
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4490
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4491
+ {
4492
+ CameraPane.camerachangeframe = 0; // don't refuse it
4493
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4494
+ }
42494495 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42504496 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42514497 }
....@@ -4258,6 +4504,26 @@
42584504
42594505 freezemodel = false;
42604506 }
4507
+
4508
+ void refreshContents(boolean cp)
4509
+ {
4510
+ if (!Globals.MOUSEDRAGGED)
4511
+ {
4512
+ objEditor.ClearInfo(); // .GetMaterial());
4513
+
4514
+ for (int i=0; i < group.selection.Size(); i++)
4515
+ {
4516
+ Object3D child = (Object3D) group.selection.get(i);
4517
+
4518
+ objEditor.AddInfo(child, this, true);
4519
+ System.err.println("info : " + child.GetPath());
4520
+ }
4521
+
4522
+ objEditor.SetText(); // jan 2014
4523
+ }
4524
+
4525
+ super.refreshContents(cp);
4526
+ }
42614527
42624528 void linkSomething(Object3D thing)
42634529 {
....@@ -4329,6 +4595,7 @@
43294595 {
43304596 if (group.selection.isEmpty())
43314597 return;
4598
+
43324599 Grafreed.clipboardIsTempGroup = false;
43334600 Composite tGroup = null;
43344601 if (group.selection.size() > 0) // 1)
....@@ -4339,6 +4606,8 @@
43394606
43404607 if (cut)
43414608 {
4609
+ if (Globals.SAVEONMAKE)
4610
+ Save();
43424611 //int indices[] = jList.getSelectedIndices();
43434612 //for (int i = indices.length - 1; i >= 0; i--)
43444613 //jList.remove(indices[i]);
....@@ -4428,8 +4697,10 @@
44284697 }
44294698
44304699 }
4700
+
44314701 if (Grafreed.clipboardIsTempGroup)
44324702 Grafreed.clipboard = tGroup;
4703
+
44334704 if (cut)
44344705 {
44354706 ResetModel();
....@@ -4961,21 +5232,6 @@
49615232 }
49625233 */
49635234
4964
- void ImportGFD()
4965
- {
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
-
4973
- //Object3D readobj =
4974
- objEditor.ReadGFD(fullname, objEditor);
4975
- //makeSomething(readobj);
4976
- }
4977
- }
4978
-
49795235 /*
49805236 public void Callback(Object obj)
49815237 {
....@@ -4999,23 +5255,6 @@
49995255 }
50005256 */
50015257
5002
- void ImportVRMLX3D()
5003
- {
5004
- if (Grafreed.standAlone)
5005
- {
5006
- /**/
5007
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5008
- browser.show();
5009
- String filename = browser.getFile();
5010
- if (filename != null && filename.length() > 0)
5011
- {
5012
- String fullname = browser.getDirectory() + filename;
5013
- LoadVRMLX3D(fullname);
5014
- }
5015
- /**/
5016
- }
5017
- }
5018
-
50195258 String GetFile(String dialogName)
50205259 {
50215260 if (Grafreed.standAlone)
....@@ -5086,6 +5325,12 @@
50865325 cButton clearpanelButton;
50875326 cButton unselectButton;
50885327
5328
+ cButton minButton;
5329
+ cButton maxButton;
5330
+ cButton fullButton;
5331
+ cButton undoButton;
5332
+ cButton redoButton;
5333
+ cButton saveButton;
50895334 cButton oneStepButton;
50905335
50915336 cButton screenfitButton;
....@@ -5099,14 +5344,6 @@
50995344
51005345 cButton setsupportButton;
51015346
5102
- cButton twoButton;
5103
- cButton sixButton;
5104
- cButton threeButton;
5105
- cButton sevenButton;
5106
- cButton fourButton; // full panel
5107
- cButton oneButton; // full XYZ
5108
- //cButton currentLayout;
5109
-
51105347 //
51115348 //Composite
51125349 Object3D // to do !!
....@@ -5118,6 +5355,8 @@
51185355 private MenuItem lookFromItem;
51195356 private MenuItem switchItem;
51205357 private MenuItem cutItem;
5358
+ private MenuItem undoItem;
5359
+ private MenuItem redoItem;
51215360 private MenuItem duplicateItem;
51225361 private MenuItem cloneItem;
51235362 private MenuItem cloneSupportItem;
....@@ -5131,7 +5370,7 @@
51315370 private MenuItem linkverticesItem;
51325371 private MenuItem relinkverticesItem;
51335372 private MenuItem setMasterItem;
5134
- private MenuItem resetMeshItem;
5373
+ private MenuItem resetAllItem;
51355374 private MenuItem stepAllItem;
51365375 private MenuItem revertMeshItem;
51375376 private MenuItem poseMeshItem;
....@@ -5181,6 +5420,10 @@
51815420 private MenuItem showleavesItem;
51825421 private MenuItem markleavesItem;
51835422 private MenuItem unmarkleavesItem;
5423
+ private MenuItem rewindleavesItem;
5424
+ private MenuItem unrewindleavesItem;
5425
+ private MenuItem randomleavesItem;
5426
+ private MenuItem unrandomleavesItem;
51845427
51855428 private MenuItem flipVItem;
51865429 private MenuItem unflipVItem;
....@@ -5264,11 +5507,6 @@
52645507 private MenuItem doubleItem;
52655508 private MenuItem tripleItem;
52665509
5267
- private MenuItem importGFDItem;
5268
- private MenuItem importVRMLX3DItem;
5269
- private MenuItem import3DSItem;
5270
- private MenuItem importOBJItem;
5271
-
52725510 private MenuItem computeAOItem;
52735511 private MenuItem recompileItem;
52745512 private MenuItem editScriptItem;
....@@ -5278,4 +5516,8 @@
52785516 private MenuItem analyzeItem;
52795517 private MenuItem dumpItem;
52805518 //boolean freezemodel = false;
5519
+
5520
+ Menu cameraMenu;
5521
+ MenuItem editCameraItem;
5522
+ MenuItem revertCameraItem;
52815523 }