.. | .. |
---|
1935 | 1935 | e2.printStackTrace(); |
---|
1936 | 1936 | } |
---|
1937 | 1937 | } |
---|
| 1938 | + |
---|
1938 | 1939 | LoadJMEThread loadThread; |
---|
1939 | 1940 | |
---|
1940 | 1941 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1992 | 1993 | //LoadFile0(filename, converter); |
---|
1993 | 1994 | } |
---|
1994 | 1995 | } |
---|
| 1996 | + |
---|
1995 | 1997 | LoadOBJThread loadObjThread; |
---|
1996 | 1998 | |
---|
1997 | 1999 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
3207 | 3209 | { |
---|
3208 | 3210 | copy.remove(1); |
---|
3209 | 3211 | } |
---|
| 3212 | + |
---|
3210 | 3213 | ResetModel(); |
---|
3211 | 3214 | objEditor.refreshContents(); |
---|
3212 | 3215 | } |
---|
3213 | 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() == client) |
---|
| 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 | + |
---|
3214 | 3352 | void ImportGFD() |
---|
3215 | 3353 | { |
---|
3216 | 3354 | FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD); |
---|
.. | .. |
---|
3855 | 3993 | |
---|
3856 | 3994 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
3857 | 3995 | { |
---|
| 3996 | + Save(); |
---|
3858 | 3997 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
3859 | 3998 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
3860 | 3999 | // if (thing instanceof GenericJointDemo) |
---|