.. | .. |
---|
22 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
23 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
24 | 24 | |
---|
| 25 | + // Use GetUUID for backward compatibility with null. |
---|
25 | 26 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 27 | |
---|
27 | 28 | // TEMPORARY for mocap undo. No need to be transient. |
---|
.. | .. |
---|
32 | 33 | String skyboxname; |
---|
33 | 34 | String skyboxext; |
---|
34 | 35 | |
---|
35 | | - Object3D versions[]; |
---|
| 36 | + Object3D versionlist[]; |
---|
36 | 37 | int versionindex = -1; |
---|
37 | 38 | |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 40 | + |
---|
38 | 41 | ScriptNode scriptnode; |
---|
39 | 42 | |
---|
40 | 43 | void InitOthers() |
---|
.. | .. |
---|
222 | 225 | // o.bRep.support = null; |
---|
223 | 226 | // } |
---|
224 | 227 | o.selection = this.selection; |
---|
225 | | - o.versions = this.versions; |
---|
| 228 | + o.versionlist = this.versionlist; |
---|
226 | 229 | o.versionindex = this.versionindex; |
---|
227 | 230 | |
---|
228 | 231 | if (this.support != null) |
---|
.. | .. |
---|
244 | 247 | // this.bRep.support = null; |
---|
245 | 248 | // this.support = null; |
---|
246 | 249 | // this.fileparent = null; |
---|
| 250 | + } |
---|
| 251 | + |
---|
| 252 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 253 | +// { |
---|
| 254 | +// if (this.uuid.equals(uuid)) |
---|
| 255 | +// return this; |
---|
| 256 | +// |
---|
| 257 | +// if (blockloop) |
---|
| 258 | +// return null; |
---|
| 259 | +// |
---|
| 260 | +// blockloop = true; |
---|
| 261 | +// |
---|
| 262 | +// for (int i=0; i<Size(); i++) |
---|
| 263 | +// { |
---|
| 264 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 265 | +// |
---|
| 266 | +// if (o != null) |
---|
| 267 | +// return o; |
---|
| 268 | +// } |
---|
| 269 | +// |
---|
| 270 | +// blockloop = false; |
---|
| 271 | +// |
---|
| 272 | +// return null; |
---|
| 273 | +// } |
---|
| 274 | + |
---|
| 275 | + transient boolean tag; |
---|
| 276 | + |
---|
| 277 | + void TagObjects(Object3D o, boolean tag) |
---|
| 278 | + { |
---|
| 279 | + if (blockloop) |
---|
| 280 | + return; |
---|
| 281 | + |
---|
| 282 | + o.tag = tag; |
---|
| 283 | + |
---|
| 284 | + if (o == this) |
---|
| 285 | + return; |
---|
| 286 | + |
---|
| 287 | + blockloop = true; |
---|
| 288 | + |
---|
| 289 | + for (int i=0; i<Size(); i++) |
---|
| 290 | + { |
---|
| 291 | + get(i).TagObjects(o, tag); |
---|
| 292 | + } |
---|
| 293 | + |
---|
| 294 | + blockloop = false; |
---|
| 295 | + } |
---|
| 296 | + |
---|
| 297 | + boolean HasTags() |
---|
| 298 | + { |
---|
| 299 | + if (blockloop) |
---|
| 300 | + return false; |
---|
| 301 | + |
---|
| 302 | + blockloop = true; |
---|
| 303 | + |
---|
| 304 | + boolean hasTags = false; |
---|
| 305 | + |
---|
| 306 | + for (int i=0; i<Size(); i++) |
---|
| 307 | + { |
---|
| 308 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 309 | + |
---|
| 310 | + if (hasTags) |
---|
| 311 | + break; |
---|
| 312 | + } |
---|
| 313 | + |
---|
| 314 | + blockloop = false; |
---|
| 315 | + |
---|
| 316 | + return hasTags; |
---|
247 | 317 | } |
---|
248 | 318 | |
---|
249 | 319 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
.. | .. |
---|
280 | 350 | |
---|
281 | 351 | this.selection = o.selection; |
---|
282 | 352 | |
---|
283 | | - this.versions = o.versions; |
---|
| 353 | + this.versionlist = o.versionlist; |
---|
284 | 354 | this.versionindex = o.versionindex; |
---|
285 | 355 | // July 2019 if (this.bRep != null) |
---|
286 | 356 | // this.bRep.support = o.transientrep; |
---|
.. | .. |
---|
617 | 687 | { |
---|
618 | 688 | if (maxcount != 1) |
---|
619 | 689 | { |
---|
620 | | - new Exception().printStackTrace(); |
---|
| 690 | + //new Exception().printStackTrace(); |
---|
621 | 691 | } |
---|
622 | 692 | |
---|
623 | 693 | toParentMarked = LA.newMatrix(); |
---|
.. | .. |
---|
2299 | 2369 | |
---|
2300 | 2370 | InitOthers(); |
---|
2301 | 2371 | |
---|
2302 | | - if (this instanceof Camera) |
---|
2303 | | - { |
---|
2304 | | - material.shift = 90; |
---|
2305 | | - } |
---|
2306 | | - |
---|
2307 | 2372 | material.multiply = multiply; |
---|
2308 | 2373 | |
---|
2309 | 2374 | if (multiply) |
---|
.. | .. |
---|
2444 | 2509 | else |
---|
2445 | 2510 | { |
---|
2446 | 2511 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2512 | + if (objectUI != null) |
---|
| 2513 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2514 | + else |
---|
| 2515 | + //new Exception().printStackTrace(); |
---|
| 2516 | + System.err.println("objectUI is null"); |
---|
2447 | 2517 | } |
---|
2448 | 2518 | } |
---|
2449 | 2519 | |
---|
.. | .. |
---|
3547 | 3617 | |
---|
3548 | 3618 | void ClearMaterials() |
---|
3549 | 3619 | { |
---|
| 3620 | + if (blockloop) |
---|
| 3621 | + return; |
---|
| 3622 | + |
---|
| 3623 | + blockloop = true; |
---|
| 3624 | + |
---|
3550 | 3625 | ClearMaterial(); |
---|
3551 | | - for (int i = 0; i < size(); i++) |
---|
| 3626 | + for (int i = 0; i < Size(); i++) |
---|
3552 | 3627 | { |
---|
3553 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3628 | + Object3D child = (Object3D) get(i); |
---|
3554 | 3629 | if (child == null) |
---|
3555 | 3630 | continue; |
---|
3556 | 3631 | child.ClearMaterials(); |
---|
3557 | | - release(i); |
---|
3558 | 3632 | } |
---|
| 3633 | + |
---|
| 3634 | + blockloop = false; |
---|
| 3635 | + } |
---|
| 3636 | + |
---|
| 3637 | + void ClearVersionList() |
---|
| 3638 | + { |
---|
| 3639 | + this.versionlist = null; |
---|
| 3640 | + this.versionindex = -1; |
---|
| 3641 | + this.versiontable = null; |
---|
| 3642 | + } |
---|
| 3643 | + |
---|
| 3644 | + void ClearVersions() |
---|
| 3645 | + { |
---|
| 3646 | + if (blockloop) |
---|
| 3647 | + return; |
---|
| 3648 | + |
---|
| 3649 | + blockloop = true; |
---|
| 3650 | + |
---|
| 3651 | + ClearVersionList(); |
---|
| 3652 | + for (int i = 0; i < Size(); i++) |
---|
| 3653 | + { |
---|
| 3654 | + Object3D child = (Object3D) get(i); |
---|
| 3655 | + if (child == null) |
---|
| 3656 | + continue; |
---|
| 3657 | + child.ClearVersions(); |
---|
| 3658 | + } |
---|
| 3659 | + |
---|
| 3660 | + blockloop = false; |
---|
3559 | 3661 | } |
---|
3560 | 3662 | |
---|
3561 | 3663 | void FlipV(boolean flip) |
---|
.. | .. |
---|
5545 | 5647 | if (fullname == null) |
---|
5546 | 5648 | return ""; |
---|
5547 | 5649 | |
---|
| 5650 | + if (fullname.pigment != null) |
---|
| 5651 | + { |
---|
| 5652 | + return fullname.pigment; |
---|
| 5653 | + } |
---|
| 5654 | + |
---|
5548 | 5655 | // System.out.println("Fullname = " + fullname); |
---|
5549 | 5656 | |
---|
5550 | 5657 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5557 | 5664 | |
---|
5558 | 5665 | if (split.length == 0) |
---|
5559 | 5666 | { |
---|
5560 | | - return ""; |
---|
| 5667 | + return fullname.pigment = ""; |
---|
5561 | 5668 | } |
---|
5562 | 5669 | |
---|
5563 | 5670 | if (split.length <= 2) |
---|
.. | .. |
---|
5565 | 5672 | if (fullname.name.endsWith(":")) |
---|
5566 | 5673 | { |
---|
5567 | 5674 | // Windows |
---|
5568 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5675 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5569 | 5676 | } |
---|
5570 | 5677 | |
---|
5571 | | - return split[0]; |
---|
| 5678 | + return fullname.pigment = split[0]; |
---|
5572 | 5679 | } |
---|
5573 | 5680 | |
---|
5574 | 5681 | // Windows |
---|
5575 | 5682 | assert(split.length == 4); |
---|
5576 | 5683 | |
---|
5577 | | - return split[0] + ":" + split[1]; |
---|
| 5684 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5578 | 5685 | } |
---|
5579 | 5686 | |
---|
5580 | 5687 | static String GetBump(cTexture fullname) |
---|
5581 | 5688 | { |
---|
5582 | 5689 | if (fullname == null) |
---|
5583 | 5690 | return ""; |
---|
| 5691 | + |
---|
| 5692 | + if (fullname.bump != null) |
---|
| 5693 | + { |
---|
| 5694 | + return fullname.bump; |
---|
| 5695 | + } |
---|
5584 | 5696 | |
---|
5585 | 5697 | // System.out.println("Fullname = " + fullname); |
---|
5586 | 5698 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5592 | 5704 | |
---|
5593 | 5705 | if (split.length == 0) |
---|
5594 | 5706 | { |
---|
5595 | | - return ""; |
---|
| 5707 | + return fullname.bump = ""; |
---|
5596 | 5708 | } |
---|
5597 | 5709 | |
---|
5598 | 5710 | if (split.length == 1) |
---|
5599 | 5711 | { |
---|
5600 | | - return ""; |
---|
| 5712 | + return fullname.bump = ""; |
---|
5601 | 5713 | } |
---|
5602 | 5714 | |
---|
5603 | 5715 | if (split.length == 2) |
---|
.. | .. |
---|
5605 | 5717 | if (fullname.name.endsWith(":")) |
---|
5606 | 5718 | { |
---|
5607 | 5719 | // Windows |
---|
5608 | | - return ""; |
---|
| 5720 | + return fullname.bump = ""; |
---|
5609 | 5721 | } |
---|
5610 | 5722 | |
---|
5611 | | - return split[1]; |
---|
| 5723 | + return fullname.bump = split[1]; |
---|
5612 | 5724 | } |
---|
5613 | 5725 | |
---|
5614 | 5726 | // Windows |
---|
5615 | 5727 | assert(split.length == 4); |
---|
5616 | 5728 | |
---|
5617 | | - return split[2] + ":" + split[3]; |
---|
| 5729 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5618 | 5730 | } |
---|
5619 | 5731 | |
---|
5620 | 5732 | String GetPigmentTexture() |
---|
.. | .. |
---|
5697 | 5809 | texname = ""; |
---|
5698 | 5810 | |
---|
5699 | 5811 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5812 | + |
---|
| 5813 | + GetTextures().pigment = null; |
---|
| 5814 | + |
---|
5700 | 5815 | Touch(); |
---|
5701 | 5816 | } |
---|
5702 | 5817 | |
---|
.. | .. |
---|
5769 | 5884 | texname = ""; |
---|
5770 | 5885 | |
---|
5771 | 5886 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5887 | + |
---|
| 5888 | + GetTextures().bump = null; |
---|
5772 | 5889 | |
---|
5773 | 5890 | Touch(); |
---|
5774 | 5891 | } |
---|
.. | .. |
---|
7373 | 7490 | boundary.y = spot.y - 30; |
---|
7374 | 7491 | boundary.width = spot.width + 60; |
---|
7375 | 7492 | boundary.height = spot.height + 60; |
---|
7376 | | - clickInfo.g.setColor(Color.red); |
---|
| 7493 | + clickInfo.g.setColor(Color.white); |
---|
7377 | 7494 | int spotw = spot.x + spot.width; |
---|
7378 | 7495 | int spoth = spot.y + spot.height; |
---|
7379 | 7496 | clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7393 | 7510 | // { |
---|
7394 | 7511 | // CameraPane.Ymax = spoth; |
---|
7395 | 7512 | // } |
---|
7396 | | - spot.translate(32, 32); |
---|
| 7513 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7514 | +// { |
---|
| 7515 | +// CameraPane.Xmin = spot.x; |
---|
| 7516 | +// } |
---|
| 7517 | +// if (CameraPane.Xmax < spotw) |
---|
| 7518 | +// { |
---|
| 7519 | +// CameraPane.Xmax = spotw; |
---|
| 7520 | +// } |
---|
| 7521 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7522 | +// { |
---|
| 7523 | +// CameraPane.Ymin = spot.y; |
---|
| 7524 | +// } |
---|
| 7525 | +// if (CameraPane.Ymax < spoth) |
---|
| 7526 | +// { |
---|
| 7527 | +// CameraPane.Ymax = spoth; |
---|
| 7528 | +// } |
---|
| 7529 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7530 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7531 | + spot.translate(32, 0); |
---|
| 7532 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7533 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7534 | + |
---|
| 7535 | + spot.translate(32, 64); |
---|
7397 | 7536 | spotw = spot.x + spot.width; |
---|
7398 | 7537 | spoth = spot.y + spot.height; |
---|
7399 | 7538 | clickInfo.g.setColor(Color.cyan); |
---|
.. | .. |
---|
7414 | 7553 | // { |
---|
7415 | 7554 | // CameraPane.Ymax = spoth; |
---|
7416 | 7555 | // } |
---|
7417 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7418 | | - //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7419 | | - spot.translate(0, -32); |
---|
7420 | | - clickInfo.g.setColor(Color.yellow); |
---|
7421 | | - clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7422 | 7556 | clickInfo.g.setColor(Color.green); |
---|
7423 | | -// if (CameraPane.Xmin > spot.x) |
---|
7424 | | -// { |
---|
7425 | | -// CameraPane.Xmin = spot.x; |
---|
7426 | | -// } |
---|
7427 | | -// if (CameraPane.Xmax < spotw) |
---|
7428 | | -// { |
---|
7429 | | -// CameraPane.Xmax = spotw; |
---|
7430 | | -// } |
---|
7431 | | -// if (CameraPane.Ymin > spot.y) |
---|
7432 | | -// { |
---|
7433 | | -// CameraPane.Ymin = spot.y; |
---|
7434 | | -// } |
---|
7435 | | -// if (CameraPane.Ymax < spoth) |
---|
7436 | | -// { |
---|
7437 | | -// CameraPane.Ymax = spoth; |
---|
7438 | | -// } |
---|
7439 | 7557 | clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
7440 | 7558 | (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7441 | 7559 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
.. | .. |
---|
7494 | 7612 | retval = true; |
---|
7495 | 7613 | } |
---|
7496 | 7614 | spot.translate(0, 32); |
---|
| 7615 | + spot.translate(32, 0); |
---|
| 7616 | + spot.translate(0, 32); |
---|
7497 | 7617 | if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7498 | 7618 | { |
---|
7499 | 7619 | hitSomething = hitScale; |
---|
7500 | 7620 | |
---|
7501 | 7621 | double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7502 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7622 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7503 | 7623 | double sign = 1; |
---|
7504 | 7624 | if (hScale < 0) |
---|
7505 | 7625 | { |
---|
.. | .. |
---|
7511 | 7631 | //hScale = 0.01; |
---|
7512 | 7632 | } |
---|
7513 | 7633 | |
---|
7514 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7634 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7515 | 7635 | sign = 1; |
---|
7516 | 7636 | if (vScale < 0) |
---|
7517 | 7637 | { |
---|
.. | .. |
---|
7591 | 7711 | |
---|
7592 | 7712 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7593 | 7713 | |
---|
7594 | | - if (modified || opposite) |
---|
| 7714 | + // Modified could snap |
---|
| 7715 | + if (//modified || |
---|
| 7716 | + opposite) |
---|
7595 | 7717 | { |
---|
7596 | 7718 | //assert(false); |
---|
7597 | 7719 | /* |
---|
.. | .. |
---|
7685 | 7807 | |
---|
7686 | 7808 | if (modified) |
---|
7687 | 7809 | { |
---|
7688 | | - // Rotate 90 degrees |
---|
| 7810 | + // Rotate 45 degrees |
---|
7689 | 7811 | angle /= (Math.PI / 4); |
---|
7690 | 7812 | angle = Math.floor(angle + 0.5); |
---|
7691 | 7813 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7726 | 7848 | break; |
---|
7727 | 7849 | |
---|
7728 | 7850 | case hitScale: // scale |
---|
7729 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7851 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7730 | 7852 | double sign = 1; |
---|
7731 | 7853 | if (hScale < 0) |
---|
7732 | 7854 | { |
---|
.. | .. |
---|
7738 | 7860 | //hScale = 0.01; |
---|
7739 | 7861 | } |
---|
7740 | 7862 | |
---|
7741 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7863 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7742 | 7864 | sign = 1; |
---|
7743 | 7865 | if (vScale < 0) |
---|
7744 | 7866 | { |
---|
.. | .. |
---|
7771 | 7893 | case 3: // '\001' |
---|
7772 | 7894 | if (modified || opposite) |
---|
7773 | 7895 | { |
---|
| 7896 | + if (modified) // && opposite) |
---|
| 7897 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7898 | + else |
---|
7774 | 7899 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7775 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7900 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7776 | 7901 | } // vScale, 1); |
---|
7777 | 7902 | else |
---|
7778 | 7903 | { |
---|
7779 | 7904 | // EXCEPTION! |
---|
7780 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7905 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7781 | 7906 | } // vScale, 1); |
---|
7782 | 7907 | break; |
---|
7783 | 7908 | |
---|
7784 | 7909 | case 2: // '\002' |
---|
7785 | 7910 | if (modified || opposite) |
---|
7786 | 7911 | { |
---|
7787 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7788 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 7912 | + if (modified) // && opposite) |
---|
| 7913 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7914 | + else |
---|
| 7915 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 7916 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7789 | 7917 | } else |
---|
7790 | 7918 | { |
---|
7791 | 7919 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7795 | 7923 | case 1: // '\003' |
---|
7796 | 7924 | if (modified || opposite) |
---|
7797 | 7925 | { |
---|
7798 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7799 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 7926 | + if (modified) // && opposite) |
---|
| 7927 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7928 | + else |
---|
| 7929 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 7930 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7800 | 7931 | } else |
---|
7801 | 7932 | { |
---|
7802 | 7933 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|