Normand Briere
2019-06-09 8558ae86e65457c512a26339d3660d79eee16ae6
Multi-tab undo.
5 files modified
148 ■■■■ changed files
CameraPane.java 2 ●●● patch | view | raw | blame | history
GroupEditor.java 10 ●●●●● patch | view | raw | blame | history
ObjEditor.java 92 ●●●●● patch | view | raw | blame | history
Object3D.java 41 ●●●●● patch | view | raw | blame | history
cRadio.java 3 ●●●●● patch | view | raw | blame | history
CameraPane.java
....@@ -11552,7 +11552,7 @@
1155211552 return;
1155311553 }
1155411554
11555
- String string = obj.GetToolTip();
11555
+ String string = obj.toString(); //.GetToolTip();
1155611556
1155711557 GL gl = GetGL();
1155811558
GroupEditor.java
....@@ -3041,7 +3041,7 @@
30413041 child.CloseUI();
30423042 listUI.remove(child);
30433043
3044
- child.editWindow = null; // ???????????
3044
+ //child.editWindow = null; // ???????????
30453045 }
30463046 objEditor.ctrlPanel.FlushUI();
30473047 //objEditor.jTree.clearSelection();
....@@ -4310,15 +4310,13 @@
43104310
43114311 objEditor.SetText(); // jan 2014
43124312
4313
- Object3D object = (Object3D) tps[0].getLastPathComponent();
4314
-
4315
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(object instanceof Camera))
4313
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43164314 CameraPane.flash = true;
43174315
4318
- if (tps != null && tps.length > 0 && object instanceof Camera)
4316
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43194317 // a camera
43204318 {
4321
- if (object != Globals.theRenderer.LightCamera())
4319
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
43224320 {
43234321 CameraPane.camerachangeframe = 0; // don't refuse it
43244322 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
ObjEditor.java
....@@ -1935,6 +1935,7 @@
19351935 e2.printStackTrace();
19361936 }
19371937 }
1938
+
19381939 LoadJMEThread loadThread;
19391940
19401941 class LoadJMEThread extends Thread
....@@ -1992,6 +1993,7 @@
19921993 //LoadFile0(filename, converter);
19931994 }
19941995 }
1996
+
19951997 LoadOBJThread loadObjThread;
19961998
19971999 class LoadOBJThread extends Thread
....@@ -3212,9 +3214,6 @@
32123214 objEditor.refreshContents();
32133215 }
32143216
3215
- Object3D graphs[] = new Object3D[10000];
3216
- int undoindex = 0;
3217
-
32183217 static public Object clone(Object o)
32193218 {
32203219 try
....@@ -3237,16 +3236,31 @@
32373236 }
32383237 }
32393238
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
+
32403254 public void Save()
32413255 {
3242
- if (true) return;
3256
+ cRadio tab = GetCurrentTab();
32433257
32443258 //EditorFrame.m_MainFrame.requestFocusInWindow();
3245
- graphs[undoindex++] = (Object3D)clone(copy);
3259
+ tab.graphs[tab.undoindex++] = (Object3D)clone(copy);
32463260
3247
- for (int i = undoindex; i < graphs.length; i++)
3261
+ for (int i = tab.undoindex; i < tab.graphs.length; i++)
32483262 {
3249
- graphs[i] = null;
3263
+ tab.graphs[i] = null;
32503264 }
32513265
32523266 // test save
....@@ -3254,7 +3268,7 @@
32543268 {
32553269 try
32563270 {
3257
- FileOutputStream ostream = new FileOutputStream("save" + undoindex);
3271
+ FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
32583272 ObjectOutputStream p = new ObjectOutputStream(ostream);
32593273
32603274 p.writeObject(copy);
....@@ -3269,48 +3283,70 @@
32693283 }
32703284 }
32713285
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
+
32723316 public void Undo()
32733317 {
3274
- if (undoindex == 0)
3318
+ cRadio tab = GetCurrentTab();
3319
+
3320
+ if (tab.undoindex == 0)
32753321 {
32763322 java.awt.Toolkit.getDefaultToolkit().beep();
32773323 return;
32783324 }
32793325
3280
- if (graphs[undoindex] == null)
3326
+ if (tab.graphs[tab.undoindex] == null)
32813327 {
32823328 Save();
3283
- undoindex -= 1;
3329
+ tab.undoindex -= 1;
32843330 }
32853331
3286
- undoindex -= 1;
3332
+ tab.undoindex -= 1;
32873333
3288
- copy = graphs[undoindex];
3289
-
3290
- cameraView.object = copy;
3291
- copy.Touch();
3292
-
3293
- ResetModel();
3294
- refreshContents();
3334
+ CopyChanged(tab.graphs[tab.undoindex]);
32953335 }
32963336
32973337 public void Redo()
32983338 {
3299
- if (graphs[undoindex + 1] == null)
3339
+ cRadio tab = GetCurrentTab();
3340
+
3341
+ if (tab.graphs[tab.undoindex + 1] == null)
33003342 {
33013343 java.awt.Toolkit.getDefaultToolkit().beep();
33023344 return;
33033345 }
33043346
3305
- undoindex += 1;
3347
+ tab.undoindex += 1;
33063348
3307
- copy = graphs[undoindex];
3308
-
3309
- cameraView.object = copy;
3310
- copy.Touch();
3311
-
3312
- ResetModel();
3313
- refreshContents();
3349
+ CopyChanged(tab.graphs[tab.undoindex]);
33143350 }
33153351
33163352 void ImportGFD()
Object3D.java
....@@ -14,11 +14,15 @@
1414 import //weka.core.
1515 matrix.Matrix;
1616
17
+import java.util.UUID;
18
+
1719 //import net.sourceforge.sizeof.SizeOf;
1820 public class Object3D extends Vector<Object3D> implements java.io.Serializable, iSendInfo //, aurelienribon.tweenengine.TweenAccessor<Object3D>
1921 {
2022 //static final long serialVersionUID = -607422624994562685L;
2123 static final long serialVersionUID = 5022536242724664900L;
24
+
25
+ private UUID uuid = UUID.randomUUID();
2226
2327 ScriptNode scriptnode;
2428
....@@ -5371,6 +5375,43 @@
53715375 }
53725376 }
53735377
5378
+ UUID GetUUID()
5379
+ {
5380
+ if (uuid == null)
5381
+ {
5382
+ // Serial
5383
+ uuid = UUID.randomUUID();
5384
+ }
5385
+
5386
+ return uuid;
5387
+ }
5388
+
5389
+ Object3D GetObject(UUID uid)
5390
+ {
5391
+ if (blockloop)
5392
+ return null;
5393
+
5394
+ if (GetUUID().equals(uid))
5395
+ return this;
5396
+
5397
+ int nb = Size();
5398
+ for (int i = 0; i < nb; i++)
5399
+ {
5400
+ Object3D child = (Object3D) get(i);
5401
+
5402
+ if (child == null)
5403
+ continue;
5404
+
5405
+ blockloop = true;
5406
+ Object3D obj = child.GetObject(uid);
5407
+ blockloop = false;
5408
+ if (obj != null)
5409
+ return obj;
5410
+ }
5411
+
5412
+ return null;
5413
+ }
5414
+
53745415 void SetBumpTexture(String tex)
53755416 {
53765417 if (GetTextures() == null)
cRadio.java
....@@ -35,6 +35,9 @@
3535 camera = (Camera)Grafreed.clone(c);
3636 }
3737
38
+ Object3D graphs[] = new Object3D[10000];
39
+ int undoindex = 0;
40
+
3841 Object3D object;
3942 Camera camera;
4043 cButton layout;