Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
Object3D.java
....@@ -24,11 +24,14 @@
2424
2525 private UUID uuid = UUID.randomUUID();
2626
27
- // TEMPORARY for mocap undo
28
- mocap.reader.BVHReader.BVHResult bvh;
29
- Object3D skeleton;
27
+ // TEMPORARY for mocap undo. No need to be transient.
28
+ mocap.reader.BVHReader.BVHResult savebvh;
29
+ Object3D saveskeleton;
3030 //
3131
32
+ byte[] versions[];
33
+ int versionindex = -1;
34
+
3235 ScriptNode scriptnode;
3336
3437 void InitOthers()
....@@ -170,24 +173,35 @@
170173
171174 void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172175 {
176
+ Object3D o;
177
+
173178 if (hashtable.containsKey(GetUUID()))
174179 {
175
- Object3D o = hashtable.get(GetUUID());
180
+ o = hashtable.get(GetUUID());
176181
177182 Grafreed.Assert(this.bRep == o.bRep);
178
- if (this.bRep != null)
179
- assert(this.bRep.support == o.transientrep);
183
+ //if (this.bRep != null)
184
+ // assert(this.bRep.support == o.transientrep);
185
+ if (this.support != null)
186
+ assert(this.support.bRep == o.transientrep);
187
+ }
188
+ else
189
+ {
190
+ o = new Object3D("copy of " + this.name);
180191
181
- return;
192
+ hashtable.put(GetUUID(), o);
182193 }
183194
184
- Object3D o = new Object3D();
185
-
186
- hashtable.put(GetUUID(), o);
187
-
188
- for (int i=0; i<Size(); i++)
195
+ if (!blockloop)
189196 {
190
- get(i).ExtractBigData(hashtable);
197
+ blockloop = true;
198
+
199
+ for (int i=0; i<Size(); i++)
200
+ {
201
+ get(i).ExtractBigData(hashtable);
202
+ }
203
+
204
+ blockloop = false;
191205 }
192206
193207 ExtractBigData(o);
....@@ -195,11 +209,26 @@
195209
196210 void ExtractBigData(Object3D o)
197211 {
212
+ if (o.bRep != null)
213
+ Grafreed.Assert(o.bRep == this.bRep);
214
+
198215 o.bRep = this.bRep;
199
- if (this.bRep != null)
216
+// July 2019 if (this.bRep != null)
217
+// {
218
+// o.transientrep = this.bRep.support;
219
+// o.bRep.support = null;
220
+// }
221
+ o.selection = this.selection;
222
+ o.versions = this.versions;
223
+ o.versionindex = this.versionindex;
224
+
225
+ if (this.support != null)
200226 {
201
- o.transientrep = this.bRep.support;
202
- o.bRep.support = null;
227
+ if (o.transientrep != null)
228
+ Grafreed.Assert(o.transientrep == this.support.bRep);
229
+
230
+ o.transientrep = this.support.bRep;
231
+ this.support.bRep = null;
203232 }
204233
205234 // o.support = this.support;
....@@ -223,19 +252,35 @@
223252
224253 RestoreBigData(o);
225254
226
- hashtable.remove(GetUUID());
255
+ if (blockloop)
256
+ return;
257
+
258
+ blockloop = true;
259
+
260
+ //hashtable.remove(GetUUID());
227261
228262 for (int i=0; i<Size(); i++)
229263 {
230264 get(i).RestoreBigData(hashtable);
231265 }
266
+
267
+ blockloop = false;
232268 }
233269
234270 void RestoreBigData(Object3D o)
235271 {
236272 this.bRep = o.bRep;
237
- if (this.bRep != null)
238
- this.bRep.support = o.transientrep;
273
+ if (this.support != null && o.transientrep != null)
274
+ {
275
+ this.support.bRep = o.transientrep;
276
+ }
277
+
278
+ this.selection = o.selection;
279
+
280
+ this.versions = o.versions;
281
+ this.versionindex = o.versionindex;
282
+// July 2019 if (this.bRep != null)
283
+// this.bRep.support = o.transientrep;
239284 // this.support = o.support;
240285 // this.fileparent = o.fileparent;
241286 }
....@@ -381,6 +426,7 @@
381426 }
382427
383428 boolean live = false;
429
+ transient boolean keepdontselect;
384430 boolean dontselect = false;
385431 boolean hide = false;
386432 boolean link2master = false; // performs reset support/master at each frame
....@@ -1367,6 +1413,7 @@
13671413 toParent = LA.newMatrix();
13681414 fromParent = LA.newMatrix();
13691415 }
1416
+
13701417 LA.matCopy(other.toParent, toParent);
13711418 LA.matCopy(other.fromParent, fromParent);
13721419
....@@ -2433,6 +2480,14 @@
24332480 {
24342481 editWindow.refreshContents();
24352482 }
2483
+ else
2484
+ {
2485
+ if (manipWindow != null)
2486
+ {
2487
+ manipWindow.refreshContents();
2488
+ }
2489
+ }
2490
+
24362491 //if (parent != null)
24372492 //parent.refreshEditWindow();
24382493 }
....@@ -3063,7 +3118,7 @@
30633118 {
30643119 if (bRep != null)
30653120 {
3066
- bRep.GenerateNormalsMINE();
3121
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30673122 Touch();
30683123 }
30693124 }
....@@ -4963,6 +5018,14 @@
49635018 }
49645019 }
49655020
5021
+ ObjEditor GetWindow()
5022
+ {
5023
+ if (editWindow != null)
5024
+ return editWindow;
5025
+
5026
+ return manipWindow;
5027
+ }
5028
+
49665029 cTreePath Select(int indexcount, boolean deselect)
49675030 {
49685031 if (hide || dontselect)
....@@ -4999,10 +5062,11 @@
49995062 if (leaf != null)
50005063 {
50015064 cTreePath tp = new cTreePath(this, leaf);
5002
- if (editWindow != null)
5065
+ ObjEditor window = GetWindow();
5066
+ if (window != null)
50035067 {
50045068 //System.out.println("editWindow = " + editWindow + " vs " + this);
5005
- editWindow.Select(tp, deselect, true);
5069
+ window.Select(tp, deselect, true);
50065070 }
50075071
50085072 return tp;
....@@ -5019,6 +5083,7 @@
50195083
50205084 if (child == null)
50215085 continue;
5086
+
50225087 if (child.HasTransparency() && child.size() != 0)
50235088 {
50245089 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -5028,9 +5093,10 @@
50285093 if (leaf != null)
50295094 {
50305095 cTreePath tp = new cTreePath(this, leaf);
5031
- if (editWindow != null)
5096
+ ObjEditor window = GetWindow();
5097
+ if (window != null)
50325098 {
5033
- editWindow.Select(tp, deselect, true);
5099
+ window.Select(tp, deselect, true);
50345100 }
50355101
50365102 return tp;
....@@ -5350,6 +5416,51 @@
53505416 continue;
53515417 child.ResetDisplayList();
53525418 // release(i);
5419
+ }
5420
+
5421
+ blockloop = false;
5422
+ }
5423
+
5424
+ void ResetSelectable()
5425
+ {
5426
+ if (blockloop)
5427
+ return;
5428
+
5429
+ blockloop = true;
5430
+
5431
+ keepdontselect = dontselect;
5432
+ dontselect = true;
5433
+
5434
+ Object3D child;
5435
+ int nb = Size();
5436
+ for (int i = 0; i < nb; i++)
5437
+ {
5438
+ child = (Object3D) get(i);
5439
+ if (child == null)
5440
+ continue;
5441
+ child.ResetSelectable();
5442
+ }
5443
+
5444
+ blockloop = false;
5445
+ }
5446
+
5447
+ void RestoreSelectable()
5448
+ {
5449
+ if (blockloop)
5450
+ return;
5451
+
5452
+ blockloop = true;
5453
+
5454
+ dontselect = keepdontselect;
5455
+
5456
+ Object3D child;
5457
+ int nb = Size();
5458
+ for (int i = 0; i < nb; i++)
5459
+ {
5460
+ child = (Object3D) get(i);
5461
+ if (child == null)
5462
+ continue;
5463
+ child.RestoreSelectable();
53535464 }
53545465
53555466 blockloop = false;
....@@ -5772,7 +5883,7 @@
57725883
57735884 if (!selectmode && //display.DrawMode() != display.SELECTION &&
57745885 //(touched || (bRep != null && bRep.displaylist <= 0)))
5775
- (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0)))
5886
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
57765887 {
57775888 Globals.lighttouched = true;
57785889 } // all panes...
....@@ -5904,6 +6015,7 @@
59046015 if (GetBRep() != null)
59056016 {
59066017 display.NextIndex();
6018
+
59076019 // vertex color conflict : gl.glCallList(list);
59086020 DrawNode(display, root, selected);
59096021 if (this instanceof BezierPatch)
....@@ -7261,8 +7373,8 @@
72617373 // {
72627374 // CameraPane.Ymax = spoth;
72637375 // }
7264
- info.g.drawArc(boundary.x, boundary.y,
7265
- boundary.width, boundary.height, 0, 360);
7376
+ info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7377
+ (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
72667378 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
72677379 // if (CameraPane.Xmin > boundary.x)
72687380 // {
....@@ -7967,6 +8079,10 @@
79678079 }
79688080
79698081 transient ObjEditor editWindow;
8082
+ transient ObjEditor manipWindow;
8083
+
8084
+ transient boolean pinned;
8085
+
79708086 transient ObjectUI objectUI;
79718087 public static int povDepth = 0;
79728088 private static cVector tbMin = new cVector();