.. | .. |
---|
24 | 24 | |
---|
25 | 25 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 26 | |
---|
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; |
---|
30 | 30 | // |
---|
31 | 31 | |
---|
32 | 32 | ScriptNode scriptnode; |
---|
.. | .. |
---|
170 | 170 | |
---|
171 | 171 | void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
172 | 172 | { |
---|
| 173 | + Object3D o; |
---|
| 174 | + |
---|
173 | 175 | if (hashtable.containsKey(GetUUID())) |
---|
174 | 176 | { |
---|
175 | | - Object3D o = hashtable.get(GetUUID()); |
---|
| 177 | + o = hashtable.get(GetUUID()); |
---|
176 | 178 | |
---|
177 | 179 | Grafreed.Assert(this.bRep == o.bRep); |
---|
178 | | - if (this.bRep != null) |
---|
179 | | - assert(this.bRep.support == o.transientrep); |
---|
| 180 | + //if (this.bRep != null) |
---|
| 181 | + // assert(this.bRep.support == o.transientrep); |
---|
| 182 | + if (this.support != null) |
---|
| 183 | + assert(this.support.bRep == o.transientrep); |
---|
| 184 | + } |
---|
| 185 | + else |
---|
| 186 | + { |
---|
| 187 | + o = new Object3D("copy of " + this.name); |
---|
180 | 188 | |
---|
181 | | - return; |
---|
| 189 | + hashtable.put(GetUUID(), o); |
---|
182 | 190 | } |
---|
183 | 191 | |
---|
184 | | - Object3D o = new Object3D(); |
---|
185 | | - |
---|
186 | | - hashtable.put(GetUUID(), o); |
---|
187 | | - |
---|
188 | | - for (int i=0; i<Size(); i++) |
---|
| 192 | + if (!blockloop) |
---|
189 | 193 | { |
---|
190 | | - get(i).ExtractBigData(hashtable); |
---|
| 194 | + blockloop = true; |
---|
| 195 | + |
---|
| 196 | + for (int i=0; i<Size(); i++) |
---|
| 197 | + { |
---|
| 198 | + get(i).ExtractBigData(hashtable); |
---|
| 199 | + } |
---|
| 200 | + |
---|
| 201 | + blockloop = false; |
---|
191 | 202 | } |
---|
192 | 203 | |
---|
193 | 204 | ExtractBigData(o); |
---|
.. | .. |
---|
195 | 206 | |
---|
196 | 207 | void ExtractBigData(Object3D o) |
---|
197 | 208 | { |
---|
| 209 | + if (o.bRep != null) |
---|
| 210 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 211 | + |
---|
198 | 212 | o.bRep = this.bRep; |
---|
199 | | - if (this.bRep != null) |
---|
| 213 | +// July 2019 if (this.bRep != null) |
---|
| 214 | +// { |
---|
| 215 | +// o.transientrep = this.bRep.support; |
---|
| 216 | +// o.bRep.support = null; |
---|
| 217 | +// } |
---|
| 218 | + |
---|
| 219 | + if (this.support != null) |
---|
200 | 220 | { |
---|
201 | | - o.transientrep = this.bRep.support; |
---|
202 | | - o.bRep.support = null; |
---|
| 221 | + if (o.transientrep != null) |
---|
| 222 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 223 | + |
---|
| 224 | + o.transientrep = this.support.bRep; |
---|
| 225 | + this.support.bRep = null; |
---|
203 | 226 | } |
---|
204 | 227 | |
---|
205 | 228 | // o.support = this.support; |
---|
.. | .. |
---|
223 | 246 | |
---|
224 | 247 | RestoreBigData(o); |
---|
225 | 248 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 249 | + if (blockloop) |
---|
| 250 | + return; |
---|
| 251 | + |
---|
| 252 | + blockloop = true; |
---|
| 253 | + |
---|
| 254 | + //hashtable.remove(GetUUID()); |
---|
227 | 255 | |
---|
228 | 256 | for (int i=0; i<Size(); i++) |
---|
229 | 257 | { |
---|
230 | 258 | get(i).RestoreBigData(hashtable); |
---|
231 | 259 | } |
---|
| 260 | + |
---|
| 261 | + blockloop = false; |
---|
232 | 262 | } |
---|
233 | 263 | |
---|
234 | 264 | void RestoreBigData(Object3D o) |
---|
235 | 265 | { |
---|
236 | 266 | this.bRep = o.bRep; |
---|
237 | | - if (this.bRep != null) |
---|
238 | | - this.bRep.support = o.transientrep; |
---|
| 267 | + if (this.support != null && o.transientrep != null) |
---|
| 268 | + { |
---|
| 269 | + this.support.bRep = o.transientrep; |
---|
| 270 | + } |
---|
| 271 | +// July 2019 if (this.bRep != null) |
---|
| 272 | +// this.bRep.support = o.transientrep; |
---|
239 | 273 | // this.support = o.support; |
---|
240 | 274 | // this.fileparent = o.fileparent; |
---|
241 | 275 | } |
---|
.. | .. |
---|
881 | 915 | |
---|
882 | 916 | if (marked && Globals.isLIVE() && live && |
---|
883 | 917 | //TEMP21aug2018 |
---|
884 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 918 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
885 | 919 | currentframe != Globals.framecount) |
---|
886 | 920 | { |
---|
887 | 921 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
893 | 927 | |
---|
894 | 928 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
895 | 929 | |
---|
896 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 930 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 931 | + (step == 1 && changedir)) |
---|
897 | 932 | { |
---|
898 | 933 | countdown = 1; |
---|
899 | 934 | delay = speedup?8:1; |
---|
.. | .. |
---|
965 | 1000 | if (material == null || material.multiply) |
---|
966 | 1001 | return true; |
---|
967 | 1002 | |
---|
| 1003 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
968 | 1004 | return material.opacity > 0.99; |
---|
969 | 1005 | } |
---|
970 | 1006 | |
---|
.. | .. |
---|
1365 | 1401 | toParent = LA.newMatrix(); |
---|
1366 | 1402 | fromParent = LA.newMatrix(); |
---|
1367 | 1403 | } |
---|
| 1404 | + |
---|
1368 | 1405 | LA.matCopy(other.toParent, toParent); |
---|
1369 | 1406 | LA.matCopy(other.fromParent, fromParent); |
---|
1370 | 1407 | |
---|
.. | .. |
---|
2386 | 2423 | } |
---|
2387 | 2424 | */ |
---|
2388 | 2425 | } |
---|
| 2426 | + else |
---|
| 2427 | + { |
---|
| 2428 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2429 | + } |
---|
2389 | 2430 | } |
---|
2390 | 2431 | |
---|
2391 | 2432 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2427 | 2468 | { |
---|
2428 | 2469 | editWindow.refreshContents(); |
---|
2429 | 2470 | } |
---|
| 2471 | + else |
---|
| 2472 | + { |
---|
| 2473 | + if (manipWindow != null) |
---|
| 2474 | + { |
---|
| 2475 | + manipWindow.refreshContents(); |
---|
| 2476 | + } |
---|
| 2477 | + } |
---|
| 2478 | + |
---|
2430 | 2479 | //if (parent != null) |
---|
2431 | 2480 | //parent.refreshEditWindow(); |
---|
2432 | 2481 | } |
---|
.. | .. |
---|
3503 | 3552 | if (blockloop) |
---|
3504 | 3553 | return; |
---|
3505 | 3554 | |
---|
3506 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3555 | + if (//marked || // does not make sense |
---|
| 3556 | + (bRep != null || material != null)) // borderline... |
---|
3507 | 3557 | live = h; |
---|
3508 | 3558 | |
---|
3509 | 3559 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3524 | 3574 | return; |
---|
3525 | 3575 | |
---|
3526 | 3576 | //if (bRep != null) |
---|
3527 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3577 | + if (//marked || // does not make sense |
---|
| 3578 | + (bRep != null || material != null)) // borderline... |
---|
3528 | 3579 | link2master = h; |
---|
3529 | 3580 | |
---|
3530 | 3581 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3544 | 3595 | if (blockloop) |
---|
3545 | 3596 | return; |
---|
3546 | 3597 | |
---|
3547 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3598 | + if (//marked || // does not make sense |
---|
| 3599 | + (bRep != null || material != null)) // borderline... |
---|
3548 | 3600 | hide = h; |
---|
3549 | 3601 | |
---|
3550 | 3602 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3564 | 3616 | if (blockloop) |
---|
3565 | 3617 | return; |
---|
3566 | 3618 | |
---|
3567 | | - if (bRep != null && material != null) // borderline... |
---|
| 3619 | + if (bRep != null || material != null) // borderline... |
---|
3568 | 3620 | marked = h; |
---|
3569 | 3621 | |
---|
3570 | 3622 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3574 | 3626 | continue; |
---|
3575 | 3627 | blockloop = true; |
---|
3576 | 3628 | child.MarkLeaves(h); |
---|
| 3629 | + blockloop = false; |
---|
| 3630 | + // release(i); |
---|
| 3631 | + } |
---|
| 3632 | + } |
---|
| 3633 | + |
---|
| 3634 | + void RewindLeaves(boolean h) |
---|
| 3635 | + { |
---|
| 3636 | + if (blockloop) |
---|
| 3637 | + return; |
---|
| 3638 | + |
---|
| 3639 | + if (bRep != null || material != null) // borderline... |
---|
| 3640 | + rewind = h; |
---|
| 3641 | + |
---|
| 3642 | + for (int i = 0; i < Size(); i++) |
---|
| 3643 | + { |
---|
| 3644 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3645 | + if (child == null) |
---|
| 3646 | + continue; |
---|
| 3647 | + blockloop = true; |
---|
| 3648 | + child.RewindLeaves(h); |
---|
| 3649 | + blockloop = false; |
---|
| 3650 | + // release(i); |
---|
| 3651 | + } |
---|
| 3652 | + } |
---|
| 3653 | + |
---|
| 3654 | + void RandomLeaves(boolean h) |
---|
| 3655 | + { |
---|
| 3656 | + if (blockloop) |
---|
| 3657 | + return; |
---|
| 3658 | + |
---|
| 3659 | + if (bRep != null || material != null) // borderline... |
---|
| 3660 | + random = h; |
---|
| 3661 | + |
---|
| 3662 | + for (int i = 0; i < Size(); i++) |
---|
| 3663 | + { |
---|
| 3664 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3665 | + if (child == null) |
---|
| 3666 | + continue; |
---|
| 3667 | + blockloop = true; |
---|
| 3668 | + child.RandomLeaves(h); |
---|
3577 | 3669 | blockloop = false; |
---|
3578 | 3670 | // release(i); |
---|
3579 | 3671 | } |
---|
.. | .. |
---|
4351 | 4443 | } |
---|
4352 | 4444 | } |
---|
4353 | 4445 | |
---|
| 4446 | + void RepairSOV() |
---|
| 4447 | + { |
---|
| 4448 | + if (blockloop) |
---|
| 4449 | + return; |
---|
| 4450 | + |
---|
| 4451 | + String texname = this.GetPigmentTexture(); |
---|
| 4452 | + |
---|
| 4453 | + if (texname.startsWith("sov")) |
---|
| 4454 | + { |
---|
| 4455 | + String[] s = texname.split("/"); |
---|
| 4456 | + |
---|
| 4457 | + String[] sname = s[1].split("Color.pn"); |
---|
| 4458 | + |
---|
| 4459 | + texname = sname[0]; |
---|
| 4460 | + |
---|
| 4461 | + if (sname.length > 1) |
---|
| 4462 | + { |
---|
| 4463 | + texname += "Color.jpg"; |
---|
| 4464 | + } |
---|
| 4465 | + |
---|
| 4466 | + this.SetPigmentTexture("sov/" + texname); |
---|
| 4467 | + } |
---|
| 4468 | + |
---|
| 4469 | + texname = this.GetBumpTexture(); |
---|
| 4470 | + |
---|
| 4471 | + if (texname.startsWith("sov")) |
---|
| 4472 | + { |
---|
| 4473 | + String[] s = texname.split("/"); |
---|
| 4474 | + |
---|
| 4475 | + String[] sname = s[1].split("Bump.pn"); |
---|
| 4476 | + |
---|
| 4477 | + texname = sname[0]; |
---|
| 4478 | + |
---|
| 4479 | + if (sname.length > 1) |
---|
| 4480 | + { |
---|
| 4481 | + texname += "Bump.jpg"; |
---|
| 4482 | + } |
---|
| 4483 | + |
---|
| 4484 | + this.SetBumpTexture("sov/" + texname); |
---|
| 4485 | + } |
---|
| 4486 | + |
---|
| 4487 | + for (int i=0; i<Size(); i++) |
---|
| 4488 | + { |
---|
| 4489 | + blockloop = true; |
---|
| 4490 | + get(i).RepairSOV(); |
---|
| 4491 | + blockloop = false; |
---|
| 4492 | + } |
---|
| 4493 | + } |
---|
| 4494 | + |
---|
4354 | 4495 | void RepairTexture() |
---|
4355 | 4496 | { |
---|
4356 | 4497 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4865 | 5006 | } |
---|
4866 | 5007 | } |
---|
4867 | 5008 | |
---|
| 5009 | + ObjEditor GetWindow() |
---|
| 5010 | + { |
---|
| 5011 | + if (editWindow != null) |
---|
| 5012 | + return editWindow; |
---|
| 5013 | + |
---|
| 5014 | + return manipWindow; |
---|
| 5015 | + } |
---|
| 5016 | + |
---|
4868 | 5017 | cTreePath Select(int indexcount, boolean deselect) |
---|
4869 | 5018 | { |
---|
4870 | 5019 | if (hide || dontselect) |
---|
.. | .. |
---|
4901 | 5050 | if (leaf != null) |
---|
4902 | 5051 | { |
---|
4903 | 5052 | cTreePath tp = new cTreePath(this, leaf); |
---|
4904 | | - if (editWindow != null) |
---|
| 5053 | + ObjEditor window = GetWindow(); |
---|
| 5054 | + if (window != null) |
---|
4905 | 5055 | { |
---|
4906 | 5056 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4907 | | - editWindow.Select(tp, deselect, true); |
---|
| 5057 | + window.Select(tp, deselect, true); |
---|
4908 | 5058 | } |
---|
4909 | 5059 | |
---|
4910 | 5060 | return tp; |
---|
.. | .. |
---|
4921 | 5071 | |
---|
4922 | 5072 | if (child == null) |
---|
4923 | 5073 | continue; |
---|
| 5074 | + |
---|
4924 | 5075 | if (child.HasTransparency() && child.size() != 0) |
---|
4925 | 5076 | { |
---|
4926 | 5077 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4930 | 5081 | if (leaf != null) |
---|
4931 | 5082 | { |
---|
4932 | 5083 | cTreePath tp = new cTreePath(this, leaf); |
---|
4933 | | - if (editWindow != null) |
---|
| 5084 | + ObjEditor window = GetWindow(); |
---|
| 5085 | + if (window != null) |
---|
4934 | 5086 | { |
---|
4935 | | - editWindow.Select(tp, deselect, true); |
---|
| 5087 | + window.Select(tp, deselect, true); |
---|
4936 | 5088 | } |
---|
4937 | 5089 | |
---|
4938 | 5090 | return tp; |
---|
.. | .. |
---|
5653 | 5805 | support = support; |
---|
5654 | 5806 | |
---|
5655 | 5807 | //boolean usecalllists = 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); |
---|
| 5808 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5657 | 5809 | |
---|
5658 | 5810 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5659 | 5811 | { |
---|
.. | .. |
---|
5674 | 5826 | |
---|
5675 | 5827 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5676 | 5828 | //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5677 | | - (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
| 5829 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5678 | 5830 | { |
---|
5679 | 5831 | Globals.lighttouched = true; |
---|
5680 | 5832 | } // all panes... |
---|
.. | .. |
---|
5806 | 5958 | if (GetBRep() != null) |
---|
5807 | 5959 | { |
---|
5808 | 5960 | display.NextIndex(); |
---|
| 5961 | + |
---|
5809 | 5962 | // vertex color conflict : gl.glCallList(list); |
---|
5810 | 5963 | DrawNode(display, root, selected); |
---|
5811 | 5964 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
5846 | 5999 | tex = GetTextures(); |
---|
5847 | 6000 | } |
---|
5848 | 6001 | |
---|
5849 | | - boolean failed = false; |
---|
| 6002 | + boolean failedPigment = false; |
---|
| 6003 | + boolean failedBump = false; |
---|
5850 | 6004 | |
---|
5851 | 6005 | try |
---|
5852 | 6006 | { |
---|
5853 | | - display.BindTextures(tex, texres); |
---|
| 6007 | + display.BindPigmentTexture(tex, texres); |
---|
5854 | 6008 | } |
---|
5855 | 6009 | catch (Exception e) |
---|
5856 | 6010 | { |
---|
5857 | 6011 | System.err.println("FAILED: " + this); |
---|
5858 | | - failed = true; |
---|
| 6012 | + failedPigment = true; |
---|
| 6013 | + } |
---|
| 6014 | + |
---|
| 6015 | + try |
---|
| 6016 | + { |
---|
| 6017 | + display.BindBumpTexture(tex, texres); |
---|
| 6018 | + } |
---|
| 6019 | + catch (Exception e) |
---|
| 6020 | + { |
---|
| 6021 | + //System.err.println("FAILED: " + this); |
---|
| 6022 | + failedBump = true; |
---|
5859 | 6023 | } |
---|
5860 | 6024 | |
---|
5861 | 6025 | if (!compiled) |
---|
.. | .. |
---|
5878 | 6042 | } |
---|
5879 | 6043 | } |
---|
5880 | 6044 | |
---|
5881 | | - if (!failed) |
---|
5882 | | - display.ReleaseTextures(tex); |
---|
| 6045 | + if (!failedBump) |
---|
| 6046 | + display.ReleaseBumpTexture(tex); |
---|
| 6047 | + |
---|
| 6048 | + if (!failedPigment) |
---|
| 6049 | + display.ReleasePigmentTexture(tex); |
---|
5883 | 6050 | |
---|
5884 | 6051 | display.PopMaterial(this, selected); |
---|
5885 | 6052 | } |
---|
.. | .. |
---|
6252 | 6419 | // dec 2012 |
---|
6253 | 6420 | new Exception().printStackTrace(); |
---|
6254 | 6421 | return; |
---|
| 6422 | + } |
---|
| 6423 | + |
---|
| 6424 | + if (dontselect) |
---|
| 6425 | + { |
---|
| 6426 | + //bRep.GenerateNormalsMINE(); |
---|
6255 | 6427 | } |
---|
6256 | 6428 | |
---|
6257 | 6429 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7144 | 7316 | // { |
---|
7145 | 7317 | // CameraPane.Ymax = spoth; |
---|
7146 | 7318 | // } |
---|
7147 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7148 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7319 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7320 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
7149 | 7321 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7150 | 7322 | // if (CameraPane.Xmin > boundary.x) |
---|
7151 | 7323 | // { |
---|
.. | .. |
---|
7452 | 7624 | } // vScale, 1); |
---|
7453 | 7625 | else |
---|
7454 | 7626 | { |
---|
7455 | | - LA.matScale(toParent, 1, totalScale, totalScale); |
---|
| 7627 | + // EXCEPTION! |
---|
| 7628 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7456 | 7629 | } // vScale, 1); |
---|
7457 | 7630 | break; |
---|
7458 | 7631 | |
---|
.. | .. |
---|
7688 | 7861 | editWindow = null; |
---|
7689 | 7862 | } // ? |
---|
7690 | 7863 | } |
---|
| 7864 | + else |
---|
| 7865 | + { |
---|
| 7866 | + //editWindow.closeUI(); |
---|
| 7867 | + } |
---|
7691 | 7868 | } |
---|
7692 | 7869 | |
---|
7693 | 7870 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7845 | 8022 | } |
---|
7846 | 8023 | |
---|
7847 | 8024 | transient ObjEditor editWindow; |
---|
| 8025 | + transient ObjEditor manipWindow; |
---|
| 8026 | + |
---|
| 8027 | + transient boolean pinned; |
---|
| 8028 | + |
---|
7848 | 8029 | transient ObjectUI objectUI; |
---|
7849 | 8030 | public static int povDepth = 0; |
---|
7850 | 8031 | private static cVector tbMin = new cVector(); |
---|