.. | .. |
---|
36 | 36 | Object3D versionlist[]; |
---|
37 | 37 | int versionindex = -1; |
---|
38 | 38 | |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 40 | + |
---|
39 | 41 | ScriptNode scriptnode; |
---|
40 | 42 | |
---|
41 | 43 | void InitOthers() |
---|
.. | .. |
---|
269 | 271 | // |
---|
270 | 272 | // return null; |
---|
271 | 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; |
---|
| 317 | + } |
---|
272 | 318 | |
---|
273 | 319 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
274 | 320 | { |
---|
.. | .. |
---|
641 | 687 | { |
---|
642 | 688 | if (maxcount != 1) |
---|
643 | 689 | { |
---|
644 | | - new Exception().printStackTrace(); |
---|
| 690 | + //new Exception().printStackTrace(); |
---|
645 | 691 | } |
---|
646 | 692 | |
---|
647 | 693 | toParentMarked = LA.newMatrix(); |
---|
.. | .. |
---|
2323 | 2369 | |
---|
2324 | 2370 | InitOthers(); |
---|
2325 | 2371 | |
---|
2326 | | - if (this instanceof Camera) |
---|
2327 | | - { |
---|
2328 | | - material.shift = 90; |
---|
2329 | | - } |
---|
2330 | | - |
---|
2331 | 2372 | material.multiply = multiply; |
---|
2332 | 2373 | |
---|
2333 | 2374 | if (multiply) |
---|
.. | .. |
---|
2468 | 2509 | else |
---|
2469 | 2510 | { |
---|
2470 | 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"); |
---|
2471 | 2517 | } |
---|
2472 | 2518 | } |
---|
2473 | 2519 | |
---|
.. | .. |
---|
3571 | 3617 | |
---|
3572 | 3618 | void ClearMaterials() |
---|
3573 | 3619 | { |
---|
| 3620 | + if (blockloop) |
---|
| 3621 | + return; |
---|
| 3622 | + |
---|
| 3623 | + blockloop = true; |
---|
| 3624 | + |
---|
3574 | 3625 | ClearMaterial(); |
---|
3575 | | - for (int i = 0; i < size(); i++) |
---|
| 3626 | + for (int i = 0; i < Size(); i++) |
---|
3576 | 3627 | { |
---|
3577 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3628 | + Object3D child = (Object3D) get(i); |
---|
3578 | 3629 | if (child == null) |
---|
3579 | 3630 | continue; |
---|
3580 | 3631 | child.ClearMaterials(); |
---|
3581 | | - release(i); |
---|
3582 | 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; |
---|
3583 | 3661 | } |
---|
3584 | 3662 | |
---|
3585 | 3663 | void FlipV(boolean flip) |
---|
.. | .. |
---|
5569 | 5647 | if (fullname == null) |
---|
5570 | 5648 | return ""; |
---|
5571 | 5649 | |
---|
| 5650 | + if (fullname.pigment != null) |
---|
| 5651 | + { |
---|
| 5652 | + return fullname.pigment; |
---|
| 5653 | + } |
---|
| 5654 | + |
---|
5572 | 5655 | // System.out.println("Fullname = " + fullname); |
---|
5573 | 5656 | |
---|
5574 | 5657 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5581 | 5664 | |
---|
5582 | 5665 | if (split.length == 0) |
---|
5583 | 5666 | { |
---|
5584 | | - return ""; |
---|
| 5667 | + return fullname.pigment = ""; |
---|
5585 | 5668 | } |
---|
5586 | 5669 | |
---|
5587 | 5670 | if (split.length <= 2) |
---|
.. | .. |
---|
5589 | 5672 | if (fullname.name.endsWith(":")) |
---|
5590 | 5673 | { |
---|
5591 | 5674 | // Windows |
---|
5592 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5675 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5593 | 5676 | } |
---|
5594 | 5677 | |
---|
5595 | | - return split[0]; |
---|
| 5678 | + return fullname.pigment = split[0]; |
---|
5596 | 5679 | } |
---|
5597 | 5680 | |
---|
5598 | 5681 | // Windows |
---|
5599 | 5682 | assert(split.length == 4); |
---|
5600 | 5683 | |
---|
5601 | | - return split[0] + ":" + split[1]; |
---|
| 5684 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5602 | 5685 | } |
---|
5603 | 5686 | |
---|
5604 | 5687 | static String GetBump(cTexture fullname) |
---|
5605 | 5688 | { |
---|
5606 | 5689 | if (fullname == null) |
---|
5607 | 5690 | return ""; |
---|
| 5691 | + |
---|
| 5692 | + if (fullname.bump != null) |
---|
| 5693 | + { |
---|
| 5694 | + return fullname.bump; |
---|
| 5695 | + } |
---|
5608 | 5696 | |
---|
5609 | 5697 | // System.out.println("Fullname = " + fullname); |
---|
5610 | 5698 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5616 | 5704 | |
---|
5617 | 5705 | if (split.length == 0) |
---|
5618 | 5706 | { |
---|
5619 | | - return ""; |
---|
| 5707 | + return fullname.bump = ""; |
---|
5620 | 5708 | } |
---|
5621 | 5709 | |
---|
5622 | 5710 | if (split.length == 1) |
---|
5623 | 5711 | { |
---|
5624 | | - return ""; |
---|
| 5712 | + return fullname.bump = ""; |
---|
5625 | 5713 | } |
---|
5626 | 5714 | |
---|
5627 | 5715 | if (split.length == 2) |
---|
.. | .. |
---|
5629 | 5717 | if (fullname.name.endsWith(":")) |
---|
5630 | 5718 | { |
---|
5631 | 5719 | // Windows |
---|
5632 | | - return ""; |
---|
| 5720 | + return fullname.bump = ""; |
---|
5633 | 5721 | } |
---|
5634 | 5722 | |
---|
5635 | | - return split[1]; |
---|
| 5723 | + return fullname.bump = split[1]; |
---|
5636 | 5724 | } |
---|
5637 | 5725 | |
---|
5638 | 5726 | // Windows |
---|
5639 | 5727 | assert(split.length == 4); |
---|
5640 | 5728 | |
---|
5641 | | - return split[2] + ":" + split[3]; |
---|
| 5729 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5642 | 5730 | } |
---|
5643 | 5731 | |
---|
5644 | 5732 | String GetPigmentTexture() |
---|
.. | .. |
---|
5721 | 5809 | texname = ""; |
---|
5722 | 5810 | |
---|
5723 | 5811 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5812 | + |
---|
| 5813 | + GetTextures().pigment = null; |
---|
| 5814 | + |
---|
5724 | 5815 | Touch(); |
---|
5725 | 5816 | } |
---|
5726 | 5817 | |
---|
.. | .. |
---|
5793 | 5884 | texname = ""; |
---|
5794 | 5885 | |
---|
5795 | 5886 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5887 | + |
---|
| 5888 | + GetTextures().bump = null; |
---|
5796 | 5889 | |
---|
5797 | 5890 | Touch(); |
---|
5798 | 5891 | } |
---|
.. | .. |
---|
7397 | 7490 | boundary.y = spot.y - 30; |
---|
7398 | 7491 | boundary.width = spot.width + 60; |
---|
7399 | 7492 | boundary.height = spot.height + 60; |
---|
7400 | | - clickInfo.g.setColor(Color.red); |
---|
| 7493 | + clickInfo.g.setColor(Color.white); |
---|
7401 | 7494 | int spotw = spot.x + spot.width; |
---|
7402 | 7495 | int spoth = spot.y + spot.height; |
---|
7403 | 7496 | clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7417 | 7510 | // { |
---|
7418 | 7511 | // CameraPane.Ymax = spoth; |
---|
7419 | 7512 | // } |
---|
7420 | | - 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); |
---|
7421 | 7536 | spotw = spot.x + spot.width; |
---|
7422 | 7537 | spoth = spot.y + spot.height; |
---|
7423 | 7538 | clickInfo.g.setColor(Color.cyan); |
---|
.. | .. |
---|
7438 | 7553 | // { |
---|
7439 | 7554 | // CameraPane.Ymax = spoth; |
---|
7440 | 7555 | // } |
---|
7441 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7442 | | - //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7443 | | - spot.translate(0, -32); |
---|
7444 | | - clickInfo.g.setColor(Color.yellow); |
---|
7445 | | - clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7446 | 7556 | clickInfo.g.setColor(Color.green); |
---|
7447 | | -// if (CameraPane.Xmin > spot.x) |
---|
7448 | | -// { |
---|
7449 | | -// CameraPane.Xmin = spot.x; |
---|
7450 | | -// } |
---|
7451 | | -// if (CameraPane.Xmax < spotw) |
---|
7452 | | -// { |
---|
7453 | | -// CameraPane.Xmax = spotw; |
---|
7454 | | -// } |
---|
7455 | | -// if (CameraPane.Ymin > spot.y) |
---|
7456 | | -// { |
---|
7457 | | -// CameraPane.Ymin = spot.y; |
---|
7458 | | -// } |
---|
7459 | | -// if (CameraPane.Ymax < spoth) |
---|
7460 | | -// { |
---|
7461 | | -// CameraPane.Ymax = spoth; |
---|
7462 | | -// } |
---|
7463 | 7557 | clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
7464 | 7558 | (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7465 | 7559 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
.. | .. |
---|
7518 | 7612 | retval = true; |
---|
7519 | 7613 | } |
---|
7520 | 7614 | spot.translate(0, 32); |
---|
| 7615 | + spot.translate(32, 0); |
---|
| 7616 | + spot.translate(0, 32); |
---|
7521 | 7617 | if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7522 | 7618 | { |
---|
7523 | 7619 | hitSomething = hitScale; |
---|
7524 | 7620 | |
---|
7525 | 7621 | double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7526 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7622 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7527 | 7623 | double sign = 1; |
---|
7528 | 7624 | if (hScale < 0) |
---|
7529 | 7625 | { |
---|
.. | .. |
---|
7535 | 7631 | //hScale = 0.01; |
---|
7536 | 7632 | } |
---|
7537 | 7633 | |
---|
7538 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7634 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7539 | 7635 | sign = 1; |
---|
7540 | 7636 | if (vScale < 0) |
---|
7541 | 7637 | { |
---|
.. | .. |
---|
7615 | 7711 | |
---|
7616 | 7712 | scale *= 0.05f * Globals.theRenderer.RenderCamera().Distance(); |
---|
7617 | 7713 | |
---|
7618 | | - if (modified || opposite) |
---|
| 7714 | + // Modified could snap |
---|
| 7715 | + if (//modified || |
---|
| 7716 | + opposite) |
---|
7619 | 7717 | { |
---|
7620 | 7718 | //assert(false); |
---|
7621 | 7719 | /* |
---|
.. | .. |
---|
7709 | 7807 | |
---|
7710 | 7808 | if (modified) |
---|
7711 | 7809 | { |
---|
7712 | | - // Rotate 90 degrees |
---|
| 7810 | + // Rotate 45 degrees |
---|
7713 | 7811 | angle /= (Math.PI / 4); |
---|
7714 | 7812 | angle = Math.floor(angle + 0.5); |
---|
7715 | 7813 | angle *= (Math.PI / 4); |
---|
.. | .. |
---|
7750 | 7848 | break; |
---|
7751 | 7849 | |
---|
7752 | 7850 | case hitScale: // scale |
---|
7753 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7851 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7754 | 7852 | double sign = 1; |
---|
7755 | 7853 | if (hScale < 0) |
---|
7756 | 7854 | { |
---|
.. | .. |
---|
7762 | 7860 | //hScale = 0.01; |
---|
7763 | 7861 | } |
---|
7764 | 7862 | |
---|
7765 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7863 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7766 | 7864 | sign = 1; |
---|
7767 | 7865 | if (vScale < 0) |
---|
7768 | 7866 | { |
---|
.. | .. |
---|
7795 | 7893 | case 3: // '\001' |
---|
7796 | 7894 | if (modified || opposite) |
---|
7797 | 7895 | { |
---|
| 7896 | + if (modified) // && opposite) |
---|
| 7897 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7898 | + else |
---|
7798 | 7899 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7799 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7900 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7800 | 7901 | } // vScale, 1); |
---|
7801 | 7902 | else |
---|
7802 | 7903 | { |
---|
7803 | 7904 | // EXCEPTION! |
---|
7804 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7905 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7805 | 7906 | } // vScale, 1); |
---|
7806 | 7907 | break; |
---|
7807 | 7908 | |
---|
7808 | 7909 | case 2: // '\002' |
---|
7809 | 7910 | if (modified || opposite) |
---|
7810 | 7911 | { |
---|
7811 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7812 | | - 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); |
---|
7813 | 7917 | } else |
---|
7814 | 7918 | { |
---|
7815 | 7919 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7819 | 7923 | case 1: // '\003' |
---|
7820 | 7924 | if (modified || opposite) |
---|
7821 | 7925 | { |
---|
7822 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7823 | | - 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); |
---|
7824 | 7931 | } else |
---|
7825 | 7932 | { |
---|
7826 | 7933 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|