Normand Briere
2019-06-09 79d0f9a45d36656051a77a7b0837aa0318f81ee5
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,150 @@
32393201 }
32403202 }
32413203
3204
+ void New()
3205
+ {
3206
+ while (copy.Size() > 1)
3207
+ {
3208
+ copy.remove(1);
3209
+ }
3210
+
3211
+ ResetModel();
3212
+ objEditor.refreshContents();
3213
+ }
3214
+
3215
+ Object3D graphs[] = new Object3D[10000];
3216
+ int undoindex = 0;
3217
+
3218
+ static public Object clone(Object o)
3219
+ {
3220
+ try
3221
+ {
3222
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3223
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3224
+
3225
+ out.writeObject(o);
3226
+
3227
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
3228
+ ObjectInputStream in = new ObjectInputStream(bais);
3229
+ Object obj = in.readObject();
3230
+ in.close();
3231
+ out.close();
3232
+ return obj;
3233
+ } catch (Exception e)
3234
+ {
3235
+ System.err.println(e);
3236
+ return null;
3237
+ }
3238
+ }
3239
+
3240
+ public void Save()
3241
+ {
3242
+ if (true) return;
3243
+
3244
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3245
+ graphs[undoindex++] = (Object3D)clone(copy);
3246
+
3247
+ for (int i = undoindex; i < graphs.length; i++)
3248
+ {
3249
+ graphs[i] = null;
3250
+ }
3251
+
3252
+ // test save
3253
+ if (false)
3254
+ {
3255
+ try
3256
+ {
3257
+ FileOutputStream ostream = new FileOutputStream("save" + undoindex);
3258
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3259
+
3260
+ p.writeObject(copy);
3261
+
3262
+ p.flush();
3263
+
3264
+ ostream.close();
3265
+ } catch (Exception e)
3266
+ {
3267
+ e.printStackTrace();
3268
+ }
3269
+ }
3270
+ }
3271
+
3272
+ public void Undo()
3273
+ {
3274
+ if (undoindex == 0)
3275
+ {
3276
+ java.awt.Toolkit.getDefaultToolkit().beep();
3277
+ return;
3278
+ }
3279
+
3280
+ if (graphs[undoindex] == null)
3281
+ {
3282
+ Save();
3283
+ undoindex -= 1;
3284
+ }
3285
+
3286
+ undoindex -= 1;
3287
+
3288
+ copy = graphs[undoindex];
3289
+
3290
+ cameraView.object = copy;
3291
+ copy.Touch();
3292
+
3293
+ ResetModel();
3294
+ refreshContents();
3295
+ }
3296
+
3297
+ public void Redo()
3298
+ {
3299
+ if (graphs[undoindex + 1] == null)
3300
+ {
3301
+ java.awt.Toolkit.getDefaultToolkit().beep();
3302
+ return;
3303
+ }
3304
+
3305
+ undoindex += 1;
3306
+
3307
+ copy = graphs[undoindex];
3308
+
3309
+ cameraView.object = copy;
3310
+ copy.Touch();
3311
+
3312
+ ResetModel();
3313
+ refreshContents();
3314
+ }
3315
+
3316
+ void ImportGFD()
3317
+ {
3318
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3319
+ browser.show();
3320
+ String filename = browser.getFile();
3321
+ if (filename != null && filename.length() > 0)
3322
+ {
3323
+ String fullname = browser.getDirectory() + filename;
3324
+
3325
+ //Object3D readobj =
3326
+ objEditor.ReadGFD(fullname, objEditor);
3327
+ //makeSomething(readobj);
3328
+ }
3329
+ }
3330
+
3331
+ void ImportVRMLX3D()
3332
+ {
3333
+ if (Grafreed.standAlone)
3334
+ {
3335
+ /**/
3336
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3337
+ browser.show();
3338
+ String filename = browser.getFile();
3339
+ if (filename != null && filename.length() > 0)
3340
+ {
3341
+ String fullname = browser.getDirectory() + filename;
3342
+ LoadVRMLX3D(fullname);
3343
+ }
3344
+ /**/
3345
+ }
3346
+ }
3347
+
32423348 void ToggleAnimation()
32433349 {
32443350 if (!Globals.ANIMATION)
....@@ -3254,8 +3360,8 @@
32543360
32553361 Globals.ANIMATION ^= true;
32563362
3257
- GrafreeD.wav.cursor = 0;
3258
- GrafreeD.wav.loop = 0;
3363
+ Grafreed.wav.cursor = 0;
3364
+ Grafreed.wav.loop = 0;
32593365 }
32603366 } else
32613367 {
....@@ -3276,7 +3382,6 @@
32763382 callee.refreshContents();
32773383 } else
32783384 {
3279
- new Exception().printStackTrace();
32803385 System.exit(0);
32813386 }
32823387 }
....@@ -3443,6 +3548,36 @@
34433548 {
34443549 //System.out.println("Propagate = " + propagate);
34453550 copy.UpdateMaterial(anchor, current, propagate);
3551
+
3552
+ if (copy.material != null)
3553
+ {
3554
+ cMaterial mat = copy.material;
3555
+
3556
+ colorField.SetToolTipValue((mat.color));
3557
+ modulationField.SetToolTipValue((mat.modulation));
3558
+ metalnessField.SetToolTipValue((mat.metalness));
3559
+ diffuseField.SetToolTipValue((mat.diffuse));
3560
+ specularField.SetToolTipValue((mat.specular));
3561
+ shininessField.SetToolTipValue((mat.shininess));
3562
+ shiftField.SetToolTipValue((mat.shift));
3563
+ ambientField.SetToolTipValue((mat.ambient));
3564
+ lightareaField.SetToolTipValue((mat.lightarea));
3565
+ diffusenessField.SetToolTipValue((mat.factor));
3566
+ velvetField.SetToolTipValue((mat.velvet));
3567
+ sheenField.SetToolTipValue((mat.sheen));
3568
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3569
+ backlitField.SetToolTipValue((mat.bump));
3570
+ anisoField.SetToolTipValue((mat.aniso));
3571
+ anisoVField.SetToolTipValue((mat.anisoV));
3572
+ cameraField.SetToolTipValue((mat.cameralight));
3573
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3574
+ shadowField.SetToolTipValue((mat.shadow));
3575
+ textureField.SetToolTipValue((mat.texture));
3576
+ opacityField.SetToolTipValue((mat.opacity));
3577
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3578
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3579
+ }
3580
+
34463581 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34473582 {
34483583 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3558,7 +3693,7 @@
35583693 }
35593694
35603695 if (normalpushField != null)
3561
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3696
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35623697 }
35633698
35643699 void SnapObject()
....@@ -3822,6 +3957,7 @@
38223957
38233958 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38243959 {
3960
+ Save();
38253961 //Tween.set(thing, 0).target(1).start(tweenManager);
38263962 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38273963 // if (thing instanceof GenericJointDemo)
....@@ -4025,6 +4161,7 @@
40254161 }
40264162 }
40274163 }
4164
+
40284165 LoadGFDThread loadGFDThread;
40294166
40304167 void ReadGFD(String fullname, iCallBack cb)
....@@ -4045,7 +4182,8 @@
40454182 try
40464183 {
40474184 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4048
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4185
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4186
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40494187
40504188 readobj = (Object3D) p.readObject();
40514189 istream.close();
....@@ -4053,7 +4191,20 @@
40534191 readobj.ResetDisplayList();
40544192 } catch (Exception e)
40554193 {
4056
- e.printStackTrace();
4194
+ //e.printStackTrace();
4195
+ try
4196
+ {
4197
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4198
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4199
+
4200
+ readobj = (Object3D) p.readObject();
4201
+ istream.close();
4202
+
4203
+ readobj.ResetDisplayList();
4204
+ } catch (Exception e2)
4205
+ {
4206
+ e2.printStackTrace();
4207
+ }
40574208 }
40584209 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40594210 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4170,7 +4321,7 @@
41704321
41714322 void load() // throws ClassNotFoundException
41724323 {
4173
- if (GrafreeD.standAlone)
4324
+ if (Grafreed.standAlone)
41744325 {
41754326 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41764327 browser.show();
....@@ -4257,11 +4408,13 @@
42574408 try
42584409 {
42594410 FileOutputStream ostream = new FileOutputStream(lastname);
4260
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4411
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4412
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42614413
42624414 p.writeObject(copy);
42634415 p.flush();
42644416
4417
+ zstream.close();
42654418 ostream.close();
42664419
42674420 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4271,11 +4424,12 @@
42714424 {
42724425 }
42734426 }
4427
+
42744428 String lastname;
42754429
42764430 void saveAs()
42774431 {
4278
- if (GrafreeD.standAlone)
4432
+ if (Grafreed.standAlone)
42794433 {
42804434 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42814435 browser.setVisible(true);
....@@ -4380,13 +4534,13 @@
43804534 try
43814535 {
43824536 FileOutputStream ostream = new FileOutputStream(filename);
4383
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4384
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4537
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4538
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43854539
43864540 Object3D objectparent = obj.parent;
43874541 obj.parent = null;
43884542
4389
- Object3D object = (Object3D) GrafreeD.clone(obj);
4543
+ Object3D object = (Object3D) Grafreed.clone(obj);
43904544
43914545 obj.parent = objectparent;
43924546
....@@ -4398,8 +4552,8 @@
43984552 p.writeObject(object);
43994553 p.flush();
44004554
4555
+ zstream.close();
44014556 ostream.close();
4402
- // zstream.close();
44034557
44044558 // group.selection.get(0).parent = parent;
44054559 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4420,7 +4574,7 @@
44204574 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44214575 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44224576 copy.generatePOV(buffer);
4423
- if (GrafreeD.standAlone)
4577
+ if (Grafreed.standAlone)
44244578 {
44254579 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44264580 browser.show();
....@@ -4446,7 +4600,8 @@
44464600 Object3D client;
44474601 Object3D copy;
44484602 MenuBar menuBar;
4449
- Menu windowMenu;
4603
+ Menu fileMenu;
4604
+ MenuItem newItem;
44504605 MenuItem loadItem;
44514606 MenuItem saveItem;
44524607 MenuItem saveAsItem;
....@@ -4454,11 +4609,9 @@
44544609 MenuItem reexportItem;
44554610 MenuItem povItem;
44564611 MenuItem closeItem;
4457
- Menu cameraMenu;
4612
+
44584613 CheckboxMenuItem zBufferItem;
44594614 //MenuItem normalLensItem;
4460
- MenuItem editCameraItem;
4461
- MenuItem revertCameraItem;
44624615 MenuItem stepItem;
44634616 CheckboxMenuItem toggleLiveItem;
44644617 CheckboxMenuItem toggleFullScreenItem;
....@@ -4606,4 +4759,9 @@
46064759 //ObjectUI parent;
46074760
46084761 cNumberSlider normalpushField;
4762
+
4763
+ private MenuItem importGFDItem;
4764
+ private MenuItem importVRMLX3DItem;
4765
+ private MenuItem import3DSItem;
4766
+ private MenuItem importOBJItem;
46094767 }