Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
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[] = new byte[100][];
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 }
....@@ -881,7 +926,7 @@
881926
882927 if (marked && Globals.isLIVE() && live &&
883928 //TEMP21aug2018
884
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
929
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
885930 currentframe != Globals.framecount)
886931 {
887932 currentframe = Globals.framecount;
....@@ -966,6 +1011,7 @@
9661011 if (material == null || material.multiply)
9671012 return true;
9681013
1014
+ // Transparent objects are dynamic because we have to sort the triangles.
9691015 return material.opacity > 0.99;
9701016 }
9711017
....@@ -1366,6 +1412,7 @@
13661412 toParent = LA.newMatrix();
13671413 fromParent = LA.newMatrix();
13681414 }
1415
+
13691416 LA.matCopy(other.toParent, toParent);
13701417 LA.matCopy(other.fromParent, fromParent);
13711418
....@@ -2387,6 +2434,10 @@
23872434 }
23882435 */
23892436 }
2437
+ else
2438
+ {
2439
+ //((ObjEditor)editWindow).SetupUI2(null);
2440
+ }
23902441 }
23912442
23922443 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2428,6 +2479,14 @@
24282479 {
24292480 editWindow.refreshContents();
24302481 }
2482
+ else
2483
+ {
2484
+ if (manipWindow != null)
2485
+ {
2486
+ manipWindow.refreshContents();
2487
+ }
2488
+ }
2489
+
24312490 //if (parent != null)
24322491 //parent.refreshEditWindow();
24332492 }
....@@ -4958,6 +5017,14 @@
49585017 }
49595018 }
49605019
5020
+ ObjEditor GetWindow()
5021
+ {
5022
+ if (editWindow != null)
5023
+ return editWindow;
5024
+
5025
+ return manipWindow;
5026
+ }
5027
+
49615028 cTreePath Select(int indexcount, boolean deselect)
49625029 {
49635030 if (hide || dontselect)
....@@ -4994,10 +5061,11 @@
49945061 if (leaf != null)
49955062 {
49965063 cTreePath tp = new cTreePath(this, leaf);
4997
- if (editWindow != null)
5064
+ ObjEditor window = GetWindow();
5065
+ if (window != null)
49985066 {
49995067 //System.out.println("editWindow = " + editWindow + " vs " + this);
5000
- editWindow.Select(tp, deselect, true);
5068
+ window.Select(tp, deselect, true);
50015069 }
50025070
50035071 return tp;
....@@ -5014,6 +5082,7 @@
50145082
50155083 if (child == null)
50165084 continue;
5085
+
50175086 if (child.HasTransparency() && child.size() != 0)
50185087 {
50195088 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -5023,9 +5092,10 @@
50235092 if (leaf != null)
50245093 {
50255094 cTreePath tp = new cTreePath(this, leaf);
5026
- if (editWindow != null)
5095
+ ObjEditor window = GetWindow();
5096
+ if (window != null)
50275097 {
5028
- editWindow.Select(tp, deselect, true);
5098
+ window.Select(tp, deselect, true);
50295099 }
50305100
50315101 return tp;
....@@ -5746,7 +5816,7 @@
57465816 support = support;
57475817
57485818 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5749
- boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5819
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
57505820
57515821 if (!usecalllists && bRep != null && bRep.displaylist > 0)
57525822 {
....@@ -5767,7 +5837,7 @@
57675837
57685838 if (!selectmode && //display.DrawMode() != display.SELECTION &&
57695839 //(touched || (bRep != null && bRep.displaylist <= 0)))
5770
- (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
5840
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
57715841 {
57725842 Globals.lighttouched = true;
57735843 } // all panes...
....@@ -5899,6 +5969,7 @@
58995969 if (GetBRep() != null)
59005970 {
59015971 display.NextIndex();
5972
+
59025973 // vertex color conflict : gl.glCallList(list);
59035974 DrawNode(display, root, selected);
59045975 if (this instanceof BezierPatch)
....@@ -6359,6 +6430,11 @@
63596430 // dec 2012
63606431 new Exception().printStackTrace();
63616432 return;
6433
+ }
6434
+
6435
+ if (dontselect)
6436
+ {
6437
+ //bRep.GenerateNormalsMINE();
63626438 }
63636439
63646440 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7251,8 +7327,8 @@
72517327 // {
72527328 // CameraPane.Ymax = spoth;
72537329 // }
7254
- info.g.drawArc(boundary.x, boundary.y,
7255
- boundary.width, boundary.height, 0, 360);
7330
+ info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY,
7331
+ (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360);
72567332 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
72577333 // if (CameraPane.Xmin > boundary.x)
72587334 // {
....@@ -7796,6 +7872,10 @@
77967872 editWindow = null;
77977873 } // ?
77987874 }
7875
+ else
7876
+ {
7877
+ //editWindow.closeUI();
7878
+ }
77997879 }
78007880
78017881 boolean root; // patch for edit windows
....@@ -7953,6 +8033,10 @@
79538033 }
79548034
79558035 transient ObjEditor editWindow;
8036
+ transient ObjEditor manipWindow;
8037
+
8038
+ transient boolean pinned;
8039
+
79568040 transient ObjectUI objectUI;
79578041 public static int povDepth = 0;
79588042 private static cVector tbMin = new cVector();