.. | .. |
---|
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 | + |
---|
| 223 | + if (this.support != null) |
---|
200 | 224 | { |
---|
201 | | - o.transientrep = this.bRep.support; |
---|
202 | | - o.bRep.support = null; |
---|
| 225 | + if (o.transientrep != null) |
---|
| 226 | + Grafreed.Assert(o.transientrep == this.support.bRep); |
---|
| 227 | + |
---|
| 228 | + o.transientrep = this.support.bRep; |
---|
| 229 | + this.support.bRep = null; |
---|
203 | 230 | } |
---|
204 | 231 | |
---|
205 | 232 | // o.support = this.support; |
---|
.. | .. |
---|
223 | 250 | |
---|
224 | 251 | RestoreBigData(o); |
---|
225 | 252 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 253 | + if (blockloop) |
---|
| 254 | + return; |
---|
| 255 | + |
---|
| 256 | + blockloop = true; |
---|
| 257 | + |
---|
| 258 | + //hashtable.remove(GetUUID()); |
---|
227 | 259 | |
---|
228 | 260 | for (int i=0; i<Size(); i++) |
---|
229 | 261 | { |
---|
230 | 262 | get(i).RestoreBigData(hashtable); |
---|
231 | 263 | } |
---|
| 264 | + |
---|
| 265 | + blockloop = false; |
---|
232 | 266 | } |
---|
233 | 267 | |
---|
234 | 268 | void RestoreBigData(Object3D o) |
---|
235 | 269 | { |
---|
236 | 270 | this.bRep = o.bRep; |
---|
237 | | - if (this.bRep != null) |
---|
238 | | - this.bRep.support = o.transientrep; |
---|
| 271 | + if (this.support != null && o.transientrep != null) |
---|
| 272 | + { |
---|
| 273 | + this.support.bRep = o.transientrep; |
---|
| 274 | + } |
---|
| 275 | + |
---|
| 276 | + this.selection = o.selection; |
---|
| 277 | +// July 2019 if (this.bRep != null) |
---|
| 278 | +// this.bRep.support = o.transientrep; |
---|
239 | 279 | // this.support = o.support; |
---|
240 | 280 | // this.fileparent = o.fileparent; |
---|
241 | 281 | } |
---|
.. | .. |
---|
881 | 921 | |
---|
882 | 922 | if (marked && Globals.isLIVE() && live && |
---|
883 | 923 | //TEMP21aug2018 |
---|
884 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 924 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
885 | 925 | currentframe != Globals.framecount) |
---|
886 | 926 | { |
---|
887 | 927 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
893 | 933 | |
---|
894 | 934 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
895 | 935 | |
---|
896 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 936 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 937 | + (step == 1 && changedir)) |
---|
897 | 938 | { |
---|
898 | 939 | countdown = 1; |
---|
899 | 940 | delay = speedup?8:1; |
---|
.. | .. |
---|
965 | 1006 | if (material == null || material.multiply) |
---|
966 | 1007 | return true; |
---|
967 | 1008 | |
---|
| 1009 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
968 | 1010 | return material.opacity > 0.99; |
---|
969 | 1011 | } |
---|
970 | 1012 | |
---|
.. | .. |
---|
1365 | 1407 | toParent = LA.newMatrix(); |
---|
1366 | 1408 | fromParent = LA.newMatrix(); |
---|
1367 | 1409 | } |
---|
| 1410 | + |
---|
1368 | 1411 | LA.matCopy(other.toParent, toParent); |
---|
1369 | 1412 | LA.matCopy(other.fromParent, fromParent); |
---|
1370 | 1413 | |
---|
.. | .. |
---|
2386 | 2429 | } |
---|
2387 | 2430 | */ |
---|
2388 | 2431 | } |
---|
| 2432 | + else |
---|
| 2433 | + { |
---|
| 2434 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2435 | + } |
---|
2389 | 2436 | } |
---|
2390 | 2437 | |
---|
2391 | 2438 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2427 | 2474 | { |
---|
2428 | 2475 | editWindow.refreshContents(); |
---|
2429 | 2476 | } |
---|
| 2477 | + else |
---|
| 2478 | + { |
---|
| 2479 | + if (manipWindow != null) |
---|
| 2480 | + { |
---|
| 2481 | + manipWindow.refreshContents(); |
---|
| 2482 | + } |
---|
| 2483 | + } |
---|
| 2484 | + |
---|
2430 | 2485 | //if (parent != null) |
---|
2431 | 2486 | //parent.refreshEditWindow(); |
---|
2432 | 2487 | } |
---|
.. | .. |
---|
3503 | 3558 | if (blockloop) |
---|
3504 | 3559 | return; |
---|
3505 | 3560 | |
---|
3506 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3561 | + if (//marked || // does not make sense |
---|
| 3562 | + (bRep != null || material != null)) // borderline... |
---|
3507 | 3563 | live = h; |
---|
3508 | 3564 | |
---|
3509 | 3565 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3524 | 3580 | return; |
---|
3525 | 3581 | |
---|
3526 | 3582 | //if (bRep != null) |
---|
3527 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3583 | + if (//marked || // does not make sense |
---|
| 3584 | + (bRep != null || material != null)) // borderline... |
---|
3528 | 3585 | link2master = h; |
---|
3529 | 3586 | |
---|
3530 | 3587 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3544 | 3601 | if (blockloop) |
---|
3545 | 3602 | return; |
---|
3546 | 3603 | |
---|
3547 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3604 | + if (//marked || // does not make sense |
---|
| 3605 | + (bRep != null || material != null)) // borderline... |
---|
3548 | 3606 | hide = h; |
---|
3549 | 3607 | |
---|
3550 | 3608 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3564 | 3622 | if (blockloop) |
---|
3565 | 3623 | return; |
---|
3566 | 3624 | |
---|
3567 | | - if (bRep != null && material != null) // borderline... |
---|
| 3625 | + if (bRep != null || material != null) // borderline... |
---|
3568 | 3626 | marked = h; |
---|
3569 | 3627 | |
---|
3570 | 3628 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3574 | 3632 | continue; |
---|
3575 | 3633 | blockloop = true; |
---|
3576 | 3634 | child.MarkLeaves(h); |
---|
| 3635 | + blockloop = false; |
---|
| 3636 | + // release(i); |
---|
| 3637 | + } |
---|
| 3638 | + } |
---|
| 3639 | + |
---|
| 3640 | + void RewindLeaves(boolean h) |
---|
| 3641 | + { |
---|
| 3642 | + if (blockloop) |
---|
| 3643 | + return; |
---|
| 3644 | + |
---|
| 3645 | + if (bRep != null || material != null) // borderline... |
---|
| 3646 | + rewind = h; |
---|
| 3647 | + |
---|
| 3648 | + for (int i = 0; i < Size(); i++) |
---|
| 3649 | + { |
---|
| 3650 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3651 | + if (child == null) |
---|
| 3652 | + continue; |
---|
| 3653 | + blockloop = true; |
---|
| 3654 | + child.RewindLeaves(h); |
---|
| 3655 | + blockloop = false; |
---|
| 3656 | + // release(i); |
---|
| 3657 | + } |
---|
| 3658 | + } |
---|
| 3659 | + |
---|
| 3660 | + void RandomLeaves(boolean h) |
---|
| 3661 | + { |
---|
| 3662 | + if (blockloop) |
---|
| 3663 | + return; |
---|
| 3664 | + |
---|
| 3665 | + if (bRep != null || material != null) // borderline... |
---|
| 3666 | + random = h; |
---|
| 3667 | + |
---|
| 3668 | + for (int i = 0; i < Size(); i++) |
---|
| 3669 | + { |
---|
| 3670 | + Object3D child = (Object3D) get(i); // reserve(i); |
---|
| 3671 | + if (child == null) |
---|
| 3672 | + continue; |
---|
| 3673 | + blockloop = true; |
---|
| 3674 | + child.RandomLeaves(h); |
---|
3577 | 3675 | blockloop = false; |
---|
3578 | 3676 | // release(i); |
---|
3579 | 3677 | } |
---|
.. | .. |
---|
4914 | 5012 | } |
---|
4915 | 5013 | } |
---|
4916 | 5014 | |
---|
| 5015 | + ObjEditor GetWindow() |
---|
| 5016 | + { |
---|
| 5017 | + if (editWindow != null) |
---|
| 5018 | + return editWindow; |
---|
| 5019 | + |
---|
| 5020 | + return manipWindow; |
---|
| 5021 | + } |
---|
| 5022 | + |
---|
4917 | 5023 | cTreePath Select(int indexcount, boolean deselect) |
---|
4918 | 5024 | { |
---|
4919 | 5025 | if (hide || dontselect) |
---|
.. | .. |
---|
4950 | 5056 | if (leaf != null) |
---|
4951 | 5057 | { |
---|
4952 | 5058 | cTreePath tp = new cTreePath(this, leaf); |
---|
4953 | | - if (editWindow != null) |
---|
| 5059 | + ObjEditor window = GetWindow(); |
---|
| 5060 | + if (window != null) |
---|
4954 | 5061 | { |
---|
4955 | 5062 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4956 | | - editWindow.Select(tp, deselect, true); |
---|
| 5063 | + window.Select(tp, deselect, true); |
---|
4957 | 5064 | } |
---|
4958 | 5065 | |
---|
4959 | 5066 | return tp; |
---|
.. | .. |
---|
4970 | 5077 | |
---|
4971 | 5078 | if (child == null) |
---|
4972 | 5079 | continue; |
---|
| 5080 | + |
---|
4973 | 5081 | if (child.HasTransparency() && child.size() != 0) |
---|
4974 | 5082 | { |
---|
4975 | 5083 | cTreePath leaf = child.Select(indexcount, deselect); |
---|
.. | .. |
---|
4979 | 5087 | if (leaf != null) |
---|
4980 | 5088 | { |
---|
4981 | 5089 | cTreePath tp = new cTreePath(this, leaf); |
---|
4982 | | - if (editWindow != null) |
---|
| 5090 | + ObjEditor window = GetWindow(); |
---|
| 5091 | + if (window != null) |
---|
4983 | 5092 | { |
---|
4984 | | - editWindow.Select(tp, deselect, true); |
---|
| 5093 | + window.Select(tp, deselect, true); |
---|
4985 | 5094 | } |
---|
4986 | 5095 | |
---|
4987 | 5096 | return tp; |
---|
.. | .. |
---|
5702 | 5811 | support = support; |
---|
5703 | 5812 | |
---|
5704 | 5813 | //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); |
---|
| 5814 | + boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5706 | 5815 | |
---|
5707 | 5816 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5708 | 5817 | { |
---|
.. | .. |
---|
5723 | 5832 | |
---|
5724 | 5833 | if (!selectmode && //display.DrawMode() != display.SELECTION && |
---|
5725 | 5834 | //(touched || (bRep != null && bRep.displaylist <= 0))) |
---|
5726 | | - (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0))) |
---|
| 5835 | + (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) |
---|
5727 | 5836 | { |
---|
5728 | 5837 | Globals.lighttouched = true; |
---|
5729 | 5838 | } // all panes... |
---|
.. | .. |
---|
5855 | 5964 | if (GetBRep() != null) |
---|
5856 | 5965 | { |
---|
5857 | 5966 | display.NextIndex(); |
---|
| 5967 | + |
---|
5858 | 5968 | // vertex color conflict : gl.glCallList(list); |
---|
5859 | 5969 | DrawNode(display, root, selected); |
---|
5860 | 5970 | if (this instanceof BezierPatch) |
---|
.. | .. |
---|
6315 | 6425 | // dec 2012 |
---|
6316 | 6426 | new Exception().printStackTrace(); |
---|
6317 | 6427 | return; |
---|
| 6428 | + } |
---|
| 6429 | + |
---|
| 6430 | + if (dontselect) |
---|
| 6431 | + { |
---|
| 6432 | + //bRep.GenerateNormalsMINE(); |
---|
6318 | 6433 | } |
---|
6319 | 6434 | |
---|
6320 | 6435 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7207 | 7322 | // { |
---|
7208 | 7323 | // CameraPane.Ymax = spoth; |
---|
7209 | 7324 | // } |
---|
7210 | | - info.g.drawArc(boundary.x, boundary.y, |
---|
7211 | | - boundary.width, boundary.height, 0, 360); |
---|
| 7325 | + info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
---|
| 7326 | + (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
---|
7212 | 7327 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
7213 | 7328 | // if (CameraPane.Xmin > boundary.x) |
---|
7214 | 7329 | // { |
---|
.. | .. |
---|
7752 | 7867 | editWindow = null; |
---|
7753 | 7868 | } // ? |
---|
7754 | 7869 | } |
---|
| 7870 | + else |
---|
| 7871 | + { |
---|
| 7872 | + //editWindow.closeUI(); |
---|
| 7873 | + } |
---|
7755 | 7874 | } |
---|
7756 | 7875 | |
---|
7757 | 7876 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7909 | 8028 | } |
---|
7910 | 8029 | |
---|
7911 | 8030 | transient ObjEditor editWindow; |
---|
| 8031 | + transient ObjEditor manipWindow; |
---|
| 8032 | + |
---|
| 8033 | + transient boolean pinned; |
---|
| 8034 | + |
---|
7912 | 8035 | transient ObjectUI objectUI; |
---|
7913 | 8036 | public static int povDepth = 0; |
---|
7914 | 8037 | private static cVector tbMin = new cVector(); |
---|