.. | .. |
---|
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 | + byte[] versions[] = new byte[100][]; |
---|
| 33 | + int versionindex = -1; |
---|
| 34 | + |
---|
32 | 35 | ScriptNode scriptnode; |
---|
33 | 36 | |
---|
34 | 37 | void InitOthers() |
---|
.. | .. |
---|
170 | 173 | |
---|
171 | 174 | void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
172 | 175 | { |
---|
| 176 | + Object3D o; |
---|
| 177 | + |
---|
173 | 178 | if (hashtable.containsKey(GetUUID())) |
---|
174 | 179 | { |
---|
175 | | - Object3D o = hashtable.get(GetUUID()); |
---|
| 180 | + o = hashtable.get(GetUUID()); |
---|
176 | 181 | |
---|
177 | 182 | 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); |
---|
180 | 191 | |
---|
181 | | - return; |
---|
| 192 | + hashtable.put(GetUUID(), o); |
---|
182 | 193 | } |
---|
183 | 194 | |
---|
184 | | - Object3D o = new Object3D(); |
---|
185 | | - |
---|
186 | | - hashtable.put(GetUUID(), o); |
---|
187 | | - |
---|
188 | | - for (int i=0; i<Size(); i++) |
---|
| 195 | + if (!blockloop) |
---|
189 | 196 | { |
---|
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; |
---|
191 | 205 | } |
---|
192 | 206 | |
---|
193 | 207 | ExtractBigData(o); |
---|
.. | .. |
---|
195 | 209 | |
---|
196 | 210 | void ExtractBigData(Object3D o) |
---|
197 | 211 | { |
---|
| 212 | + if (o.bRep != null) |
---|
| 213 | + Grafreed.Assert(o.bRep == this.bRep); |
---|
| 214 | + |
---|
198 | 215 | 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) |
---|
200 | 226 | { |
---|
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; |
---|
203 | 232 | } |
---|
204 | 233 | |
---|
205 | 234 | // o.support = this.support; |
---|
.. | .. |
---|
223 | 252 | |
---|
224 | 253 | RestoreBigData(o); |
---|
225 | 254 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 255 | + if (blockloop) |
---|
| 256 | + return; |
---|
| 257 | + |
---|
| 258 | + blockloop = true; |
---|
| 259 | + |
---|
| 260 | + //hashtable.remove(GetUUID()); |
---|
227 | 261 | |
---|
228 | 262 | for (int i=0; i<Size(); i++) |
---|
229 | 263 | { |
---|
230 | 264 | get(i).RestoreBigData(hashtable); |
---|
231 | 265 | } |
---|
| 266 | + |
---|
| 267 | + blockloop = false; |
---|
232 | 268 | } |
---|
233 | 269 | |
---|
234 | 270 | void RestoreBigData(Object3D o) |
---|
235 | 271 | { |
---|
236 | 272 | 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; |
---|
239 | 284 | // this.support = o.support; |
---|
240 | 285 | // this.fileparent = o.fileparent; |
---|
241 | 286 | } |
---|
.. | .. |
---|
881 | 926 | |
---|
882 | 927 | if (marked && Globals.isLIVE() && live && |
---|
883 | 928 | //TEMP21aug2018 |
---|
884 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 929 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
885 | 930 | currentframe != Globals.framecount) |
---|
886 | 931 | { |
---|
887 | 932 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
893 | 938 | |
---|
894 | 939 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
895 | 940 | |
---|
896 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 941 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 942 | + (step == 1 && changedir)) |
---|
897 | 943 | { |
---|
898 | 944 | countdown = 1; |
---|
899 | 945 | delay = speedup?8:1; |
---|
.. | .. |
---|
965 | 1011 | if (material == null || material.multiply) |
---|
966 | 1012 | return true; |
---|
967 | 1013 | |
---|
| 1014 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
968 | 1015 | return material.opacity > 0.99; |
---|
969 | 1016 | } |
---|
970 | 1017 | |
---|
.. | .. |
---|
1365 | 1412 | toParent = LA.newMatrix(); |
---|
1366 | 1413 | fromParent = LA.newMatrix(); |
---|
1367 | 1414 | } |
---|
| 1415 | + |
---|
1368 | 1416 | LA.matCopy(other.toParent, toParent); |
---|
1369 | 1417 | LA.matCopy(other.fromParent, fromParent); |
---|
1370 | 1418 | |
---|
.. | .. |
---|
2386 | 2434 | } |
---|
2387 | 2435 | */ |
---|
2388 | 2436 | } |
---|
| 2437 | + else |
---|
| 2438 | + { |
---|
| 2439 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2440 | + } |
---|
2389 | 2441 | } |
---|
2390 | 2442 | |
---|
2391 | 2443 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2427 | 2479 | { |
---|
2428 | 2480 | editWindow.refreshContents(); |
---|
2429 | 2481 | } |
---|
| 2482 | + else |
---|
| 2483 | + { |
---|
| 2484 | + if (manipWindow != null) |
---|
| 2485 | + { |
---|
| 2486 | + manipWindow.refreshContents(); |
---|
| 2487 | + } |
---|
| 2488 | + } |
---|
| 2489 | + |
---|
2430 | 2490 | //if (parent != null) |
---|
2431 | 2491 | //parent.refreshEditWindow(); |
---|
2432 | 2492 | } |
---|
.. | .. |
---|
3503 | 3563 | if (blockloop) |
---|
3504 | 3564 | return; |
---|
3505 | 3565 | |
---|
3506 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3566 | + if (//marked || // does not make sense |
---|
| 3567 | + (bRep != null || material != null)) // borderline... |
---|
3507 | 3568 | live = h; |
---|
3508 | 3569 | |
---|
3509 | 3570 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3524 | 3585 | return; |
---|
3525 | 3586 | |
---|
3526 | 3587 | //if (bRep != null) |
---|
3527 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3588 | + if (//marked || // does not make sense |
---|
| 3589 | + (bRep != null || material != null)) // borderline... |
---|
3528 | 3590 | link2master = h; |
---|
3529 | 3591 | |
---|
3530 | 3592 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3544 | 3606 | if (blockloop) |
---|
3545 | 3607 | return; |
---|
3546 | 3608 | |
---|
3547 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3609 | + if (//marked || // does not make sense |
---|
| 3610 | + (bRep != null || material != null)) // borderline... |
---|
3548 | 3611 | hide = h; |
---|
3549 | 3612 | |
---|
3550 | 3613 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3564 | 3627 | if (blockloop) |
---|
3565 | 3628 | return; |
---|
3566 | 3629 | |
---|
3567 | | - if (bRep != null && material != null) // borderline... |
---|
| 3630 | + if (bRep != null || material != null) // borderline... |
---|
3568 | 3631 | marked = h; |
---|
3569 | 3632 | |
---|
3570 | 3633 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3574 | 3637 | continue; |
---|
3575 | 3638 | blockloop = true; |
---|
3576 | 3639 | child.MarkLeaves(h); |
---|
| 3640 | + blockloop = false; |
---|
| 3641 | + // release(i); |
---|
| 3642 | + } |
---|
| 3643 | + } |
---|
| 3644 | + |
---|
| 3645 | + void RewindLeaves(boolean h) |
---|
| 3646 | + { |
---|
| 3647 | + if (blockloop) |
---|
| 3648 | + return; |
---|
| 3649 | + |
---|
| 3650 | + if (bRep != null || material != null) // borderline... |
---|
| 3651 | + rewind = h; |
---|
| 3652 | + |
---|
| 3653 | + for (int i = 0; i < Size(); i++) |
---|
| 3654 | + { |
---|
| 3655 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3656 | + if (child == null) |
---|
| 3657 | + continue; |
---|
| 3658 | + blockloop = true; |
---|
| 3659 | + child.RewindLeaves(h); |
---|
| 3660 | + blockloop = false; |
---|
| 3661 | + // release(i); |
---|
| 3662 | + } |
---|
| 3663 | + } |
---|
| 3664 | + |
---|
| 3665 | + void RandomLeaves(boolean h) |
---|
| 3666 | + { |
---|
| 3667 | + if (blockloop) |
---|
| 3668 | + return; |
---|
| 3669 | + |
---|
| 3670 | + if (bRep != null || material != null) // borderline... |
---|
| 3671 | + random = h; |
---|
| 3672 | + |
---|
| 3673 | + for (int i = 0; i < Size(); i++) |
---|
| 3674 | + { |
---|
| 3675 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3676 | + if (child == null) |
---|
| 3677 | + continue; |
---|
| 3678 | + blockloop = true; |
---|
| 3679 | + child.RandomLeaves(h); |
---|
3577 | 3680 | blockloop = false; |
---|
3578 | 3681 | // release(i); |
---|
3579 | 3682 | } |
---|
.. | .. |
---|
4914 | 5017 | } |
---|
4915 | 5018 | } |
---|
4916 | 5019 | |
---|
| 5020 | + ObjEditor GetWindow() |
---|
| 5021 | + { |
---|
| 5022 | + if (editWindow != null) |
---|
| 5023 | + return editWindow; |
---|
| 5024 | + |
---|
| 5025 | + return manipWindow; |
---|
| 5026 | + } |
---|
| 5027 | + |
---|
4917 | 5028 | cTreePath Select(int indexcount, boolean deselect) |
---|
4918 | 5029 | { |
---|
4919 | 5030 | if (hide || dontselect) |
---|
.. | .. |
---|
4950 | 5061 | if (leaf != null) |
---|
4951 | 5062 | { |
---|
4952 | 5063 | cTreePath tp = new cTreePath(this, leaf); |
---|
4953 | | - if (editWindow != null) |
---|
| 5064 | + ObjEditor window = GetWindow(); |
---|
| 5065 | + if (window != null) |
---|
4954 | 5066 | { |
---|
4955 | 5067 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4956 | | - editWindow.Select(tp, deselect, true); |
---|
| 5068 | + window.Select(tp, deselect, true); |
---|
4957 | 5069 | } |
---|
4958 | 5070 | |
---|
4959 | 5071 | return tp; |
---|
.. | .. |
---|
4970 | 5082 | |
---|
4971 | 5083 | if (child == null) |
---|
4972 | 5084 | continue; |
---|
| 5085 | + |
---|
4973 | 5086 | if (child.HasTransparency() && child.size() != 0) |
---|
4974 | 5087 | { |
---|
4975 | 5088 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4979 | 5092 | if (leaf != null) |
---|
4980 | 5093 | { |
---|
4981 | 5094 | cTreePath tp = new cTreePath(this, leaf); |
---|
4982 | | - if (editWindow != null) |
---|
| 5095 | + ObjEditor window = GetWindow(); |
---|
| 5096 | + if (window != null) |
---|
4983 | 5097 | { |
---|
4984 | | - editWindow.Select(tp, deselect, true); |
---|
| 5098 | + window.Select(tp, deselect, true); |
---|
4985 | 5099 | } |
---|
4986 | 5100 | |
---|
4987 | 5101 | return tp; |
---|
.. | .. |
---|
5702 | 5816 | support = support; |
---|
5703 | 5817 | |
---|
5704 | 5818 | //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5705 | | - 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); |
---|
5706 | 5820 | |
---|
5707 | 5821 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5708 | 5822 | { |
---|
.. | .. |
---|
5723 | 5837 | |
---|
5724 | 5838 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5725 | 5839 | //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5726 | | - (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
| 5840 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5727 | 5841 | { |
---|
5728 | 5842 | Globals.lighttouched = true; |
---|
5729 | 5843 | } // all panes... |
---|
.. | .. |
---|
5855 | 5969 | if (GetBRep() != null) |
---|
5856 | 5970 | { |
---|
5857 | 5971 | display.NextIndex(); |
---|
| 5972 | + |
---|
5858 | 5973 | // vertex color conflict : gl.glCallList(list); |
---|
5859 | 5974 | DrawNode(display, root, selected); |
---|
5860 | 5975 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
6315 | 6430 | // dec 2012 |
---|
6316 | 6431 | new Exception().printStackTrace(); |
---|
6317 | 6432 | return; |
---|
| 6433 | + } |
---|
| 6434 | + |
---|
| 6435 | + if (dontselect) |
---|
| 6436 | + { |
---|
| 6437 | + //bRep.GenerateNormalsMINE(); |
---|
6318 | 6438 | } |
---|
6319 | 6439 | |
---|
6320 | 6440 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7207 | 7327 | // { |
---|
7208 | 7328 | // CameraPane.Ymax = spoth; |
---|
7209 | 7329 | // } |
---|
7210 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7211 | | - 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); |
---|
7212 | 7332 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7213 | 7333 | // if (CameraPane.Xmin > boundary.x) |
---|
7214 | 7334 | // { |
---|
.. | .. |
---|
7752 | 7872 | editWindow = null; |
---|
7753 | 7873 | } // ? |
---|
7754 | 7874 | } |
---|
| 7875 | + else |
---|
| 7876 | + { |
---|
| 7877 | + //editWindow.closeUI(); |
---|
| 7878 | + } |
---|
7755 | 7879 | } |
---|
7756 | 7880 | |
---|
7757 | 7881 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7909 | 8033 | } |
---|
7910 | 8034 | |
---|
7911 | 8035 | transient ObjEditor editWindow; |
---|
| 8036 | + transient ObjEditor manipWindow; |
---|
| 8037 | + |
---|
| 8038 | + transient boolean pinned; |
---|
| 8039 | + |
---|
7912 | 8040 | transient ObjectUI objectUI; |
---|
7913 | 8041 | public static int povDepth = 0; |
---|
7914 | 8042 | private static cVector tbMin = new cVector(); |
---|