Normand Briere
2019-06-09 c5b599b48b333b34e554b464aefbca0b9bc66275
ObjEditor.java
....@@ -276,24 +276,40 @@
276276 void SetupMenu()
277277 {
278278 frame.setMenuBar(menuBar = new MenuBar());
279
- menuBar.add(windowMenu = new Menu("File"));
280
- windowMenu.add(loadItem = new MenuItem("Load..."));
281
- windowMenu.add("-");
282
- windowMenu.add(saveItem = new MenuItem("Save"));
283
- windowMenu.add(saveAsItem = new MenuItem("Save As..."));
279
+ menuBar.add(fileMenu = new Menu("File"));
280
+ fileMenu.add(newItem = new MenuItem("New"));
281
+ fileMenu.add(loadItem = new MenuItem("Load..."));
282
+
283
+ //oe.menuBar.add(menu = new Menu("Include"));
284
+ Menu menu = new Menu("Import");
285
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
286
+ importOBJItem.addActionListener(this);
287
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
288
+ import3DSItem.addActionListener(this);
289
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
290
+ importVRMLX3DItem.addActionListener(this);
291
+ menu.add("-");
292
+ importGFDItem = menu.add(new MenuItem("Grafreed file..."));
293
+ importGFDItem.addActionListener(this);
294
+ fileMenu.add(menu);
295
+ fileMenu.add("-");
296
+
297
+ fileMenu.add(saveItem = new MenuItem("Save"));
298
+ fileMenu.add(saveAsItem = new MenuItem("Save As..."));
284299 //windowMenu.add(povItem = new MenuItem("Emit POV-Ray..."));
285
- windowMenu.add("-");
286
- windowMenu.add(exportAsItem = new MenuItem("Export Selection..."));
287
- windowMenu.add(reexportItem = new MenuItem("Re-export"));
288
- windowMenu.add("-");
300
+ fileMenu.add("-");
301
+ fileMenu.add(exportAsItem = new MenuItem("Export Selection..."));
302
+ fileMenu.add(reexportItem = new MenuItem("Re-export"));
303
+ fileMenu.add("-");
289304 if (client.parent != null)
290305 {
291
- windowMenu.add(closeItem = new MenuItem("Close"));
306
+ fileMenu.add(closeItem = new MenuItem("Close"));
292307 } else
293308 {
294
- windowMenu.add(closeItem = new MenuItem("Exit"));
309
+ fileMenu.add(closeItem = new MenuItem("Exit"));
295310 }
296311
312
+ newItem.addActionListener(this);
297313 loadItem.addActionListener(this);
298314 saveItem.addActionListener(this);
299315 saveAsItem.addActionListener(this);
....@@ -301,77 +317,6 @@
301317 reexportItem.addActionListener(this);
302318 //povItem.addActionListener(this);
303319 closeItem.addActionListener(this);
304
-
305
- menuBar.add(cameraMenu = new Menu("View"));
306
- //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
307
- //zBufferItem.addActionListener(this);
308
- //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
309
- //normalLensItem.addActionListener(this);
310
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
311
- revertCameraItem.addActionListener(this);
312
-
313
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
314
- toggleFullScreenItem.addItemListener(this);
315
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
316
- cameraMenu.add("-");
317
-
318
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
319
- toggleTextureItem.addItemListener(this);
320
- toggleTextureItem.setState(CameraPane.textureon);
321
-
322
- if (Globals.ADVANCED)
323
- {
324
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
325
- toggleLiveItem.addItemListener(this);
326
- toggleLiveItem.setState(Globals.isLIVE());
327
-
328
- cameraMenu.add(stepItem = new MenuItem("Step"));
329
- stepItem.addActionListener(this);
330
- // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
331
- // toggleDLItem.addItemListener(this);
332
- // toggleDLItem.setState(false);
333
-
334
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
335
- toggleRenderItem.addItemListener(this);
336
- toggleRenderItem.setState(!CameraPane.frozen);
337
-
338
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
339
- toggleDebugItem.addItemListener(this);
340
- toggleDebugItem.setState(CameraPane.DEBUG);
341
-
342
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
343
- toggleFrustumItem.addItemListener(this);
344
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
345
-
346
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
347
- toggleFootContactItem.addItemListener(this);
348
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
349
-
350
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
351
- toggleTimelineItem.addItemListener(this);
352
- }
353
-
354
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
355
- toggleSwitchItem.addItemListener(this);
356
- toggleSwitchItem.setState(CameraPane.SWITCH);
357
-
358
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
359
- toggleHandleItem.addItemListener(this);
360
- toggleHandleItem.setState(CameraPane.HANDLES);
361
-
362
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
363
- togglePaintItem.addItemListener(this);
364
- togglePaintItem.setState(CameraPane.PAINTMODE);
365
-
366
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
367
-// toggleRootItem.addItemListener(this);
368
-// toggleRootItem.setState(false);
369
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
370
-// animationItem.addItemListener(this);
371
-// animationItem.setState(CameraPane.ANIMATION);
372
- cameraMenu.add("-");
373
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
374
- editCameraItem.addActionListener(this);
375320
376321 objectPanel = new JTabbedPane();
377322 toolbarPanel = new JPanel();
....@@ -500,13 +445,13 @@
500445 //SendInfo("Name:", "bold");
501446 if (sel.GetTextures() != null || debug)
502447 {
503
- si.SendInfo(sel.toString(), "bold");
448
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
504449 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
505450 if (sel.Size() > 0)
506451 {
507452 si.SendInfo("#children = " + sel.Size(), "regular");
508453 }
509
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
454
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
510455 if (debug)
511456 {
512457 try
....@@ -548,7 +493,7 @@
548493 }
549494 if (sel.support != null)
550495 {
551
- si.SendInfo(" support: " + sel.support, "regular");
496
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
552497 }
553498 if (sel.scriptnode != null)
554499 {
....@@ -751,7 +696,7 @@
751696 protected static ImageIcon createImageIcon(String path,
752697 String description)
753698 {
754
- java.net.URL imgURL = GrafreeD.class.getResource(path);
699
+ java.net.URL imgURL = Grafreed.class.getResource(path);
755700 if (imgURL != null)
756701 {
757702 return new ImageIcon(imgURL, description);
....@@ -783,6 +728,7 @@
783728 // NumberSlider vDivsField;
784729 // JCheckBox endcaps;
785730 JCheckBox liveCB;
731
+ JCheckBox selectCB;
786732 JCheckBox hideCB;
787733 JCheckBox link2masterCB;
788734 JCheckBox markCB;
....@@ -985,9 +931,11 @@
985931
986932 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
987933 liveCB.setToolTipText("Animate object");
934
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
935
+ selectCB.setToolTipText("Make object selectable");
936
+// Return();
988937 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
989938 hideCB.setToolTipText("Hide object");
990
-// Return();
991939 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
992940 markCB.setToolTipText("Set the animation target transform");
993941
....@@ -1027,7 +975,7 @@
1027975 oe.ctrlPanel.add(commandsPanel);
1028976 oe.ctrlPanel.Return();
1029977
1030
- pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1);
978
+ pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons
1031979 normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1032980 //Return();
1033981
....@@ -1329,7 +1277,7 @@
13291277 scrollpane.addMouseWheelListener(this); // Default not fast enough
13301278
13311279 /*JTabbedPane*/ scenePanel = new cGridBag();
1332
- scenePanel.preferredWidth = 7;
1280
+ scenePanel.preferredWidth = 6;
13331281
13341282 JTabbedPane tabbedPane = new JTabbedPane();
13351283 tabbedPane.add(scrollpane);
....@@ -1435,8 +1383,8 @@
14351383
14361384 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
14371385
1438
- frame.setSize(1024, 768);
1439
- frame.show();
1386
+ frame.setSize(1280, 860);
1387
+ frame.setVisible(true);
14401388
14411389 gridPanel.setDividerLocation(1.0);
14421390
....@@ -1475,19 +1423,19 @@
14751423
14761424 cGridBag editBar = new cGridBag().setVertical(false);
14771425
1478
- editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1426
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
14791427 createMaterialButton.setToolTipText("Create material");
14801428
14811429 /*
14821430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14831431 */
14841432
1485
- editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1433
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
14861434 clearMaterialButton.setToolTipText("Clear material");
14871435
14881436 if (Globals.ADVANCED)
14891437 {
1490
- editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1438
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
14911439 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
14921440 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
14931441 }
....@@ -1938,7 +1886,7 @@
19381886
19391887 //? flashIt = false;
19401888 CameraPane pane = (CameraPane) cameraView;
1941
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
19421890 pane.clickEnd(location.x, location.y, 0, true);
19431891
19441892 if (group.selection.size() == 1)
....@@ -2395,11 +2343,11 @@
23952343
23962344 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23972345 {
2398
- if (GrafreeD.standAlone)
2346
+ if (Grafreed.standAlone)
23992347 {
24002348 /**/
24012349 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2402
- browser.show();
2350
+ browser.setVisible(true);
24032351 String filename = browser.getFile();
24042352 if (filename != null && filename.length() > 0)
24052353 {
....@@ -3006,6 +2954,10 @@
30062954 {
30072955 copy.live ^= true;
30082956 return;
2957
+ } else if (event.getSource() == selectCB)
2958
+ {
2959
+ copy.dontselect ^= true;
2960
+ return;
30092961 } else if (event.getSource() == hideCB)
30102962 {
30112963 copy.hide ^= true;
....@@ -3044,8 +2996,9 @@
30442996
30452997 public void actionPerformed(ActionEvent event)
30462998 {
2999
+ Object source = event.getSource();
30473000 // SCRIPT DIALOG
3048
- if (event.getSource() == okbutton)
3001
+ if (source == okbutton)
30493002 {
30503003 textpanel.setVisible(false);
30513004 textpanel.remove(textarea);
....@@ -3057,7 +3010,7 @@
30573010 textarea = null;
30583011 textpanel = null;
30593012 }
3060
- if (event.getSource() == cancelbutton)
3013
+ if (source == cancelbutton)
30613014 {
30623015 textpanel.setVisible(false);
30633016 textpanel.remove(textarea);
....@@ -3069,50 +3022,50 @@
30693022 //applySelf();
30703023 //client.refreshEditWindow();
30713024 //refreshContents();
3072
- if (event.getSource() == nameField)
3025
+ if (source == nameField)
30733026 {
30743027 //System.out.println("ObjEditor " + event);
30753028 applySelf0(true);
30763029 //parent.applySelf();
30773030 objEditor.refreshContents();
3078
- } else if (event.getSource() == resetButton)
3031
+ } else if (source == resetButton)
30793032 {
30803033 CameraPane.fullreset = true;
30813034 copy.Reset(); // ResetMeshes();
30823035 copy.Touch();
30833036 objEditor.refreshContents();
3084
- } else if (event.getSource() == stepItem)
3037
+ } else if (source == stepItem)
30853038 {
30863039 //cameraView.ONESTEP = true;
30873040 Globals.ONESTEP = true;
30883041 cameraView.repaint();
30893042 return;
3090
- } else if (event.getSource() == stepButton)
3043
+ } else if (source == stepButton)
30913044 {
30923045 copy.Step();
30933046 copy.Touch();
30943047 objEditor.refreshContents();
3095
- } else if (event.getSource() == slowerButton)
3048
+ } else if (source == slowerButton)
30963049 {
30973050 copy.Slower();
30983051 copy.Touch();
30993052 objEditor.refreshContents();
3100
- } else if (event.getSource() == fasterButton)
3053
+ } else if (source == fasterButton)
31013054 {
31023055 copy.Faster();
31033056 copy.Touch();
31043057 objEditor.refreshContents();
3105
- } else if (event.getSource() == remarkButton)
3058
+ } else if (source == remarkButton)
31063059 {
31073060 copy.Remark();
31083061 copy.Touch();
31093062 objEditor.refreshContents();
3110
- } else if (event.getSource() == stepAllButton)
3063
+ } else if (source == stepAllButton)
31113064 {
31123065 copy.StepAll();
31133066 copy.Touch();
31143067 objEditor.refreshContents();
3115
- } else if (event.getSource() == resetAllButton)
3068
+ } else if (source == resetAllButton)
31163069 {
31173070 //CameraPane.fullreset = true;
31183071 copy.ResetAll(); // ResetMeshes();
....@@ -3145,53 +3098,75 @@
31453098 // Close();
31463099 // }
31473100 // else
3148
- if (event.getSource() == resetSlidersButton)
3101
+ if (source == resetSlidersButton)
31493102 {
31503103 ResetSliders();
3151
- } else if (event.getSource() == clearMaterialButton)
3104
+ } else if (source == clearMaterialButton)
31523105 {
31533106 ClearMaterial();
3154
- } else if (event.getSource() == createMaterialButton)
3107
+ } else if (source == createMaterialButton)
31553108 {
31563109 CreateMaterial();
3157
- } else if (event.getSource() == clearPanelButton)
3110
+ } else if (source == clearPanelButton)
31583111 {
31593112 copy.ClearUI();
31603113 refreshContents(true);
3161
- } /*
3162
- }
3163
-
3164
- public boolean action(Event event, Object arg)
3165
- {
3166
- */ else if (event.getSource() == closeItem)
3114
+ } else if (source == importGFDItem)
3115
+ {
3116
+ ImportGFD();
3117
+ } else
3118
+ if (source == importVRMLX3DItem)
3119
+ {
3120
+ ImportVRMLX3D();
3121
+ } else
3122
+ if (source == import3DSItem)
3123
+ {
3124
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3125
+ } else
3126
+ if (source == importOBJItem)
3127
+ {
3128
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3129
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3130
+ browser.setVisible(true);
3131
+ String filename = browser.getFile();
3132
+ if (filename != null && filename.length() > 0)
3133
+ {
3134
+ String fullname = browser.getDirectory() + filename;
3135
+ makeSomething(ReadOBJ(fullname), true);
3136
+ }
3137
+ } else
3138
+ if (source == closeItem)
31673139 {
31683140 Close();
31693141 //return true;
3170
- } else if (event.getSource() == loadItem)
3142
+ } else if (source == loadItem)
31713143 {
31723144 load();
31733145 //return true;
3174
- } else if (event.getSource() == saveItem)
3146
+ } else if (source == newItem)
3147
+ {
3148
+ New();
3149
+ } else if (source == saveItem)
31753150 {
31763151 save();
31773152 //return true;
3178
- } else if (event.getSource() == saveAsItem)
3153
+ } else if (source == saveAsItem)
31793154 {
31803155 saveAs();
31813156 //return true;
3182
- } else if (event.getSource() == reexportItem)
3157
+ } else if (source == reexportItem)
31833158 {
31843159 reexport();
31853160 //return true;
3186
- } else if (event.getSource() == exportAsItem)
3161
+ } else if (source == exportAsItem)
31873162 {
31883163 export();
31893164 //return true;
3190
- } else if (event.getSource() == povItem)
3165
+ } else if (source == povItem)
31913166 {
31923167 generatePOV();
31933168 //return true;
3194
- } else if (event.getSource() == zBufferItem)
3169
+ } else if (source == zBufferItem)
31953170 {
31963171 try
31973172 {
....@@ -3213,21 +3188,8 @@
32133188 cameraView.repaint();
32143189 //return true;
32153190 }
3216
- */ else if (event.getSource() == editCameraItem)
3217
- {
3218
- cameraView.ProtectCamera();
3219
- cameraView.repaint();
3220
- return;
3221
- } else if (event.getSource() == revertCameraItem)
3222
- {
3223
- cameraView.RevertCamera();
3224
- cameraView.repaint();
3225
- return;
3226
-// } else if (event.getSource() == textureButton)
3227
-// {
3228
-// return; // true;
3229
- } else // combos...
3230
- if (event.getSource() == texresMenu)
3191
+ */ else // combos...
3192
+ if (source == texresMenu)
32313193 {
32323194 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32333195 copy.texres = texresMenu.getSelectedIndex();
....@@ -3239,6 +3201,48 @@
32393201 }
32403202 }
32413203
3204
+ void New()
3205
+ {
3206
+ while (copy.Size() > 1)
3207
+ {
3208
+ copy.remove(1);
3209
+ }
3210
+ ResetModel();
3211
+ objEditor.refreshContents();
3212
+ }
3213
+
3214
+ void ImportGFD()
3215
+ {
3216
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3217
+ browser.show();
3218
+ String filename = browser.getFile();
3219
+ if (filename != null && filename.length() > 0)
3220
+ {
3221
+ String fullname = browser.getDirectory() + filename;
3222
+
3223
+ //Object3D readobj =
3224
+ objEditor.ReadGFD(fullname, objEditor);
3225
+ //makeSomething(readobj);
3226
+ }
3227
+ }
3228
+
3229
+ void ImportVRMLX3D()
3230
+ {
3231
+ if (Grafreed.standAlone)
3232
+ {
3233
+ /**/
3234
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3235
+ browser.show();
3236
+ String filename = browser.getFile();
3237
+ if (filename != null && filename.length() > 0)
3238
+ {
3239
+ String fullname = browser.getDirectory() + filename;
3240
+ LoadVRMLX3D(fullname);
3241
+ }
3242
+ /**/
3243
+ }
3244
+ }
3245
+
32423246 void ToggleAnimation()
32433247 {
32443248 if (!Globals.ANIMATION)
....@@ -3254,8 +3258,8 @@
32543258
32553259 Globals.ANIMATION ^= true;
32563260
3257
- GrafreeD.wav.cursor = 0;
3258
- GrafreeD.wav.loop = 0;
3261
+ Grafreed.wav.cursor = 0;
3262
+ Grafreed.wav.loop = 0;
32593263 }
32603264 } else
32613265 {
....@@ -3276,7 +3280,6 @@
32763280 callee.refreshContents();
32773281 } else
32783282 {
3279
- new Exception().printStackTrace();
32803283 System.exit(0);
32813284 }
32823285 }
....@@ -3443,6 +3446,36 @@
34433446 {
34443447 //System.out.println("Propagate = " + propagate);
34453448 copy.UpdateMaterial(anchor, current, propagate);
3449
+
3450
+ if (copy.material != null)
3451
+ {
3452
+ cMaterial mat = copy.material;
3453
+
3454
+ colorField.SetToolTipValue((mat.color));
3455
+ modulationField.SetToolTipValue((mat.modulation));
3456
+ metalnessField.SetToolTipValue((mat.metalness));
3457
+ diffuseField.SetToolTipValue((mat.diffuse));
3458
+ specularField.SetToolTipValue((mat.specular));
3459
+ shininessField.SetToolTipValue((mat.shininess));
3460
+ shiftField.SetToolTipValue((mat.shift));
3461
+ ambientField.SetToolTipValue((mat.ambient));
3462
+ lightareaField.SetToolTipValue((mat.lightarea));
3463
+ diffusenessField.SetToolTipValue((mat.factor));
3464
+ velvetField.SetToolTipValue((mat.velvet));
3465
+ sheenField.SetToolTipValue((mat.sheen));
3466
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3467
+ backlitField.SetToolTipValue((mat.bump));
3468
+ anisoField.SetToolTipValue((mat.aniso));
3469
+ anisoVField.SetToolTipValue((mat.anisoV));
3470
+ cameraField.SetToolTipValue((mat.cameralight));
3471
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3472
+ shadowField.SetToolTipValue((mat.shadow));
3473
+ textureField.SetToolTipValue((mat.texture));
3474
+ opacityField.SetToolTipValue((mat.opacity));
3475
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3476
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3477
+ }
3478
+
34463479 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34473480 {
34483481 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3558,7 +3591,7 @@
35583591 }
35593592
35603593 if (normalpushField != null)
3561
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3594
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35623595 }
35633596
35643597 void SnapObject()
....@@ -4025,6 +4058,7 @@
40254058 }
40264059 }
40274060 }
4061
+
40284062 LoadGFDThread loadGFDThread;
40294063
40304064 void ReadGFD(String fullname, iCallBack cb)
....@@ -4045,7 +4079,8 @@
40454079 try
40464080 {
40474081 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4048
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4082
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4083
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40494084
40504085 readobj = (Object3D) p.readObject();
40514086 istream.close();
....@@ -4053,7 +4088,20 @@
40534088 readobj.ResetDisplayList();
40544089 } catch (Exception e)
40554090 {
4056
- e.printStackTrace();
4091
+ //e.printStackTrace();
4092
+ try
4093
+ {
4094
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4095
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4096
+
4097
+ readobj = (Object3D) p.readObject();
4098
+ istream.close();
4099
+
4100
+ readobj.ResetDisplayList();
4101
+ } catch (Exception e2)
4102
+ {
4103
+ e2.printStackTrace();
4104
+ }
40574105 }
40584106 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40594107 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4170,7 +4218,7 @@
41704218
41714219 void load() // throws ClassNotFoundException
41724220 {
4173
- if (GrafreeD.standAlone)
4221
+ if (Grafreed.standAlone)
41744222 {
41754223 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41764224 browser.show();
....@@ -4257,11 +4305,13 @@
42574305 try
42584306 {
42594307 FileOutputStream ostream = new FileOutputStream(lastname);
4260
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4308
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4309
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42614310
42624311 p.writeObject(copy);
42634312 p.flush();
42644313
4314
+ zstream.close();
42654315 ostream.close();
42664316
42674317 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4271,11 +4321,12 @@
42714321 {
42724322 }
42734323 }
4324
+
42744325 String lastname;
42754326
42764327 void saveAs()
42774328 {
4278
- if (GrafreeD.standAlone)
4329
+ if (Grafreed.standAlone)
42794330 {
42804331 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42814332 browser.setVisible(true);
....@@ -4380,13 +4431,13 @@
43804431 try
43814432 {
43824433 FileOutputStream ostream = new FileOutputStream(filename);
4383
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4384
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4434
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4435
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43854436
43864437 Object3D objectparent = obj.parent;
43874438 obj.parent = null;
43884439
4389
- Object3D object = (Object3D) GrafreeD.clone(obj);
4440
+ Object3D object = (Object3D) Grafreed.clone(obj);
43904441
43914442 obj.parent = objectparent;
43924443
....@@ -4398,8 +4449,8 @@
43984449 p.writeObject(object);
43994450 p.flush();
44004451
4452
+ zstream.close();
44014453 ostream.close();
4402
- // zstream.close();
44034454
44044455 // group.selection.get(0).parent = parent;
44054456 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4420,7 +4471,7 @@
44204471 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44214472 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44224473 copy.generatePOV(buffer);
4423
- if (GrafreeD.standAlone)
4474
+ if (Grafreed.standAlone)
44244475 {
44254476 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44264477 browser.show();
....@@ -4446,7 +4497,8 @@
44464497 Object3D client;
44474498 Object3D copy;
44484499 MenuBar menuBar;
4449
- Menu windowMenu;
4500
+ Menu fileMenu;
4501
+ MenuItem newItem;
44504502 MenuItem loadItem;
44514503 MenuItem saveItem;
44524504 MenuItem saveAsItem;
....@@ -4454,11 +4506,9 @@
44544506 MenuItem reexportItem;
44554507 MenuItem povItem;
44564508 MenuItem closeItem;
4457
- Menu cameraMenu;
4509
+
44584510 CheckboxMenuItem zBufferItem;
44594511 //MenuItem normalLensItem;
4460
- MenuItem editCameraItem;
4461
- MenuItem revertCameraItem;
44624512 MenuItem stepItem;
44634513 CheckboxMenuItem toggleLiveItem;
44644514 CheckboxMenuItem toggleFullScreenItem;
....@@ -4606,4 +4656,9 @@
46064656 //ObjectUI parent;
46074657
46084658 cNumberSlider normalpushField;
4659
+
4660
+ private MenuItem importGFDItem;
4661
+ private MenuItem importVRMLX3DItem;
4662
+ private MenuItem import3DSItem;
4663
+ private MenuItem importOBJItem;
46094664 }