Normand Briere
2019-06-17 26b49d8e26625491f4a407a05e9bc9d72037f938
Object3D.java
....@@ -24,6 +24,11 @@
2424
2525 private UUID uuid = UUID.randomUUID();
2626
27
+ // TEMPORARY for mocap undo
28
+ mocap.reader.BVHReader.BVHResult bvh;
29
+ Object3D skeleton;
30
+ //
31
+
2732 ScriptNode scriptnode;
2833
2934 void InitOthers()
....@@ -104,117 +109,136 @@
104109
105110 // transient boolean reduced; // for morph reduction
106111
107
-transient com.bulletphysics.linearmath.Transform cache; // for fast merge
108
-transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge
112
+ transient com.bulletphysics.linearmath.Transform cache; // for fast merge
113
+ transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge
109114
110
-transient Object3D transientsupport; // for cloning
111
-transient boolean transientlink2master;
115
+ transient Object3D transientsupport; // for cloning
116
+ transient boolean transientlink2master;
112117
113
-void SaveSupports()
114
-{
115
- if (blockloop)
116
- return;
118
+ void SaveSupports()
119
+ {
120
+ if (blockloop)
121
+ return;
117122
118
- transientsupport = support;
119
- transientlink2master = link2master;
120
-
121
- support = null;
122
- link2master = false;
123
-
124
- if (bRep != null)
125
- {
126
- bRep.SaveSupports();
127
- }
128
-
129
- for (int i = 0; i < Size(); i++)
130
- {
131
- Object3D child = (Object3D) get(i);
132
- if (child == null)
133
- continue;
134
- blockloop = true;
135
- child.SaveSupports();
136
- blockloop = false;
137
- }
138
-}
123
+ transientsupport = support;
124
+ transientlink2master = link2master;
139125
140
-void RestoreSupports()
141
-{
142
- if (blockloop)
143
- return;
126
+ support = null;
127
+ link2master = false;
144128
145
- support = transientsupport;
146
- link2master = transientlink2master;
147
- transientsupport = null;
148
- transientlink2master = false;
149
-
150
- if (bRep != null)
151
- {
152
- bRep.RestoreSupports();
153
- }
154
-
155
- for (int i = 0; i < Size(); i++)
156
- {
157
- Object3D child = (Object3D) get(i);
158
- if (child == null)
159
- continue;
160
- blockloop = true;
161
- child.RestoreSupports();
162
- blockloop = false;
163
- }
164
-}
129
+ if (bRep != null)
130
+ {
131
+ bRep.SaveSupports();
132
+ }
165133
166
-void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
167
-{
168
- if (hashtable.containsKey(GetUUID()))
169
- return;
170
-
171
- Object3D o = new Object3D();
172
- o.bRep = this.bRep;
173
- if (this.bRep != null)
174
- {
175
- o.transientrep = this.bRep.support;
176
- o.bRep.support = null;
134
+ for (int i = 0; i < Size(); i++)
135
+ {
136
+ Object3D child = (Object3D) get(i);
137
+ if (child == null)
138
+ continue;
139
+ blockloop = true;
140
+ child.SaveSupports();
141
+ blockloop = false;
142
+ }
177143 }
178
-
179
-// o.support = this.support;
180
-// o.fileparent = this.fileparent;
181
-// if (this.bRep != null)
182
-// o.bRep = this.bRep.support;
183
-
184
- hashtable.put(GetUUID(), o);
185
-
186
- this.bRep = null;
187
-// if (this.bRep != null)
188
-// this.bRep.support = null;
189
-// this.support = null;
190
-// this.fileparent = null;
191
-
192
- for (int i=0; i<Size(); i++)
193
- {
194
- get(i).ExtractBigData(hashtable);
195
- }
196
-}
197144
198
-void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
199
-{
200
- if (!hashtable.containsKey(GetUUID()))
201
- return;
202
-
203
- Object3D o = hashtable.get(GetUUID());
204
-
205
- this.bRep = o.bRep;
206
- if (this.bRep != null)
207
- this.bRep.support = o.transientrep;
208
-// this.support = o.support;
209
-// this.fileparent = o.fileparent;
210
-
211
- hashtable.remove(GetUUID());
212
-
213
- for (int i=0; i<Size(); i++)
145
+ void RestoreSupports()
214146 {
215
- get(i).RestoreBigData(hashtable);
147
+ if (blockloop)
148
+ return;
149
+
150
+ support = transientsupport;
151
+ link2master = transientlink2master;
152
+ transientsupport = null;
153
+ transientlink2master = false;
154
+
155
+ if (bRep != null)
156
+ {
157
+ bRep.RestoreSupports();
158
+ }
159
+
160
+ for (int i = 0; i < Size(); i++)
161
+ {
162
+ Object3D child = (Object3D) get(i);
163
+ if (child == null)
164
+ continue;
165
+ blockloop = true;
166
+ child.RestoreSupports();
167
+ blockloop = false;
168
+ }
216169 }
217
-}
170
+
171
+ void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172
+ {
173
+ if (hashtable.containsKey(GetUUID()))
174
+ {
175
+ Object3D o = hashtable.get(GetUUID());
176
+
177
+ Grafreed.Assert(this.bRep == o.bRep);
178
+ if (this.bRep != null)
179
+ assert(this.bRep.support == o.transientrep);
180
+
181
+ return;
182
+ }
183
+
184
+ Object3D o = new Object3D();
185
+
186
+ hashtable.put(GetUUID(), o);
187
+
188
+ for (int i=0; i<Size(); i++)
189
+ {
190
+ get(i).ExtractBigData(hashtable);
191
+ }
192
+
193
+ ExtractBigData(o);
194
+ }
195
+
196
+ void ExtractBigData(Object3D o)
197
+ {
198
+ o.bRep = this.bRep;
199
+ if (this.bRep != null)
200
+ {
201
+ o.transientrep = this.bRep.support;
202
+ o.bRep.support = null;
203
+ }
204
+
205
+ // o.support = this.support;
206
+ // o.fileparent = this.fileparent;
207
+ // if (this.bRep != null)
208
+ // o.bRep = this.bRep.support;
209
+
210
+ this.bRep = null;
211
+ // if (this.bRep != null)
212
+ // this.bRep.support = null;
213
+ // this.support = null;
214
+ // this.fileparent = null;
215
+ }
216
+
217
+ void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
218
+ {
219
+ if (!hashtable.containsKey(GetUUID()))
220
+ return;
221
+
222
+ Object3D o = hashtable.get(GetUUID());
223
+
224
+ RestoreBigData(o);
225
+
226
+ hashtable.remove(GetUUID());
227
+
228
+ for (int i=0; i<Size(); i++)
229
+ {
230
+ get(i).RestoreBigData(hashtable);
231
+ }
232
+ }
233
+
234
+ void RestoreBigData(Object3D o)
235
+ {
236
+ this.bRep = o.bRep;
237
+ if (this.bRep != null)
238
+ this.bRep.support = o.transientrep;
239
+ // this.support = o.support;
240
+ // this.fileparent = o.fileparent;
241
+ }
218242
219243 // MOCAP SUPPORT
220244 double tx,ty,tz,rx,ry,rz;
....@@ -539,12 +563,14 @@
539563 toParent = LA.newMatrix();
540564 fromParent = LA.newMatrix();
541565 }
566
+
542567 if (toParentMarked == null)
543568 {
544569 if (maxcount != 1)
545570 {
546571 new Exception().printStackTrace();
547572 }
573
+
548574 toParentMarked = LA.newMatrix();
549575 fromParentMarked = LA.newMatrix();
550576 }
....@@ -2685,6 +2711,18 @@
26852711 //Touch();
26862712 }
26872713
2714
+ void GenNormalsMeshS()
2715
+ {
2716
+ selection.GenNormalsMesh();
2717
+// for (int i=0; i<selection.size(); i++)
2718
+// {
2719
+// Object3D selectee = (Object3D) selection.elementAt(i);
2720
+// selectee.GenNormals(crease);
2721
+// }
2722
+
2723
+ //Touch();
2724
+ }
2725
+
26882726 void ClearColorsS()
26892727 {
26902728 selection.ClearColors();
....@@ -2816,6 +2854,24 @@
28162854 if (child == null)
28172855 continue;
28182856 child.GenNormals(crease);
2857
+// Children().release(i);
2858
+ }
2859
+ blockloop = false;
2860
+ }
2861
+
2862
+ void GenNormalsMesh()
2863
+ {
2864
+ if (blockloop)
2865
+ return;
2866
+
2867
+ blockloop = true;
2868
+ GenNormalsMesh0();
2869
+ for (int i = 0; i < Children().Size(); i++)
2870
+ {
2871
+ Object3D child = (Object3D) Children().get(i); // reserve(i);
2872
+ if (child == null)
2873
+ continue;
2874
+ child.GenNormalsMesh();
28192875 // Children().release(i);
28202876 }
28212877 blockloop = false;
....@@ -2984,6 +3040,15 @@
29843040 if (bRep != null)
29853041 {
29863042 bRep.GenerateNormals(crease);
3043
+ Touch();
3044
+ }
3045
+ }
3046
+
3047
+ void GenNormalsMesh0()
3048
+ {
3049
+ if (bRep != null)
3050
+ {
3051
+ bRep.GenerateNormalsMesh();
29873052 Touch();
29883053 }
29893054 }
....@@ -5509,12 +5574,23 @@
55095574 boolean NeedSupport()
55105575 {
55115576 return
5512
- CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null
5577
+ CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null
55135578 // PROBLEM with CROWD!!
55145579 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD);
55155580 }
55165581
55175582 static boolean DEBUG_SELECTION = false;
5583
+
5584
+ boolean IsLive()
5585
+ {
5586
+ if (live)
5587
+ return true;
5588
+
5589
+ if (parent == null)
5590
+ return false;
5591
+
5592
+ return parent.IsLive();
5593
+ }
55185594
55195595 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked)
55205596 {
....@@ -5577,7 +5653,7 @@
55775653 support = support;
55785654
55795655 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5580
- boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5656
+ boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
55815657
55825658 if (!usecalllists && bRep != null && bRep.displaylist > 0)
55835659 {
....@@ -5597,10 +5673,12 @@
55975673 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
55985674
55995675 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5600
- (touched || (bRep != null && bRep.displaylist <= 0)))
5676
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5677
+ (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
56015678 {
56025679 Globals.lighttouched = true;
56035680 } // all panes...
5681
+
56045682 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56055683 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56065684 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -7026,7 +7104,7 @@
70267104 spot.translate(32, 32);
70277105 spotw = spot.x + spot.width;
70287106 spoth = spot.y + spot.height;
7029
- info.g.setColor(Color.blue);
7107
+ info.g.setColor(Color.cyan);
70307108 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
70317109 // if (CameraPane.Xmin > spot.x)
70327110 // {
....@@ -7044,11 +7122,12 @@
70447122 // {
70457123 // CameraPane.Ymax = spoth;
70467124 // }
7047
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7048
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7125
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7126
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
70497127 spot.translate(0, -32);
7050
- info.g.setColor(Color.green);
7128
+ info.g.setColor(Color.yellow);
70517129 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7130
+ info.g.setColor(Color.green);
70527131 // if (CameraPane.Xmin > spot.x)
70537132 // {
70547133 // CameraPane.Xmin = spot.x;
....@@ -7366,19 +7445,20 @@
73667445 switch (info.pane.RenderCamera().viewCode)
73677446 {
73687447 case 3: // '\001'
7369
- if (modified)
7448
+ if (modified || opposite)
73707449 {
73717450 //LA.matScale(toParent, 1, hScale, vScale);
73727451 LA.matScale(toParent, totalScale, 1, 1);
73737452 } // vScale, 1);
73747453 else
73757454 {
7455
+ // EXCEPTION!
73767456 LA.matScale(toParent, totalScale, totalScale, totalScale);
73777457 } // vScale, 1);
73787458 break;
73797459
73807460 case 2: // '\002'
7381
- if (modified)
7461
+ if (modified || opposite)
73827462 {
73837463 //LA.matScale(toParent, hScale, 1, vScale);
73847464 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7389,7 +7469,7 @@
73897469 break;
73907470
73917471 case 1: // '\003'
7392
- if (modified)
7472
+ if (modified || opposite)
73937473 {
73947474 //LA.matScale(toParent, hScale, vScale, 1);
73957475 LA.matScale(toParent, 1, 1, totalScale);