Normand Briere
2019-07-23 0f4fa9dc4191aaee9661c1e6d73725436ae64ac2
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("copy of " + this.name);
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;
....@@ -219,14 +248,14 @@
219248 if (!hashtable.containsKey(GetUUID()))
220249 return;
221250
251
+ Object3D o = hashtable.get(GetUUID());
252
+
253
+ RestoreBigData(o);
254
+
222255 if (blockloop)
223256 return;
224257
225258 blockloop = true;
226
-
227
- Object3D o = hashtable.get(GetUUID());
228
-
229
- RestoreBigData(o);
230259
231260 //hashtable.remove(GetUUID());
232261
....@@ -241,8 +270,17 @@
241270 void RestoreBigData(Object3D o)
242271 {
243272 this.bRep = o.bRep;
244
- if (this.bRep != null)
245
- 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;
246284 // this.support = o.support;
247285 // this.fileparent = o.fileparent;
248286 }
....@@ -388,6 +426,7 @@
388426 }
389427
390428 boolean live = false;
429
+ transient boolean keepdontselect;
391430 boolean dontselect = false;
392431 boolean hide = false;
393432 boolean link2master = false; // performs reset support/master at each frame
....@@ -1374,6 +1413,7 @@
13741413 toParent = LA.newMatrix();
13751414 fromParent = LA.newMatrix();
13761415 }
1416
+
13771417 LA.matCopy(other.toParent, toParent);
13781418 LA.matCopy(other.fromParent, fromParent);
13791419
....@@ -3078,7 +3118,7 @@
30783118 {
30793119 if (bRep != null)
30803120 {
3081
- bRep.GenerateNormalsMINE();
3121
+ bRep.MergeNormals(); //.GenerateNormalsMINE();
30823122 Touch();
30833123 }
30843124 }
....@@ -5043,6 +5083,7 @@
50435083
50445084 if (child == null)
50455085 continue;
5086
+
50465087 if (child.HasTransparency() && child.size() != 0)
50475088 {
50485089 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -5380,6 +5421,51 @@
53805421 blockloop = false;
53815422 }
53825423
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();
5464
+ }
5465
+
5466
+ blockloop = false;
5467
+ }
5468
+
53835469 boolean IsSelected()
53845470 {
53855471 if (parent == null)
....@@ -5689,6 +5775,38 @@
56895775 }
56905776 }
56915777
5778
+ void EmbedTextures(boolean embed)
5779
+ {
5780
+ if (blockloop)
5781
+ return;
5782
+
5783
+ //if (GetTextures() != null)
5784
+ if (embed)
5785
+ CameraPane.EmbedTextures(GetTextures());
5786
+ else
5787
+ {
5788
+ GetTextures().pigmentdata = null;
5789
+ GetTextures().bumpdata = null;
5790
+ GetTextures().pw = 0;
5791
+ GetTextures().ph = 0;
5792
+ GetTextures().bw = 0;
5793
+ GetTextures().bh = 0;
5794
+ }
5795
+
5796
+ int nb = Size();
5797
+ for (int i = 0; i < nb; i++)
5798
+ {
5799
+ Object3D child = (Object3D) get(i);
5800
+
5801
+ if (child == null)
5802
+ continue;
5803
+
5804
+ blockloop = true;
5805
+ child.EmbedTextures(embed);
5806
+ blockloop = false;
5807
+ }
5808
+ }
5809
+
56925810 void draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
56935811 {
56945812 Draw(display, root, selected, blocked);
....@@ -5797,7 +5915,7 @@
57975915
57985916 if (!selectmode && //display.DrawMode() != display.SELECTION &&
57995917 //(touched || (bRep != null && bRep.displaylist <= 0)))
5800
- (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && (bRep != null && bRep.displaylist <= 0)))
5918
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
58015919 {
58025920 Globals.lighttouched = true;
58035921 } // all panes...
....@@ -5929,6 +6047,7 @@
59296047 if (GetBRep() != null)
59306048 {
59316049 display.NextIndex();
6050
+
59326051 // vertex color conflict : gl.glCallList(list);
59336052 DrawNode(display, root, selected);
59346053 if (this instanceof BezierPatch)
....@@ -7286,8 +7405,8 @@
72867405 // {
72877406 // CameraPane.Ymax = spoth;
72887407 // }
7289
- info.g.drawArc(boundary.x, boundary.y,
7290
- boundary.width, boundary.height, 0, 360);
7408
+ info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7409
+ (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
72917410 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
72927411 // if (CameraPane.Xmin > boundary.x)
72937412 // {
....@@ -7994,6 +8113,8 @@
79948113 transient ObjEditor editWindow;
79958114 transient ObjEditor manipWindow;
79968115
8116
+ transient boolean pinned;
8117
+
79978118 transient ObjectUI objectUI;
79988119 public static int povDepth = 0;
79998120 private static cVector tbMin = new cVector();