Normand Briere
2019-06-11 1d909ffa0c2beb51d453b53b845c4f3a749ca5f0
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)
....@@ -1987,6 +1935,7 @@
19871935 e2.printStackTrace();
19881936 }
19891937 }
1938
+
19901939 LoadJMEThread loadThread;
19911940
19921941 class LoadJMEThread extends Thread
....@@ -2044,6 +1993,7 @@
20441993 //LoadFile0(filename, converter);
20451994 }
20461995 }
1996
+
20471997 LoadOBJThread loadObjThread;
20481998
20491999 class LoadOBJThread extends Thread
....@@ -2395,11 +2345,11 @@
23952345
23962346 void ImportJME(com.jmex.model.converters.FormatConverter converter, String ext, String dialogName)
23972347 {
2398
- if (GrafreeD.standAlone)
2348
+ if (Grafreed.standAlone)
23992349 {
24002350 /**/
24012351 FileDialog browser = new FileDialog(frame, dialogName, FileDialog.LOAD);
2402
- browser.show();
2352
+ browser.setVisible(true);
24032353 String filename = browser.getFile();
24042354 if (filename != null && filename.length() > 0)
24052355 {
....@@ -3006,6 +2956,10 @@
30062956 {
30072957 copy.live ^= true;
30082958 return;
2959
+ } else if (event.getSource() == selectCB)
2960
+ {
2961
+ copy.dontselect ^= true;
2962
+ return;
30092963 } else if (event.getSource() == hideCB)
30102964 {
30112965 copy.hide ^= true;
....@@ -3044,8 +2998,9 @@
30442998
30452999 public void actionPerformed(ActionEvent event)
30463000 {
3001
+ Object source = event.getSource();
30473002 // SCRIPT DIALOG
3048
- if (event.getSource() == okbutton)
3003
+ if (source == okbutton)
30493004 {
30503005 textpanel.setVisible(false);
30513006 textpanel.remove(textarea);
....@@ -3057,7 +3012,7 @@
30573012 textarea = null;
30583013 textpanel = null;
30593014 }
3060
- if (event.getSource() == cancelbutton)
3015
+ if (source == cancelbutton)
30613016 {
30623017 textpanel.setVisible(false);
30633018 textpanel.remove(textarea);
....@@ -3069,50 +3024,50 @@
30693024 //applySelf();
30703025 //client.refreshEditWindow();
30713026 //refreshContents();
3072
- if (event.getSource() == nameField)
3027
+ if (source == nameField)
30733028 {
30743029 //System.out.println("ObjEditor " + event);
30753030 applySelf0(true);
30763031 //parent.applySelf();
30773032 objEditor.refreshContents();
3078
- } else if (event.getSource() == resetButton)
3033
+ } else if (source == resetButton)
30793034 {
30803035 CameraPane.fullreset = true;
30813036 copy.Reset(); // ResetMeshes();
30823037 copy.Touch();
30833038 objEditor.refreshContents();
3084
- } else if (event.getSource() == stepItem)
3039
+ } else if (source == stepItem)
30853040 {
30863041 //cameraView.ONESTEP = true;
30873042 Globals.ONESTEP = true;
30883043 cameraView.repaint();
30893044 return;
3090
- } else if (event.getSource() == stepButton)
3045
+ } else if (source == stepButton)
30913046 {
30923047 copy.Step();
30933048 copy.Touch();
30943049 objEditor.refreshContents();
3095
- } else if (event.getSource() == slowerButton)
3050
+ } else if (source == slowerButton)
30963051 {
30973052 copy.Slower();
30983053 copy.Touch();
30993054 objEditor.refreshContents();
3100
- } else if (event.getSource() == fasterButton)
3055
+ } else if (source == fasterButton)
31013056 {
31023057 copy.Faster();
31033058 copy.Touch();
31043059 objEditor.refreshContents();
3105
- } else if (event.getSource() == remarkButton)
3060
+ } else if (source == remarkButton)
31063061 {
31073062 copy.Remark();
31083063 copy.Touch();
31093064 objEditor.refreshContents();
3110
- } else if (event.getSource() == stepAllButton)
3065
+ } else if (source == stepAllButton)
31113066 {
31123067 copy.StepAll();
31133068 copy.Touch();
31143069 objEditor.refreshContents();
3115
- } else if (event.getSource() == resetAllButton)
3070
+ } else if (source == resetAllButton)
31163071 {
31173072 //CameraPane.fullreset = true;
31183073 copy.ResetAll(); // ResetMeshes();
....@@ -3145,53 +3100,75 @@
31453100 // Close();
31463101 // }
31473102 // else
3148
- if (event.getSource() == resetSlidersButton)
3103
+ if (source == resetSlidersButton)
31493104 {
31503105 ResetSliders();
3151
- } else if (event.getSource() == clearMaterialButton)
3106
+ } else if (source == clearMaterialButton)
31523107 {
31533108 ClearMaterial();
3154
- } else if (event.getSource() == createMaterialButton)
3109
+ } else if (source == createMaterialButton)
31553110 {
31563111 CreateMaterial();
3157
- } else if (event.getSource() == clearPanelButton)
3112
+ } else if (source == clearPanelButton)
31583113 {
31593114 copy.ClearUI();
31603115 refreshContents(true);
3161
- } /*
3162
- }
3163
-
3164
- public boolean action(Event event, Object arg)
3165
- {
3166
- */ else if (event.getSource() == closeItem)
3116
+ } else if (source == importGFDItem)
3117
+ {
3118
+ ImportGFD();
3119
+ } else
3120
+ if (source == importVRMLX3DItem)
3121
+ {
3122
+ ImportVRMLX3D();
3123
+ } else
3124
+ if (source == import3DSItem)
3125
+ {
3126
+ objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
3127
+ } else
3128
+ if (source == importOBJItem)
3129
+ {
3130
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
3131
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
3132
+ browser.setVisible(true);
3133
+ String filename = browser.getFile();
3134
+ if (filename != null && filename.length() > 0)
3135
+ {
3136
+ String fullname = browser.getDirectory() + filename;
3137
+ makeSomething(ReadOBJ(fullname), true);
3138
+ }
3139
+ } else
3140
+ if (source == closeItem)
31673141 {
31683142 Close();
31693143 //return true;
3170
- } else if (event.getSource() == loadItem)
3144
+ } else if (source == loadItem)
31713145 {
31723146 load();
31733147 //return true;
3174
- } else if (event.getSource() == saveItem)
3148
+ } else if (source == newItem)
3149
+ {
3150
+ New();
3151
+ } else if (source == saveItem)
31753152 {
31763153 save();
31773154 //return true;
3178
- } else if (event.getSource() == saveAsItem)
3155
+ } else if (source == saveAsItem)
31793156 {
31803157 saveAs();
31813158 //return true;
3182
- } else if (event.getSource() == reexportItem)
3159
+ } else if (source == reexportItem)
31833160 {
31843161 reexport();
31853162 //return true;
3186
- } else if (event.getSource() == exportAsItem)
3163
+ } else if (source == exportAsItem)
31873164 {
31883165 export();
31893166 //return true;
3190
- } else if (event.getSource() == povItem)
3167
+ } else if (source == povItem)
31913168 {
31923169 generatePOV();
31933170 //return true;
3194
- } else if (event.getSource() == zBufferItem)
3171
+ } else if (source == zBufferItem)
31953172 {
31963173 try
31973174 {
....@@ -3213,21 +3190,8 @@
32133190 cameraView.repaint();
32143191 //return true;
32153192 }
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)
3193
+ */ else // combos...
3194
+ if (source == texresMenu)
32313195 {
32323196 System.err.println("Object = " + copy + "; change value " + copy.texres + " to " + texresMenu.getSelectedIndex());
32333197 copy.texres = texresMenu.getSelectedIndex();
....@@ -3239,6 +3203,184 @@
32393203 }
32403204 }
32413205
3206
+ void New()
3207
+ {
3208
+ while (copy.Size() > 1)
3209
+ {
3210
+ copy.remove(1);
3211
+ }
3212
+
3213
+ ResetModel();
3214
+ objEditor.refreshContents();
3215
+ }
3216
+
3217
+ static public Object clone(Object o)
3218
+ {
3219
+ try
3220
+ {
3221
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
3222
+ ObjectOutputStream out = new ObjectOutputStream(baos);
3223
+
3224
+ out.writeObject(o);
3225
+
3226
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
3227
+ ObjectInputStream in = new ObjectInputStream(bais);
3228
+ Object obj = in.readObject();
3229
+ in.close();
3230
+ out.close();
3231
+ return obj;
3232
+ } catch (Exception e)
3233
+ {
3234
+ System.err.println(e);
3235
+ return null;
3236
+ }
3237
+ }
3238
+
3239
+ cRadio GetCurrentTab()
3240
+ {
3241
+ cRadio ab;
3242
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3243
+ {
3244
+ ab = (cRadio)e.nextElement();
3245
+ if(ab.GetObject() == copy)
3246
+ {
3247
+ return ab;
3248
+ }
3249
+ }
3250
+
3251
+ return null;
3252
+ }
3253
+
3254
+ public void Save()
3255
+ {
3256
+ cRadio tab = GetCurrentTab();
3257
+
3258
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3259
+ tab.graphs[tab.undoindex++] = (Object3D)clone(copy);
3260
+
3261
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
3262
+ {
3263
+ tab.graphs[i] = null;
3264
+ }
3265
+
3266
+ // test save
3267
+ if (false)
3268
+ {
3269
+ try
3270
+ {
3271
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3272
+ ObjectOutputStream p = new ObjectOutputStream(ostream);
3273
+
3274
+ p.writeObject(copy);
3275
+
3276
+ p.flush();
3277
+
3278
+ ostream.close();
3279
+ } catch (Exception e)
3280
+ {
3281
+ e.printStackTrace();
3282
+ }
3283
+ }
3284
+ }
3285
+
3286
+ void CopyChanged(Object3D obj)
3287
+ {
3288
+ copy.clear();
3289
+
3290
+ for (int i=0; i<obj.Size(); i++)
3291
+ {
3292
+ copy.add(obj.get(i));
3293
+ }
3294
+
3295
+ copy.Touch();
3296
+
3297
+ ResetModel();
3298
+ copy.HardTouch(); // recompile?
3299
+
3300
+ cRadio ab;
3301
+ for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
3302
+ {
3303
+ ab = (cRadio)e.nextElement();
3304
+ Object3D test = copy.GetObject(ab.object.GetUUID());
3305
+ //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID());
3306
+ if (test != null)
3307
+ {
3308
+ test.editWindow = ab.object.editWindow;
3309
+ ab.object = test;
3310
+ }
3311
+ }
3312
+
3313
+ refreshContents();
3314
+ }
3315
+
3316
+ public void Undo()
3317
+ {
3318
+ cRadio tab = GetCurrentTab();
3319
+
3320
+ if (tab.undoindex == 0)
3321
+ {
3322
+ java.awt.Toolkit.getDefaultToolkit().beep();
3323
+ return;
3324
+ }
3325
+
3326
+ if (tab.graphs[tab.undoindex] == null)
3327
+ {
3328
+ Save();
3329
+ tab.undoindex -= 1;
3330
+ }
3331
+
3332
+ tab.undoindex -= 1;
3333
+
3334
+ CopyChanged(tab.graphs[tab.undoindex]);
3335
+ }
3336
+
3337
+ public void Redo()
3338
+ {
3339
+ cRadio tab = GetCurrentTab();
3340
+
3341
+ if (tab.graphs[tab.undoindex + 1] == null)
3342
+ {
3343
+ java.awt.Toolkit.getDefaultToolkit().beep();
3344
+ return;
3345
+ }
3346
+
3347
+ tab.undoindex += 1;
3348
+
3349
+ CopyChanged(tab.graphs[tab.undoindex]);
3350
+ }
3351
+
3352
+ void ImportGFD()
3353
+ {
3354
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
3355
+ browser.show();
3356
+ String filename = browser.getFile();
3357
+ if (filename != null && filename.length() > 0)
3358
+ {
3359
+ String fullname = browser.getDirectory() + filename;
3360
+
3361
+ //Object3D readobj =
3362
+ objEditor.ReadGFD(fullname, objEditor);
3363
+ //makeSomething(readobj);
3364
+ }
3365
+ }
3366
+
3367
+ void ImportVRMLX3D()
3368
+ {
3369
+ if (Grafreed.standAlone)
3370
+ {
3371
+ /**/
3372
+ FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
3373
+ browser.show();
3374
+ String filename = browser.getFile();
3375
+ if (filename != null && filename.length() > 0)
3376
+ {
3377
+ String fullname = browser.getDirectory() + filename;
3378
+ LoadVRMLX3D(fullname);
3379
+ }
3380
+ /**/
3381
+ }
3382
+ }
3383
+
32423384 void ToggleAnimation()
32433385 {
32443386 if (!Globals.ANIMATION)
....@@ -3254,8 +3396,8 @@
32543396
32553397 Globals.ANIMATION ^= true;
32563398
3257
- GrafreeD.wav.cursor = 0;
3258
- GrafreeD.wav.loop = 0;
3399
+ Grafreed.wav.cursor = 0;
3400
+ Grafreed.wav.loop = 0;
32593401 }
32603402 } else
32613403 {
....@@ -3276,7 +3418,6 @@
32763418 callee.refreshContents();
32773419 } else
32783420 {
3279
- new Exception().printStackTrace();
32803421 System.exit(0);
32813422 }
32823423 }
....@@ -3443,6 +3584,36 @@
34433584 {
34443585 //System.out.println("Propagate = " + propagate);
34453586 copy.UpdateMaterial(anchor, current, propagate);
3587
+
3588
+ if (copy.material != null)
3589
+ {
3590
+ cMaterial mat = copy.material;
3591
+
3592
+ colorField.SetToolTipValue((mat.color));
3593
+ modulationField.SetToolTipValue((mat.modulation));
3594
+ metalnessField.SetToolTipValue((mat.metalness));
3595
+ diffuseField.SetToolTipValue((mat.diffuse));
3596
+ specularField.SetToolTipValue((mat.specular));
3597
+ shininessField.SetToolTipValue((mat.shininess));
3598
+ shiftField.SetToolTipValue((mat.shift));
3599
+ ambientField.SetToolTipValue((mat.ambient));
3600
+ lightareaField.SetToolTipValue((mat.lightarea));
3601
+ diffusenessField.SetToolTipValue((mat.factor));
3602
+ velvetField.SetToolTipValue((mat.velvet));
3603
+ sheenField.SetToolTipValue((mat.sheen));
3604
+ subsurfaceField.SetToolTipValue((mat.subsurface));
3605
+ backlitField.SetToolTipValue((mat.bump));
3606
+ anisoField.SetToolTipValue((mat.aniso));
3607
+ anisoVField.SetToolTipValue((mat.anisoV));
3608
+ cameraField.SetToolTipValue((mat.cameralight));
3609
+ selfshadowField.SetToolTipValue((mat.diffuseness));
3610
+ shadowField.SetToolTipValue((mat.shadow));
3611
+ textureField.SetToolTipValue((mat.texture));
3612
+ opacityField.SetToolTipValue((mat.opacity));
3613
+ fakedepthField.SetToolTipValue((mat.fakedepth));
3614
+ shadowbiasField.SetToolTipValue((mat.shadowbias));
3615
+ }
3616
+
34463617 if (copy.material != null && copy.projectedVertices.length > 0 && copy.projectedVertices[0] != null)
34473618 {
34483619 copy.projectedVertices[0].x = (int) (bumpField.getFloat() * 1000);
....@@ -3558,7 +3729,7 @@
35583729 }
35593730
35603731 if (normalpushField != null)
3561
- copy.NORMALPUSH = (float)normalpushField.getFloat()/1000;
3732
+ copy.NORMALPUSH = (float)normalpushField.getFloat()/100;
35623733 }
35633734
35643735 void SnapObject()
....@@ -3822,6 +3993,7 @@
38223993
38233994 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
38243995 {
3996
+ Save();
38253997 //Tween.set(thing, 0).target(1).start(tweenManager);
38263998 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
38273999 // if (thing instanceof GenericJointDemo)
....@@ -4025,6 +4197,7 @@
40254197 }
40264198 }
40274199 }
4200
+
40284201 LoadGFDThread loadGFDThread;
40294202
40304203 void ReadGFD(String fullname, iCallBack cb)
....@@ -4045,7 +4218,8 @@
40454218 try
40464219 {
40474220 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4048
- java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4221
+ java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream);
4222
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream);
40494223
40504224 readobj = (Object3D) p.readObject();
40514225 istream.close();
....@@ -4053,7 +4227,20 @@
40534227 readobj.ResetDisplayList();
40544228 } catch (Exception e)
40554229 {
4056
- e.printStackTrace();
4230
+ //e.printStackTrace();
4231
+ try
4232
+ {
4233
+ java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
4234
+ java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream);
4235
+
4236
+ readobj = (Object3D) p.readObject();
4237
+ istream.close();
4238
+
4239
+ readobj.ResetDisplayList();
4240
+ } catch (Exception e2)
4241
+ {
4242
+ e2.printStackTrace();
4243
+ }
40574244 }
40584245 // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); }
40594246 // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); }
....@@ -4170,7 +4357,7 @@
41704357
41714358 void load() // throws ClassNotFoundException
41724359 {
4173
- if (GrafreeD.standAlone)
4360
+ if (Grafreed.standAlone)
41744361 {
41754362 FileDialog browser = new FileDialog(frame, "Load", FileDialog.LOAD);
41764363 browser.show();
....@@ -4257,11 +4444,13 @@
42574444 try
42584445 {
42594446 FileOutputStream ostream = new FileOutputStream(lastname);
4260
- ObjectOutputStream p = new ObjectOutputStream(ostream);
4447
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4448
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
42614449
42624450 p.writeObject(copy);
42634451 p.flush();
42644452
4453
+ zstream.close();
42654454 ostream.close();
42664455
42674456 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4271,11 +4460,12 @@
42714460 {
42724461 }
42734462 }
4463
+
42744464 String lastname;
42754465
42764466 void saveAs()
42774467 {
4278
- if (GrafreeD.standAlone)
4468
+ if (Grafreed.standAlone)
42794469 {
42804470 FileDialog browser = new FileDialog(frame, "Save As", FileDialog.SAVE);
42814471 browser.setVisible(true);
....@@ -4380,13 +4570,13 @@
43804570 try
43814571 {
43824572 FileOutputStream ostream = new FileOutputStream(filename);
4383
- // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4384
- ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream);
4573
+ java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream);
4574
+ ObjectOutputStream p = new ObjectOutputStream(zstream);
43854575
43864576 Object3D objectparent = obj.parent;
43874577 obj.parent = null;
43884578
4389
- Object3D object = (Object3D) GrafreeD.clone(obj);
4579
+ Object3D object = (Object3D) Grafreed.clone(obj);
43904580
43914581 obj.parent = objectparent;
43924582
....@@ -4398,8 +4588,8 @@
43984588 p.writeObject(object);
43994589 p.flush();
44004590
4591
+ zstream.close();
44014592 ostream.close();
4402
- // zstream.close();
44034593
44044594 // group.selection.get(0).parent = parent;
44054595 //FileOutputStream fos = new FileOutputStream(fullname);
....@@ -4420,7 +4610,7 @@
44204610 buffer.append("background { color rgb <0.8,0.8,0.8> }\n\n");
44214611 cameraView.renderCamera.generatePOV(buffer, bnds.width, bnds.height);
44224612 copy.generatePOV(buffer);
4423
- if (GrafreeD.standAlone)
4613
+ if (Grafreed.standAlone)
44244614 {
44254615 FileDialog browser = new FileDialog(frame, "Export POV", 1);
44264616 browser.show();
....@@ -4446,7 +4636,8 @@
44464636 Object3D client;
44474637 Object3D copy;
44484638 MenuBar menuBar;
4449
- Menu windowMenu;
4639
+ Menu fileMenu;
4640
+ MenuItem newItem;
44504641 MenuItem loadItem;
44514642 MenuItem saveItem;
44524643 MenuItem saveAsItem;
....@@ -4454,11 +4645,9 @@
44544645 MenuItem reexportItem;
44554646 MenuItem povItem;
44564647 MenuItem closeItem;
4457
- Menu cameraMenu;
4648
+
44584649 CheckboxMenuItem zBufferItem;
44594650 //MenuItem normalLensItem;
4460
- MenuItem editCameraItem;
4461
- MenuItem revertCameraItem;
44624651 MenuItem stepItem;
44634652 CheckboxMenuItem toggleLiveItem;
44644653 CheckboxMenuItem toggleFullScreenItem;
....@@ -4606,4 +4795,9 @@
46064795 //ObjectUI parent;
46074796
46084797 cNumberSlider normalpushField;
4798
+
4799
+ private MenuItem importGFDItem;
4800
+ private MenuItem importVRMLX3DItem;
4801
+ private MenuItem import3DSItem;
4802
+ private MenuItem importOBJItem;
46094803 }