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,78 +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
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
323
- toggleSwitchItem.addItemListener(this);
324
- toggleSwitchItem.setState(CameraPane.SWITCH);
325
-
326
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
327
- toggleHandleItem.addItemListener(this);
328
- toggleHandleItem.setState(CameraPane.HANDLES);
329
-
330
- cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
331
- togglePaintItem.addItemListener(this);
332
- togglePaintItem.setState(CameraPane.PAINTMODE);
333
-
334
- if (Globals.ADVANCED)
335
- {
336
- cameraMenu.add("-");
337
- cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
338
- toggleLiveItem.addItemListener(this);
339
- toggleLiveItem.setState(Globals.isLIVE());
340
-
341
- cameraMenu.add(stepItem = new MenuItem("Step"));
342
- stepItem.addActionListener(this);
343
- // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
344
- // toggleDLItem.addItemListener(this);
345
- // toggleDLItem.setState(false);
346
-
347
- cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
348
- toggleRenderItem.addItemListener(this);
349
- toggleRenderItem.setState(!CameraPane.frozen);
350
-
351
- cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
352
- toggleDebugItem.addItemListener(this);
353
- toggleDebugItem.setState(CameraPane.DEBUG);
354
-
355
- cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
356
- toggleFrustumItem.addItemListener(this);
357
- toggleFrustumItem.setState(CameraPane.FRUSTUM);
358
-
359
- cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
360
- toggleFootContactItem.addItemListener(this);
361
- toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
362
-
363
- cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
364
- toggleTimelineItem.addItemListener(this);
365
- }
366
-
367
-// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
368
-// toggleRootItem.addItemListener(this);
369
-// toggleRootItem.setState(false);
370
-// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
371
-// animationItem.addItemListener(this);
372
-// animationItem.setState(CameraPane.ANIMATION);
373
- cameraMenu.add("-");
374
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
375
- editCameraItem.addActionListener(this);
376320
377321 objectPanel = new JTabbedPane();
378322 toolbarPanel = new JPanel();
....@@ -501,13 +445,13 @@
501445 //SendInfo("Name:", "bold");
502446 if (sel.GetTextures() != null || debug)
503447 {
504
- si.SendInfo(sel.toString(), "bold");
448
+ si.SendInfo(sel.toString() + (Globals.ADVANCED?"":" " + System.identityHashCode(sel)), "bold");
505449 //SendInfo("#children virtual = " + sel.size() + "; real = " + sel.Size() + newline, "regular");
506450 if (sel.Size() > 0)
507451 {
508452 si.SendInfo("#children = " + sel.Size(), "regular");
509453 }
510
- si.SendInfo((debug ? " Parent: " : " ") + sel.parent, "regular");
454
+ si.SendInfo((debug ? " Parent: " : " ") + sel.parent + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.parent)), "regular");
511455 if (debug)
512456 {
513457 try
....@@ -549,7 +493,7 @@
549493 }
550494 if (sel.support != null)
551495 {
552
- si.SendInfo(" support: " + sel.support, "regular");
496
+ si.SendInfo(" support: " + sel.support + (Globals.ADVANCED?"":" " + System.identityHashCode(sel.support)), "regular");
553497 }
554498 if (sel.scriptnode != null)
555499 {
....@@ -752,7 +696,7 @@
752696 protected static ImageIcon createImageIcon(String path,
753697 String description)
754698 {
755
- java.net.URL imgURL = GrafreeD.class.getResource(path);
699
+ java.net.URL imgURL = Grafreed.class.getResource(path);
756700 if (imgURL != null)
757701 {
758702 return new ImageIcon(imgURL, description);
....@@ -784,6 +728,7 @@
784728 // NumberSlider vDivsField;
785729 // JCheckBox endcaps;
786730 JCheckBox liveCB;
731
+ JCheckBox selectCB;
787732 JCheckBox hideCB;
788733 JCheckBox link2masterCB;
789734 JCheckBox markCB;
....@@ -986,9 +931,11 @@
986931
987932 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
988933 liveCB.setToolTipText("Animate object");
934
+ selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
935
+ selectCB.setToolTipText("Make object selectable");
936
+// Return();
989937 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
990938 hideCB.setToolTipText("Hide object");
991
-// Return();
992939 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
993940 markCB.setToolTipText("Set the animation target transform");
994941
....@@ -1028,7 +975,7 @@
1028975 oe.ctrlPanel.add(commandsPanel);
1029976 oe.ctrlPanel.Return();
1030977
1031
- 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
1032979 normalpushField = (cNumberSlider)pushPanel.getComponent(1);
1033980 //Return();
1034981
....@@ -1476,19 +1423,19 @@
14761423
14771424 cGridBag editBar = new cGridBag().setVertical(false);
14781425
1479
- editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1426
+ editBar.add(createMaterialButton = new cButton("Create", !Grafreed.NIMBUSLAF)); // , aConstraints);
14801427 createMaterialButton.setToolTipText("Create material");
14811428
14821429 /*
14831430 ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
14841431 */
14851432
1486
- editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1433
+ editBar.add(clearMaterialButton = new cButton("Clear", !Grafreed.NIMBUSLAF)); // , aConstraints);
14871434 clearMaterialButton.setToolTipText("Clear material");
14881435
14891436 if (Globals.ADVANCED)
14901437 {
1491
- editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints);
1438
+ editBar.add(resetSlidersButton = new cButton("Reset", !Grafreed.NIMBUSLAF)); // , aConstraints);
14921439 editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
14931440 editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
14941441 }
....@@ -1939,7 +1886,7 @@
19391886
19401887 //? flashIt = false;
19411888 CameraPane pane = (CameraPane) cameraView;
1942
- pane.clickStart(location.x, location.y, 0);
1889
+ pane.clickStart(location.x, location.y, 0, 0);
19431890 pane.clickEnd(location.x, location.y, 0, true);
19441891
19451892 if (group.selection.size() == 1)
....@@ -2396,11 +2343,11 @@
23962343
23972344 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23982345 {
2399
- if (GrafreeD.standAlone)
2346
+ if (Grafreed.standAlone)
24002347 {
24012348 /**/
24022349 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2403
- browser.show();
2350
+ browser.setVisible(true);
24042351 String filename = browser.getFile();
24052352 if (filename != null && filename.length() > 0)
24062353 {
....@@ -3007,6 +2954,10 @@
30072954 {
30082955 copy.live ^= true;
30092956 return;
2957
+ } else if (event.getSource() == selectCB)
2958
+ {
2959
+ copy.dontselect ^= true;
2960
+ return;
30102961 } else if (event.getSource() == hideCB)
30112962 {
30122963 copy.hide ^= true;
....@@ -3045,8 +2996,9 @@
30452996
30462997 public void actionPerformed(ActionEvent event)
30472998 {
2999
+ Object source = event.getSource();
30483000 // SCRIPT DIALOG
3049
- if (event.getSource() == okbutton)
3001
+ if (source == okbutton)
30503002 {
30513003 textpanel.setVisible(false);
30523004 textpanel.remove(textarea);
....@@ -3058,7 +3010,7 @@
30583010 textarea = null;
30593011 textpanel = null;
30603012 }
3061
- if (event.getSource() == cancelbutton)
3013
+ if (source == cancelbutton)
30623014 {
30633015 textpanel.setVisible(false);
30643016 textpanel.remove(textarea);
....@@ -3070,50 +3022,50 @@
30703022 //applySelf();
30713023 //client.refreshEditWindow();
30723024 //refreshContents();
3073
- if (event.getSource() == nameField)
3025
+ if (source == nameField)
30743026 {
30753027 //System.out.println("ObjEditor " + event);
30763028 applySelf0(true);
30773029 //parent.applySelf();
30783030 objEditor.refreshContents();
3079
- } else if (event.getSource() == resetButton)
3031
+ } else if (source == resetButton)
30803032 {
30813033 CameraPane.fullreset = true;
30823034 copy.Reset(); // ResetMeshes();
30833035 copy.Touch();
30843036 objEditor.refreshContents();
3085
- } else if (event.getSource() == stepItem)
3037
+ } else if (source == stepItem)
30863038 {
30873039 //cameraView.ONESTEP = true;
30883040 Globals.ONESTEP = true;
30893041 cameraView.repaint();
30903042 return;
3091
- } else if (event.getSource() == stepButton)
3043
+ } else if (source == stepButton)
30923044 {
30933045 copy.Step();
30943046 copy.Touch();
30953047 objEditor.refreshContents();
3096
- } else if (event.getSource() == slowerButton)
3048
+ } else if (source == slowerButton)
30973049 {
30983050 copy.Slower();
30993051 copy.Touch();
31003052 objEditor.refreshContents();
3101
- } else if (event.getSource() == fasterButton)
3053
+ } else if (source == fasterButton)
31023054 {
31033055 copy.Faster();
31043056 copy.Touch();
31053057 objEditor.refreshContents();
3106
- } else if (event.getSource() == remarkButton)
3058
+ } else if (source == remarkButton)
31073059 {
31083060 copy.Remark();
31093061 copy.Touch();
31103062 objEditor.refreshContents();
3111
- } else if (event.getSource() == stepAllButton)
3063
+ } else if (source == stepAllButton)
31123064 {
31133065 copy.StepAll();
31143066 copy.Touch();
31153067 objEditor.refreshContents();
3116
- } else if (event.getSource() == resetAllButton)
3068
+ } else if (source == resetAllButton)
31173069 {
31183070 //CameraPane.fullreset = true;
31193071 copy.ResetAll(); // ResetMeshes();
....@@ -3146,53 +3098,75 @@
31463098 // Close();
31473099 // }
31483100 // else
3149
- if (event.getSource() == resetSlidersButton)
3101
+ if (source == resetSlidersButton)
31503102 {
31513103 ResetSliders();
3152
- } else if (event.getSource() == clearMaterialButton)
3104
+ } else if (source == clearMaterialButton)
31533105 {
31543106 ClearMaterial();
3155
- } else if (event.getSource() == createMaterialButton)
3107
+ } else if (source == createMaterialButton)
31563108 {
31573109 CreateMaterial();
3158
- } else if (event.getSource() == clearPanelButton)
3110
+ } else if (source == clearPanelButton)
31593111 {
31603112 copy.ClearUI();
31613113 refreshContents(true);
3162
- } /*
3163
- }
3164
-
3165
- public boolean action(Event event, Object arg)
3166
- {
3167
- */ 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)
31683139 {
31693140 Close();
31703141 //return true;
3171
- } else if (event.getSource() == loadItem)
3142
+ } else if (source == loadItem)
31723143 {
31733144 load();
31743145 //return true;
3175
- } else if (event.getSource() == saveItem)
3146
+ } else if (source == newItem)
3147
+ {
3148
+ New();
3149
+ } else if (source == saveItem)
31763150 {
31773151 save();
31783152 //return true;
3179
- } else if (event.getSource() == saveAsItem)
3153
+ } else if (source == saveAsItem)
31803154 {
31813155 saveAs();
31823156 //return true;
3183
- } else if (event.getSource() == reexportItem)
3157
+ } else if (source == reexportItem)
31843158 {
31853159 reexport();
31863160 //return true;
3187
- } else if (event.getSource() == exportAsItem)
3161
+ } else if (source == exportAsItem)
31883162 {
31893163 export();
31903164 //return true;
3191
- } else if (event.getSource() == povItem)
3165
+ } else if (source == povItem)
31923166 {
31933167 generatePOV();
31943168 //return true;
3195
- } else if (event.getSource() == zBufferItem)
3169
+ } else if (source == zBufferItem)
31963170 {
31973171 try
31983172 {
....@@ -3214,21 +3188,8 @@
32143188 cameraView.repaint();
32153189 //return true;
32163190 }
3217
- */ else if (event.getSource() == editCameraItem)
3218
- {
3219
- cameraView.ProtectCamera();
3220
- cameraView.repaint();
3221
- return;
3222
- } else if (event.getSource() == revertCameraItem)
3223
- {
3224
- cameraView.RevertCamera();
3225
- cameraView.repaint();
3226
- return;
3227
-// } else if (event.getSource() == textureButton)
3228
-// {
3229
-// return; // true;
3230
- } else // combos...
3231
- if (event.getSource() == texresMenu)
3191
+ */ else // combos...
3192
+ if (source == texresMenu)
32323193 {
32333194 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32343195 copy.texres = texresMenu.getSelectedIndex();
....@@ -3240,6 +3201,150 @@
32403201 }
32413202 }
32423203
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
+
32433348 void ToggleAnimation()
32443349 {
32453350 if (!Globals.ANIMATION)
....@@ -3255,8 +3360,8 @@
32553360
32563361 Globals.ANIMATION ^= true;
32573362
3258
- GrafreeD.wav.cursor = 0;
3259
- GrafreeD.wav.loop = 0;
3363
+ Grafreed.wav.cursor = 0;
3364
+ Grafreed.wav.loop = 0;
32603365 }
32613366 } else
32623367 {
....@@ -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 }