diff --git a/.gitignore b/.gitignore index 255c27e..a9a41de 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,6 @@ Tools/audio/eleven_raw_*.log /UnityPlayer.dll /UnityCrashHandler64.exe /dstorage*.dll + +# Intermediate halves of the remaster before/after previews (the composites in previews/ hold them) +ArtSource/Blender/remaster_v3_tools/previews/_panels/ diff --git a/ArtSource/Blender/remaster/Hand_Items_Review.blend b/ArtSource/Blender/remaster/Hand_Items_Review.blend new file mode 100644 index 0000000..f34220a --- /dev/null +++ b/ArtSource/Blender/remaster/Hand_Items_Review.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e413a4e731d4800937337b171f329978f4b0a172eb5afc8d2863e28e29820e4 +size 2886187 diff --git a/ArtSource/Blender/remaster/previews/Hand_Items_Review.png b/ArtSource/Blender/remaster/previews/Hand_Items_Review.png new file mode 100644 index 0000000..c4ee9fe --- /dev/null +++ b/ArtSource/Blender/remaster/previews/Hand_Items_Review.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d777b6bc2e669ee41b19cd7c14524a5c852fe3c04fadd514b5670579a3900415 +size 2237964 diff --git a/ArtSource/Blender/remaster_v3_tools/Hand_Tools_v3_Review.blend b/ArtSource/Blender/remaster_v3_tools/Hand_Tools_v3_Review.blend new file mode 100644 index 0000000..b04c0b7 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/Hand_Tools_v3_Review.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2103dd341f7b043d98edd67cba5b65950390bb234666c66ea88336f246c4502b +size 7468286 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_BeerCan.blend b/ArtSource/Blender/remaster_v3_tools/SM_BeerCan.blend new file mode 100644 index 0000000..d700af3 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_BeerCan.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d9d599af368bd7fc6e2f2919671a066b660a65443322ee5183db0e9ec9587a0 +size 220978 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_BeerCanCrushed.blend b/ArtSource/Blender/remaster_v3_tools/SM_BeerCanCrushed.blend new file mode 100644 index 0000000..85bb672 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_BeerCanCrushed.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32da8b454ea676e1245e9bf26418cdda5012d4bab160fd95feacb7714071eaec +size 386445 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_HandCan.blend b/ArtSource/Blender/remaster_v3_tools/SM_HandCan.blend new file mode 100644 index 0000000..fbfc858 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_HandCan.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ab548341f6002d6ade2ea625ed2224010b3314d13580d89060fbbe75d2b0eb2 +size 646262 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_HandCigar.blend b/ArtSource/Blender/remaster_v3_tools/SM_HandCigar.blend new file mode 100644 index 0000000..8302977 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_HandCigar.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d58ef3397b9a23f7ea0c5b87901f543483a2f272a5150127badd20c352a3749a +size 651813 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Phone.blend b/ArtSource/Blender/remaster_v3_tools/SM_Phone.blend new file mode 100644 index 0000000..759146d --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Phone.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97cd95c1edc66b2fab7fd8dee1d05a3263eb1e6e4d2f3445fceba0708e93e21d +size 227392 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_PhoneHand.blend b/ArtSource/Blender/remaster_v3_tools/SM_PhoneHand.blend new file mode 100644 index 0000000..5f4bb11 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_PhoneHand.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee241880f42ad1e6ea0d46c60286f3e589eb2bb9dbd5606e9f7fd00728929c85 +size 578000 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_GardenShears.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_GardenShears.blend new file mode 100644 index 0000000..cb2ced0 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_GardenShears.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0f3b3c3806c4daa9f833806174f8fafc1d3025ea8607f7fcc873e2047f48e1e +size 273056 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_Hammer.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_Hammer.blend new file mode 100644 index 0000000..123c9fb --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_Hammer.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:775a89244da59ec8d2d8910b1a5c7fa15ac3ed8a0b9c707d541d69acb633a4cd +size 383693 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_HandPump.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_HandPump.blend new file mode 100644 index 0000000..6fe10cf --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_HandPump.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34292e58bf56acbc41cbff6185a09957b67253d0a748957ab6f02efd83c5300d +size 467163 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_HydroCannon.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_HydroCannon.blend new file mode 100644 index 0000000..6c12a45 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_HydroCannon.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f35aac0fb2bb38d0f004417237c11914be9daa0ca809bcfc293225f8faa1078e +size 570906 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_LawnMower.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_LawnMower.blend new file mode 100644 index 0000000..a799422 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_LawnMower.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58392c189c2d646779c2598b8c33d0a787f5d6cf16d7c193810cbf67c71c6f07 +size 401479 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_LongScythe.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_LongScythe.blend new file mode 100644 index 0000000..1ab872d --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_LongScythe.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57a878dd2d445ea68926b492eb5bb55a302c499382b6d9d04d8c570ccfb7b4fa +size 512752 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_MegaSiphon.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_MegaSiphon.blend new file mode 100644 index 0000000..f38fe89 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_MegaSiphon.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:168b1875c807a5bbb3f00ef27a5d0b1d00480bea23d73b21ca9fa83b604738ca +size 598556 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_NailScissors.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_NailScissors.blend new file mode 100644 index 0000000..3d8db94 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_NailScissors.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb721bac8a9527493ec9ca69502d751c88bc00d3bd08b5b41344486a7278ae37 +size 197963 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_Scythe.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_Scythe.blend new file mode 100644 index 0000000..8b1f1b9 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_Scythe.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5678dee82f1325a4113a89e7e995315547191e9d3f1815238cfda0c70f68d4d +size 470473 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_Shears.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_Shears.blend new file mode 100644 index 0000000..cb2ced0 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_Shears.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0f3b3c3806c4daa9f833806174f8fafc1d3025ea8607f7fcc873e2047f48e1e +size 273056 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_Sickle.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_Sickle.blend new file mode 100644 index 0000000..00b161d --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_Sickle.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3876e3cac7733ea6a5729cea58da996365336c33d712e1ce99b8c16c8fc99432 +size 363083 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_SlurpGun.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_SlurpGun.blend new file mode 100644 index 0000000..791d6c3 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_SlurpGun.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aec6e968cfdf9c4bc33c2ef1f4b155466f12e4789bd62bb01af5ca9e86a6664e +size 591656 diff --git a/ArtSource/Blender/remaster_v3_tools/SM_Tool_WideScythe.blend b/ArtSource/Blender/remaster_v3_tools/SM_Tool_WideScythe.blend new file mode 100644 index 0000000..40bb863 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/SM_Tool_WideScythe.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53950b1797ae1f7b095df11ee3ead1756b625636b9b4fe627cbd083c074d5bde +size 487808 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_BeerCan.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_BeerCan.fbx new file mode 100644 index 0000000..76bddc9 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_BeerCan.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5cadd995586774df422e12a598c247c7d207ed3cc5982a14c1ff5b836e8326e +size 201580 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_BeerCanCrushed.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_BeerCanCrushed.fbx new file mode 100644 index 0000000..6283d63 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_BeerCanCrushed.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9b869602e745f4c3ae6b6cfeb8b369e0a14c159f0ebf155684c2de16b522b87 +size 442748 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_HandCan.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_HandCan.fbx new file mode 100644 index 0000000..f6624f2 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_HandCan.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1aadf412e43bdc458aec0c73317b5aadcacde8bfa9e8b5004b94372d6f0702f7 +size 616316 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_HandCigar.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_HandCigar.fbx new file mode 100644 index 0000000..d6e7f1a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_HandCigar.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:957ab76452940e779dfdbe511d9c4db3535c904327b268dcfed9a90fe0ec6a56 +size 614252 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Phone.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Phone.fbx new file mode 100644 index 0000000..ace615a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Phone.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6231c21fc691a935b499b04d9ca59a44f169d6908026a92e52654493a77f2e73 +size 186652 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_PhoneHand.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_PhoneHand.fbx new file mode 100644 index 0000000..747cddf --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_PhoneHand.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e5751f3a77cd8498e57748fa92449d1f0b01d488a10b73562700608d58a6ebc +size 479500 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_GardenShears.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_GardenShears.fbx new file mode 100644 index 0000000..59083c5 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_GardenShears.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4770893bfeb2e8bc9e1dddbe684f1c5c88194288d3c4eb6690ba06fd404e8d42 +size 305692 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Hammer.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Hammer.fbx new file mode 100644 index 0000000..3f2b840 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Hammer.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60f9e4082c775240ce5efb542e0788d25c491cc267d39e75b49e4e1bde88b777 +size 366716 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_HandPump.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_HandPump.fbx new file mode 100644 index 0000000..df75abb --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_HandPump.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87496b8f9f80f53a596115e524be0c6900c7f30aba478d38abe094a78a25d302 +size 528524 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_HydroCannon.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_HydroCannon.fbx new file mode 100644 index 0000000..ed24da2 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_HydroCannon.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f5ee62c9dd726bb324d4dced679d87bb57731af7dc4f13b0e8272ccbaf448bf +size 666236 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_LawnMower.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_LawnMower.fbx new file mode 100644 index 0000000..d99d47c --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_LawnMower.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3b931d373fd5e98bb5a914c46a922b95281d8ca70a7cafe9dfd77d2b5f2012f +size 597420 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_LongScythe.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_LongScythe.fbx new file mode 100644 index 0000000..bb19057 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_LongScythe.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18bba10dec4f810a4c32b56c11a28d5983b12d9b3260aaf3a4c6870e17332492 +size 580556 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_MegaSiphon.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_MegaSiphon.fbx new file mode 100644 index 0000000..d407feb --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_MegaSiphon.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5752da1f5d0d61329544c104938b46d348d85abadfb64886ebc79dd5eef17313 +size 723740 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_NailScissors.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_NailScissors.fbx new file mode 100644 index 0000000..520ab72 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_NailScissors.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b8928f899f87752d69a469e86fd3f09c8e1aefc0161b6323ed5a52b29a35670 +size 216764 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Scythe.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Scythe.fbx new file mode 100644 index 0000000..b3bc5b6 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Scythe.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52b01bbbe74b499364fab72fcabccc53fb244cb1c5e189461f4a0168cda0c4fe +size 528460 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Shears.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Shears.fbx new file mode 100644 index 0000000..9cf777f --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Shears.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:feee7fc998fc6a8b824fea692f3b12b7f0de3c5c59ef774046b1858c2c8ab52d +size 305692 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Sickle.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Sickle.fbx new file mode 100644 index 0000000..fe492fd --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_Sickle.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f888af2229a9d531814570dfd7815ded2890c244b8f6d2a3daa4e50fad0f0a3 +size 353260 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_SlurpGun.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_SlurpGun.fbx new file mode 100644 index 0000000..b37dbfb --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_SlurpGun.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2397f8e513822f4ae8cd78829016f443cf38c7df60457d35a4bb904ce9b11c4 +size 688844 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_WideScythe.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_WideScythe.fbx new file mode 100644 index 0000000..2daa87a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/SM_Tool_WideScythe.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d68478c1f2d6110b3d3b58e4d5e4ba37f66dd68e81b7584371912f930ce31d7 +size 559100 diff --git a/ArtSource/Blender/remaster_v3_tools/fbx/_ref/SM_PhoneHand.fbx b/ArtSource/Blender/remaster_v3_tools/fbx/_ref/SM_PhoneHand.fbx new file mode 100644 index 0000000..cfd3091 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/fbx/_ref/SM_PhoneHand.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6756702d8386cc119e9e010e000b5da828894488594d8e6bfdec5f26a5900136 +size 110748 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_back.png new file mode 100644 index 0000000..aac5f8e --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0395eb23142dc60d456594553b1abb4301a256b1dc375f5401e155947d8819bb +size 644468 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_full.png new file mode 100644 index 0000000..abce4b1 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a71185c3b7d1c1a9fe677bf21335c6fe6a8c78bb4146dd1c8634241545493be4 +size 629615 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_side.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_side.png new file mode 100644 index 0000000..747ca62 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_side.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92f6708d77424903b27f591a80e915ec7b0291c7a99e3353f316021dcd3073e3 +size 592823 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_top.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_top.png new file mode 100644 index 0000000..04ddd7c --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCanCrushed_top.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9ceceaba8809931ee2a19827186928222b3aa0b1b1c5949979bf95632d637dc +size 678208 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_back.png new file mode 100644 index 0000000..918b7e9 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bf7e0a0c43a97c7effc28407122642bd858a334b0155d1c384fa9c756051c9f +size 587026 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_bottom.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_bottom.png new file mode 100644 index 0000000..ece2e5b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_bottom.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6b09a8559ec26be330edb554db2b25591201de933fc8d4710ecbe2817d2d86c +size 694378 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_full.png new file mode 100644 index 0000000..b782b3b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b88c6ff480e769006ab48051c5b1d69370ede8ea1dae156667eed42df6c2dcb +size 592948 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_lid.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_lid.png new file mode 100644 index 0000000..35f9818 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_BeerCan_lid.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c81cec0478af9837052eba3bd006ad021ca95ad985dc2a67f440bdd6ab1e6d4 +size 846455 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_back.png new file mode 100644 index 0000000..e6a53e0 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb0d1b7bd0539c565b4f90a53d91e295987a5f0dc1b7000f2efd9fb7a8c9d92d +size 602353 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_bottom.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_bottom.png new file mode 100644 index 0000000..87c6626 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_bottom.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7de2600366cc009ab476bc1f9869f3d71474098a8aef6c8bfe697781b90db1e +size 809995 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_cuff.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_cuff.png new file mode 100644 index 0000000..75e0893 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_cuff.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:657025af5b4f25000928f61e4ec74e269a1db5a4808cb5d356a3a7126ef0f87f +size 743089 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fingers.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fingers.png new file mode 100644 index 0000000..03f3b82 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fingers.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2015c6332f8c184c064268c1fab4fc47812b77fe2bfc4a3daf169909774d266 +size 746523 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv.png new file mode 100644 index 0000000..a3f2cfa --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a3d5068e482236161cb30cdb47682d3fc0c566c449c25d503524104aac8675f +size 642682 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv_drink.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv_drink.png new file mode 100644 index 0000000..bfa3f58 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv_drink.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f53d32dc059a1246d65e136150f6e56cfd28e0ceaf34570a3cf09f544837d9cc +size 686209 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv_hand.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv_hand.png new file mode 100644 index 0000000..004f096 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_fpv_hand.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a243544c213a68e88a5cd509f2a03c4b3c778a687b5911106bb07f3d7801adb +size 669682 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_full.png new file mode 100644 index 0000000..1f757a0 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e6ffe9cc1ee251d1f638af31f129a4f7bb8d43fb35313bc28d2b78b9fcfe129 +size 564258 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_lid.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_lid.png new file mode 100644 index 0000000..ffc55c4 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_lid.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90a3ffe29e2d8e3748ec8900c4112d200033bcdcb095636a73a8c46afb46001c +size 973759 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_nails.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_nails.png new file mode 100644 index 0000000..c4838e4 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_nails.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df4c2a54beb76ec7c3a2c8aa57b3c3f0da37e5a18f3cb303c7f7ad52506c31ef +size 756511 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_tab.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_tab.png new file mode 100644 index 0000000..54de911 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCan_tab.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcfe380560f95aad1fbe3ed85509f0ecfa46a85e6ef8702211fca82c5136e8a0 +size 926472 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_back.png new file mode 100644 index 0000000..10182bc --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26a6d5a40ff0e0a96b3f0f7ac508ced2a30cfc1ad9596d2c2e44f72cab6eec1e +size 602073 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_band.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_band.png new file mode 100644 index 0000000..c3408cc --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_band.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1562d222e98a4150f18222426662d71c71ce0fe835b6923ee17396ea0a3f2110 +size 711726 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_cuff.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_cuff.png new file mode 100644 index 0000000..1e43284 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_cuff.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:337d07a01f2fd5b8f8f846ef08bf0a7162ad4223e1a806ad8785cba52361857c +size 618815 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_ember.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_ember.png new file mode 100644 index 0000000..e48c53f --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_ember.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5962d9dc1e282c0bb296cf83cf701e09379631a671b6275d6cc769e2c8e73ade +size 751444 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fingers.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fingers.png new file mode 100644 index 0000000..fb0647e --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fingers.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0e0045e677e23ae71036e04e3d0d739dcbc86df3fddef6e43bd99909356e453 +size 758222 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fpv.png new file mode 100644 index 0000000..af80ff5 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61256bfb5bb0f067b0be6f2865b59e5e1dba087c29d2bd52c31c55b16f96c418 +size 613781 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fpv_hand.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fpv_hand.png new file mode 100644 index 0000000..bb3da3c --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_fpv_hand.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56e16908a2d36a2b7e0caa7c86726d92f49bfe6ed7d9a657a03453fa394346b0 +size 658745 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_full.png new file mode 100644 index 0000000..c11cea9 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_HandCigar_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c5449785ff5233050657a7c1716b698856a7253562f33227f274dde46a41a37 +size 547634 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_back.png new file mode 100644 index 0000000..e83146f --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc3ea1585a38d563ac7f4be2b31fa2395aff177a4d5b46e855c9aa56086822ef +size 585923 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_fingertips.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_fingertips.png new file mode 100644 index 0000000..63fdc6a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_fingertips.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c09a3f6e7f763208664e8b9a120e8257ada8146920ec4d6293a71fca6475247 +size 573480 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_fpv.png new file mode 100644 index 0000000..ad5ff29 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a2339a13da4b4cef4e85a1cb597c82f51f0ad56a352d7ebfd187c79a6db8464 +size 696539 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_front.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_front.png new file mode 100644 index 0000000..1607ac9 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b548fd1ff6a618b6b6aa2cafe968feff1fd9dd8842d6f8ad3a506a282b86835a +size 534298 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_knuckles.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_knuckles.png new file mode 100644 index 0000000..a4d2faf --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_knuckles.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1742dc1b6235a6e5320bb4d4a30a6b7ec9e3b6683bf7dd120191fdf85df61e66 +size 709859 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_thumb.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_thumb.png new file mode 100644 index 0000000..63ed940 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_thumb.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:183f2461a0b180fbaf8835eed6648f5206001853fdba8a3493dd7a488405e0b6 +size 663823 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_wrist.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_wrist.png new file mode 100644 index 0000000..8a3113c --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_PhoneHand_wrist.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9b4f7a5e95fc581980e8146de8767fc00f617366c4f05c86001c36a27de13ec +size 610112 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_antenna.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_antenna.png new file mode 100644 index 0000000..15097cc --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_antenna.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:097a066e808c90322324869cad73d7eb9a344c5011d6ed1832ddb18de7139251 +size 534166 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_back.png new file mode 100644 index 0000000..8fedd65 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:730360e4ac03afa5f1390787a2e2e5200d642c3ef1eb3ef8d54d1a2305cacc9b +size 542590 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_bump.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_bump.png new file mode 100644 index 0000000..aad74c5 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_bump.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3eace628d6a4277451b3d19174a3614483ba5e228ff43c4f7ee393ff8031a9d +size 633237 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_buttons.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_buttons.png new file mode 100644 index 0000000..9e16d20 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_buttons.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef2a2e33498468a3adb18122e10a82b9d06231b23fb3ba2ce8e1ce8ab8139ff7 +size 562767 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_corner.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_corner.png new file mode 100644 index 0000000..51f0343 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_corner.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95cbee8dce0d2a7cae1078b613256906ebeceb09afea45e6dd6743223fd7a383 +size 510936 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_fpv.png new file mode 100644 index 0000000..97619d1 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:198375bbc77c92ed1a22fa3deb1cbb2c5f81814f76ce00e3ec04d4dbd0fe629b +size 639292 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_fpv_up.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_fpv_up.png new file mode 100644 index 0000000..e8dc82f --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_fpv_up.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d8365493feaac2c9d3f85c690de70d334b981348e48a25a610c9589512a9d91 +size 624793 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_front.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_front.png new file mode 100644 index 0000000..bab0f80 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c83e9b1ef44b4ee30bb63708a3a4cff46307c4b1072d39af32687f0b61880fce +size 481448 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_guard.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_guard.png new file mode 100644 index 0000000..070e0f2 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_guard.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0e0066aab37dc717c7009bf4e371a94225eaff572049f368bc340ef1e4f8976 +size 531697 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_port.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_port.png new file mode 100644 index 0000000..7801110 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Phone_port.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:057b2d7c6f70c192ac6deae59885a46ff2a94999182a3c9fc356d67bbac0c11f +size 497076 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_ferrule.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_ferrule.png new file mode 100644 index 0000000..572b463 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_ferrule.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75b9afca28d86d81496554d796e7e6445ed1fe185436c2c3042803e23d8acc9e +size 774727 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_fpv.png new file mode 100644 index 0000000..5ea3f7b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bafe6bc4d868007e7091948e2f5db68b23770cc03d1697502dc68c7a4bee2ebd +size 715605 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_fpv_use.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_fpv_use.png new file mode 100644 index 0000000..1c46505 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_fpv_use.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:792060e0aedab81a9a4dc1a652394a36aa702f105b8a89f77c60c6cc55f362d3 +size 692300 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_full.png new file mode 100644 index 0000000..3cf8a0b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59168953056f52b835dcaa7259801ca49e3e50dc2780a04af41078ce7bae7fea +size 558460 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_grips.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_grips.png new file mode 100644 index 0000000..7c8f122 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_grips.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:540eb7fc94f0e4f59575ca0f6ff2d590aebe12b13c15be9e79603646830fd632 +size 682094 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_notch.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_notch.png new file mode 100644 index 0000000..0ecb918 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_notch.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f622b13592003ecd3d7c2356804e693d38447429d0369e883700254170734566 +size 615161 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_pivot.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_pivot.png new file mode 100644 index 0000000..c2987d5 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_pivot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:811f384e50741f60efc16e2dbd8cf2157429f43cae90f7750500d76ed8d4f5d4 +size 760615 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_pivot_under.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_pivot_under.png new file mode 100644 index 0000000..1b0be24 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_GardenShears_pivot_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8b30210b610bed07e1ebc60b088b2042ec4fb1a8d896d59a5222678c1b376be +size 695311 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_boss.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_boss.png new file mode 100644 index 0000000..15a408b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_boss.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4200f511546d8293ecfe2f9446a18a8141f5cb10631a63f4f157c8ef9b1e9431 +size 641568 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_claw.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_claw.png new file mode 100644 index 0000000..b4abd55 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_claw.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27c95873e0f74e43abafed8c363b6db1065b6fb9b8fbf6927cfad97784a301c3 +size 614609 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_eye.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_eye.png new file mode 100644 index 0000000..ad8d64c --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_eye.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbf91ed1f5ee4e91da412ac1027415127e3ec547e4336bd5a4709f50f7599678 +size 680462 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_face.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_face.png new file mode 100644 index 0000000..6923c51 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_face.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f46270ad67d6fef7fc46982ac7da626a8f94919f43f47ccfe0814ef53ae331b7 +size 677748 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_fpv.png new file mode 100644 index 0000000..69b0d96 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:934e0e9d318fba80825b657a6a2dc4666c211a4bc9e5efffb90addb065d0b14d +size 654534 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_fpv_use.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_fpv_use.png new file mode 100644 index 0000000..2766223 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_fpv_use.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e71dd9f202b2af1b2cf60da950414057b964f0ed1397b30595210a1080c02225 +size 655029 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_full.png new file mode 100644 index 0000000..39288d0 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9433455a4e9232ec7088f8fd4a81f0c4fb3c31c2e338a2ad0ebe639a5f2079f4 +size 563723 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_grip.png new file mode 100644 index 0000000..92ca617 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86129ccb886d33af9ad5de92e8d9623cff2447759faff211baca6ce1640124cf +size 577349 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_head.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_head.png new file mode 100644 index 0000000..1a79ad5 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_head.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80bd8a7619c8c123210d6f65df2c85e265ebf820bed3f99471f6d8a35a617f18 +size 678126 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_poll.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_poll.png new file mode 100644 index 0000000..22d805a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Hammer_poll.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6897311b1a689c6a0764458707153e24b3b22890abf8e74108d28fb84e83e084 +size 692343 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_back.png new file mode 100644 index 0000000..fd95efa --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44e12bf6fc5f95343bdae21aff2d62d133e1a22ae0967a3610b4e22d82659177 +size 746695 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bag.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bag.png new file mode 100644 index 0000000..abdb9bd --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bag.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:310e237da419c8f38fbeb22e3cbc279454db52d915a1ceda1e27a364ba8a7325 +size 1171386 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bar.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bar.png new file mode 100644 index 0000000..33ff315 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bar.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:412122795148f4fb6fd9a3d0199f5ef995c66414ad5424e4b3a1be2da111a5f6 +size 779346 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bar_under.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bar_under.png new file mode 100644 index 0000000..b36ba00 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_bar_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d3908b2fc4d33f42fc72ac120d278545e72c21f8af3a74ef5ea1c4088c46e62 +size 804315 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_buckle.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_buckle.png new file mode 100644 index 0000000..0ef03a9 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_buckle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98fe769a33551b1b171bbacbbc88d672fff963679902dbce018b971e82fc618c +size 1165490 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_flange.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_flange.png new file mode 100644 index 0000000..fc9a5a4 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_flange.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe36549142838e75857c541dc94e7b7e2a8fd42ee248b80cbc4b38f174a7738e +size 912211 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_fpv.png new file mode 100644 index 0000000..0ef9407 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e47a40f970a065681dec2bbf4ddeeb747c1a8fffc789b1aabfca7a9131071406 +size 814465 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_full.png new file mode 100644 index 0000000..06ac878 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c94f1f67b2c5b34b45fe33d5db76a595fb6fa56a6ed53ef1cb6bb3d3e020f70 +size 693869 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_gearbox.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_gearbox.png new file mode 100644 index 0000000..8584df1 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_gearbox.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3635264445a9808602b49acf8240a9e28d0bfe22c607bfdbc3abe73cb97f2a12 +size 1055851 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_grip.png new file mode 100644 index 0000000..e9f00b6 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e2645f011c4ee0ed54a880de4a6f200428f275d5d7ebd4ccaf33e0c64068a43 +size 839282 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_grip_b.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_grip_b.png new file mode 100644 index 0000000..e1b4599 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_grip_b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:260898d27c1469825aa99af95534d020cb6b10de75bb8949f9c102d25d82d144 +size 877594 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_handle.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_handle.png new file mode 100644 index 0000000..0f0fcc6 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HandPump_handle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35f7c73dcb707f674404beda205d5bd986707f966db663b57c3dc708867f5e69 +size 790303 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_back.png new file mode 100644 index 0000000..59b8524 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:feade3b74a99419990c909e26bfd006b97e6fea2f4c7b3391ac185f35d4c4ed8 +size 799250 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_carriage.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_carriage.png new file mode 100644 index 0000000..8111edd --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_carriage.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62666546372ce189f67a942e22dfb5a58f6a2a8ef7409a29b4bdbeb25b141b00 +size 898621 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_engine.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_engine.png new file mode 100644 index 0000000..2a4cdc0 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_engine.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8843e803d2cd2f5f4e17f5b172ea0f54fd48c6f719b0a2732ee1b28032ee6b07 +size 1158723 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_engine_r.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_engine_r.png new file mode 100644 index 0000000..7e63d45 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_engine_r.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:995c08310ec33c9d11c8d0a702b522acbc5ede7633e50d2839f6b4b323888d1a +size 974441 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_fan.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_fan.png new file mode 100644 index 0000000..f0ebbe0 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_fan.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91ad7ee82b68f4a3711bc12139cae4197218f5a2fbcc29b1ec7bee1b1f5e9203 +size 942574 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_fpv.png new file mode 100644 index 0000000..4651418 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35776f73a51fc5b6f0e3abb4a5cf33aaf3ed5d1c2ea1f7de74bbde76906d5e95 +size 799229 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_full.png new file mode 100644 index 0000000..2abf740 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0b6a7b94225e1e98c83984c7dc3831585ee9e1ff78967d7a962dc78d0cd045d +size 810302 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_grip.png new file mode 100644 index 0000000..11a17d7 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b0d315802886ec4d734a1a19959e40fd4d434f8c7fef74bad5df9ff68bf1693 +size 870386 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_hopper.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_hopper.png new file mode 100644 index 0000000..fca70ea --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_hopper.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9faea97acdbc892751f8030459b5bfccc0d767c32bd954f4100d4ed1bc6b0d45 +size 1254998 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_lockout.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_lockout.png new file mode 100644 index 0000000..b9dbde2 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_lockout.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9208cc89eee27ae069564e7fc8976d5eac01ee61cb8481a64b1ef0ca8a1f8a44 +size 799847 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_mouth.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_mouth.png new file mode 100644 index 0000000..fcdc650 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_mouth.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8dd331207602702c5a3ab59ff52f2fe97c49ed99c288689062d468283d20c012 +size 873458 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_rails.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_rails.png new file mode 100644 index 0000000..95a7adb --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_HydroCannon_rails.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61f0de990d246924511c69d5d2009f5c94e97ca36c9019286fc31a22bab8b524 +size 1114141 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_back.png new file mode 100644 index 0000000..fccaa7e --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6db4706a5113bb96932ffeced70c1ef7efe3efc0c64339fcf9ceba9affac6aef +size 779685 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_bag.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_bag.png new file mode 100644 index 0000000..6ec9879 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_bag.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9f8d31989bce5b3b4df4bdc8933554fcfc678e2cf2031e707ed4214787dd470 +size 892621 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_bracket.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_bracket.png new file mode 100644 index 0000000..84bd24d --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_bracket.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e47f9123a1c1498566c0c0b4ebbd6d3fba1d4b70475cd76a1ffea4171d4701b2 +size 962944 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_deck.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_deck.png new file mode 100644 index 0000000..3784a79 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_deck.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:404ecf07263a1a0dc39119aafb8d56baa1ddeb15cf79630f2c9926909ce64a6f +size 960038 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_deck_f.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_deck_f.png new file mode 100644 index 0000000..4db727a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_deck_f.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85f7356934aead6a1cf4cffb77dc036161e0ce5e83ca7eb3e0e4d4155f27d3a0 +size 919598 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_engine.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_engine.png new file mode 100644 index 0000000..6feaf9d --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_engine.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a8c6954283d965b198d9bee8531bee9cabdc4a61749777f2d3504f5657b9623 +size 983856 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_fpv.png new file mode 100644 index 0000000..015d016 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74e685ff61f28247e0a0d76be31b2cf91cfbe480dc397d2d3a3f43fc61560749 +size 839601 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_full.png new file mode 100644 index 0000000..afd9b18 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80969004d49c5bfc38098bb6cb16b517d598200dbdd7ab626c43ce9debd083bd +size 801703 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_grip.png new file mode 100644 index 0000000..0654e14 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1d708703671686f389b0e538bb9d2d93d85237938a7cc76a26e744630e86a2e +size 841100 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_lever.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_lever.png new file mode 100644 index 0000000..aa6e80a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_lever.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba3a88991092b3a70dddb2acf66f57df7e26b2c3c58691003690cef696a625c5 +size 932859 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_plug.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_plug.png new file mode 100644 index 0000000..d4f152a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_plug.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3d0db8d3dcdbbd45b45ef4df758e04dfb12ad5d3083af81c9ce93b2d1f265d7 +size 918024 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_under.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_under.png new file mode 100644 index 0000000..670a289 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c788c9d43812cb49cae0dbbb1f046b5769d1d8edffe40535fca30ee7da5d7922 +size 744052 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_wheel.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_wheel.png new file mode 100644 index 0000000..54554d1 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LawnMower_wheel.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b2d583f143ba0cb553f24b656abfb34a27201949c26743b383be5f39c287f10 +size 815981 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_butt.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_butt.png new file mode 100644 index 0000000..f74a5e7 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_butt.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9cbc54f844c91411e3131fe507822f48fdcd4adcbd69f26a044e7ee92c81464 +size 685886 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_cradle.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_cradle.png new file mode 100644 index 0000000..4ffaada --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_cradle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d8f805cacfd35c53424bc89acab37fd35416bba44a5fbe2f347596704604678 +size 741864 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_cradle_post.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_cradle_post.png new file mode 100644 index 0000000..71752f1 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_cradle_post.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a55176317da8617e356e082ab0e327b477d89b4d790efad2ffc509bab51ef895 +size 718652 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_fpv.png new file mode 100644 index 0000000..da59c6a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:def56efe07e744b25fafe8e5ecce9a247c9816fd4c4b718bfda5fcf0e8ffac4a +size 743283 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_fpv_use.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_fpv_use.png new file mode 100644 index 0000000..858f389 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_fpv_use.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33dc5ba703c2d64d3214caf9761929ff93dcf3199a869158fb438938dcd3c984 +size 746278 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_full.png new file mode 100644 index 0000000..7d643cf --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f6e83385b67426d2df184f7d003ca1b3e204283c5922883be089e02320f3220 +size 637940 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_grip.png new file mode 100644 index 0000000..55297a4 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:819612af5238186aa0337024d2d558296d3b86878dfc2929e541c9d601f4490f +size 644852 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_mount.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_mount.png new file mode 100644 index 0000000..7453e4f --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_mount.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b99ce8a5257523604275b3a983e48dab90a711572e7551fe88720c3324776aa +size 643999 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_mount_under.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_mount_under.png new file mode 100644 index 0000000..e5c8e78 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_LongScythe_mount_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1032b2af52f0c5b2c02020c50c471f75dc32131a7b5c44849e4e432528116b83 +size 769043 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_back.png new file mode 100644 index 0000000..dd6b5eb --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab0dc84d6efd18597344f41c0b7591876b1e30c9bb5b183f0f2d37409704209e +size 845488 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_chain.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_chain.png new file mode 100644 index 0000000..6d68cf9 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_chain.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f089bbaa8c2bdd6bc3cc1803d22bb6608da66d69059a6e70446a268cde8b53cd +size 984213 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_chain_r.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_chain_r.png new file mode 100644 index 0000000..f16431d --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_chain_r.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:572732a7960e0a773ca75713d9b3737f8052e6f389b9174206e5f25e101272c1 +size 884633 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_deck.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_deck.png new file mode 100644 index 0000000..80f15f3 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_deck.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e9e2dae560f92cafceed055dd7bfe78adff54e93f486777358b3bc77704c0c7 +size 1100217 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_drum.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_drum.png new file mode 100644 index 0000000..06e8dc0 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_drum.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a92aef8e295abc932490e203b72fd9aac78a7059f0b9e80497d5c487e5674318 +size 959224 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_engine.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_engine.png new file mode 100644 index 0000000..f34a021 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_engine.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0cf93442047576d288fa0eee4b3d1a1d7d96e07b1d3f63c70017ada1df704c4c +size 1037407 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_fpv.png new file mode 100644 index 0000000..2531d93 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ffec8f001ea7c150b6433ae2c090516765fbc8211a59784aebba82f4b0f745f +size 783503 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_full.png new file mode 100644 index 0000000..0cdf1da --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc966e70f22a032c0c46c5fd012f69a6c184fd89b4b3608aabe5a2869b88a2fc +size 818985 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_grip.png new file mode 100644 index 0000000..4f1207c --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9a8b0e1f5a8e62c71a1cefb16e50da48b453a2157fd8b52380b4b81c694e732 +size 747369 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_hub.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_hub.png new file mode 100644 index 0000000..2c06f5a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_hub.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf183900f767a8ae87ef6c00bffe63caf992a668423939c2459b142e813d5a4d +size 942372 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_rail.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_rail.png new file mode 100644 index 0000000..f496081 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_rail.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1d63258a8ead053af4386616789d2da9ea9990aa9403b845d1b9cf652012168 +size 890998 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_stack.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_stack.png new file mode 100644 index 0000000..dd7f49e --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_MegaSiphon_stack.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c06e1916f409f866ef384a423aec97dc6c84cc6d1c79aec18c489c58fe8bca84 +size 821117 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_bows.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_bows.png new file mode 100644 index 0000000..b2e2b22 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_bows.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb72d6635e0e0fed691da1d6ef3101022323b7846645a9a04b71a4dec9674f25 +size 628087 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_fpv.png new file mode 100644 index 0000000..1bdffe7 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98a3639cb37a71a333686252641c43b3cd312355c72c9c52a807c96cee98add2 +size 650896 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_fpv_use.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_fpv_use.png new file mode 100644 index 0000000..e20602b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_fpv_use.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b3638d17ec205b8e19c66365ddbc46e0fe1b34b95248e415fe27e19ccad2296 +size 640815 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_full.png new file mode 100644 index 0000000..c8824be --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:519434b5acee6465a6ce082f58ea912ef5ff3af7985e1c8a42d06d75629a3def +size 541979 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_pivot.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_pivot.png new file mode 100644 index 0000000..cc6e173 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_pivot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19a2318efbf97a38938d76dbd7e90e454c892a09201d7f0b1da41260a125802c +size 719038 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_pivot_under.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_pivot_under.png new file mode 100644 index 0000000..5b5372a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_pivot_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b4e16dcdca1f8b203f8f03f545576306ca7c645dece615d37936a02fa418306 +size 664028 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_rest.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_rest.png new file mode 100644 index 0000000..14f8265 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_rest.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad382374e8db6a47c2f0a0c7f456a8be5397c9b620fb9f68d269b2d963955fab +size 591676 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_tips.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_tips.png new file mode 100644 index 0000000..055427a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_NailScissors_tips.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3beb3ec394ca4ac5fe6405a0615f3bab7e4534ea09edb98ce84ab54e4af50f45 +size 565072 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_butt.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_butt.png new file mode 100644 index 0000000..ab7bb75 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_butt.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:998b7f5601bc62d20cbd7d3a1a6a3ed6774a18b728371f3e928a6b8ab745201e +size 689073 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_fpv.png new file mode 100644 index 0000000..813b68b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d53ada060272345b258117819527179c0c743e86b4457f659e192d019afdc694 +size 699189 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_fpv_use.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_fpv_use.png new file mode 100644 index 0000000..4633d2b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_fpv_use.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f18d3beba040a2c8dbb3e8ba53dbc88f4ac3bc2b00cf4e3f14eca84483e7f3f +size 701352 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_full.png new file mode 100644 index 0000000..712dbc9 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b57cf3096fdee2fa8d4a74b67b08d516625acb352ddf3e7a3a12e13a97391c46 +size 586078 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_grip.png new file mode 100644 index 0000000..9df2dbb --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d116f50c10c44f3a911603dccae9fc2d293815c0ddf96f1f692975f2c6520db2 +size 675545 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_horn.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_horn.png new file mode 100644 index 0000000..9a5f815 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_horn.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a95d35619f462ca82c0e3a79dd0e621f8c33526662f6cead27f5e1628e9346ac +size 615353 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_mount.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_mount.png new file mode 100644 index 0000000..83e9adc --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_mount.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:173d5fc38965f91c40ce244a0b9667cffc6ee5463bb036f95fa420349bbce109 +size 669648 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_mount_under.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_mount_under.png new file mode 100644 index 0000000..1f5f6c2 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_mount_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5231cb666e721199d9344f93a9f5b97857b38f66cc82bc30a1e42fe29167862 +size 697930 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_nail.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_nail.png new file mode 100644 index 0000000..c9a63db --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_nail.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76306088d83af23ac0461f4cfc358a0e31681222971db54fdb982d809a7f84f9 +size 687750 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_wedge.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_wedge.png new file mode 100644 index 0000000..715f57b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Scythe_wedge.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdca1462a7c1083cba45c0455d05c658b32f355f8daae367b46b6dab2bf3c6a9 +size 918530 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_ferrule.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_ferrule.png new file mode 100644 index 0000000..d833257 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_ferrule.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff1f96075376cbe8cf005d35844fb6ea05615b33fb1ee600ec9fc64d7d45ac80 +size 813984 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_fpv.png new file mode 100644 index 0000000..cddc361 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7044187f592e72c6f8cd8bcda37a8f1de82657464dec5d96cb128494411a531d +size 727074 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_fpv_use.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_fpv_use.png new file mode 100644 index 0000000..7185a6a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_fpv_use.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9552d5cf4a4851cbc0271f7736a3e2d534bc9729a766c43f56365fe92be983e +size 705424 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_full.png new file mode 100644 index 0000000..ca13894 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c16409157176f5e71fd9f871cbb2724457620b0cac6296fbb91ec5e42ba6dcdb +size 609254 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_pivot.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_pivot.png new file mode 100644 index 0000000..108c12f --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Shears_pivot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff484bd31c36d027925675eeb1febc0f87c670a3414742c1dd57899e335e314d +size 891315 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_blade.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_blade.png new file mode 100644 index 0000000..be2e154 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_blade.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58a86d77f72ec6b90a9f4806e3d0895e81fcf6c976100cae850a39687c1c4501 +size 638232 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_fpv.png new file mode 100644 index 0000000..fabd1a6 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9aa0b4b00aa86ed0df3e740112c578318de95e625745db56c55ec82a5a9602c1 +size 672403 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_fpv_use.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_fpv_use.png new file mode 100644 index 0000000..49b56a8 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_fpv_use.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f93943b22fbe1e08dc6bacd7223f9d21d9530b81c6103ed6d28bab03e9796ae +size 652036 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_full.png new file mode 100644 index 0000000..3bf5f19 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f53b5c103cf620b7731fe44d2ce3129444091ef3fd6a4219181b559564d1387e +size 573633 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_grip.png new file mode 100644 index 0000000..57bf8c8 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e253a3c9762dae8f5f3dd77b3f2f2077d5c600c4839a4c85fd9a08648c96d391 +size 596147 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_neck.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_neck.png new file mode 100644 index 0000000..1cb742e --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_neck.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:302f9d02a929f490d8cc883810e675dfe50ba86d80af054e2279c5a5d19f877b +size 767037 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_pommel.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_pommel.png new file mode 100644 index 0000000..fe72615 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_pommel.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08688b46194ae88d7abf5687076b9531c4b9e81e93d299ee1eba0439a3ae6486 +size 699775 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_spine.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_spine.png new file mode 100644 index 0000000..e1b519c --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_Sickle_spine.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d8fc928307de2c5c611aef5f2c9307a115710b36f3477008bd51b7827fa2cf5 +size 594884 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_back.png new file mode 100644 index 0000000..003fb30 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b958a108838ae5e4addfaba1bc4f4a5aaf836d12e31557af5bcfba4137d50ed +size 652187 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_engine.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_engine.png new file mode 100644 index 0000000..44a2e87 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_engine.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0dbb3ad028e75ea10cf98a44bb31334c1cc48dc817a4b6f65520f5ec63cc4003 +size 901326 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_engine_l.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_engine_l.png new file mode 100644 index 0000000..0cc438d --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_engine_l.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75db88aa5c0c53540afa9b1528970edeb077010a7cc29cfdb01be3bffd2fc41e +size 891825 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_fpv.png new file mode 100644 index 0000000..4126f62 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbe6a8c0a608b2364133281fc431df958c219088cdc0a3f27d92c9e2662f15f8 +size 768185 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_full.png new file mode 100644 index 0000000..8a54d7b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9640fbd02e446af1d68a34bfc88884627bf65707ac384e2664a19f454bd9367b +size 631731 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_grip.png new file mode 100644 index 0000000..cebe49a --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26f280c7598c511a123faa8d5711d702707c07600aaccb09f39196aca81ef0b1 +size 858655 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_head.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_head.png new file mode 100644 index 0000000..ffb6816 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_head.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90e5fc2c74bb3d18bff919fbd5fad706633427ae28eb07c614b0d9e29ea1dc80 +size 726162 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_head_under.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_head_under.png new file mode 100644 index 0000000..fb631bb --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_head_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26425e2ffbbd320a894adef6dc091f84dfce1d4a6f0686bf6307d7e39d2a0ed8 +size 731075 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_jar.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_jar.png new file mode 100644 index 0000000..0c0623b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_jar.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42cd594d01e5633ee2c452b6b5a013f15c141afbfedce20a7ab755a1a5256a7e +size 971078 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_loop.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_loop.png new file mode 100644 index 0000000..9a8b68b --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_loop.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1b5e41eeffa11c98d6d1e3f8927eea35583d069a924da73bd1b36a2006b7c10 +size 918676 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_plug.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_plug.png new file mode 100644 index 0000000..bccc15e --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_SlurpGun_plug.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36c825c444cc95233969c34d4e1d5c705b7a2427c6dd22274528a3684c6fabdd +size 793985 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_back.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_back.png new file mode 100644 index 0000000..6dd70f3 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7971d39515daff83923f55ae9307c8c29b5b01c78dd5611e5758ad48be8b1e22 +size 637263 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_braces.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_braces.png new file mode 100644 index 0000000..190b478 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_braces.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c82eb7f8ee0f76112ff040036230e90102e8534f7bbf528aff7adb46c711e415 +size 643162 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_butt.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_butt.png new file mode 100644 index 0000000..c877623 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_butt.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5300d10e2a912d919b4ffcae3a4ada3477f5032b4326da7e6569be43f39e2f45 +size 839570 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_fpv.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_fpv.png new file mode 100644 index 0000000..da1ec5e --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_fpv.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f872c1e3214265b4b956e2cf8307628838c708e26dbb46573a406cab68fb6fb1 +size 828225 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_fpv_use.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_fpv_use.png new file mode 100644 index 0000000..e2a81ae --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_fpv_use.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f076d53ee52cceae33fcfb269549b3b8f099d0757c234f864fff442cb3978052 +size 834554 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_full.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_full.png new file mode 100644 index 0000000..9a1aad7 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_full.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22dcfe99e76af1f51791e697a579165405a358dd43f20db6c5a95f6b3f6e175f +size 607888 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_grip.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_grip.png new file mode 100644 index 0000000..be0bcf3 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_grip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5740585de8c95b5b23a25baf491382d54c7e60d6bb6571f44e275222861a13c4 +size 801234 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_mount.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_mount.png new file mode 100644 index 0000000..eb46924 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_mount.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:663ad3f3601ae7ab2f67800456c8a5a2d13386c704fe2ab95c6ec8c3baef2f0a +size 751402 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_mount_under.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_mount_under.png new file mode 100644 index 0000000..52005fc --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_mount_under.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71713ece972a313f03c7487638a65f98d01b9c8a32f0cc7b2e9dcb6e4b543f26 +size 730215 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_turnbuckle.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_turnbuckle.png new file mode 100644 index 0000000..5d52223 --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_turnbuckle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f27d960f57051496ffb6217ab4f8b5f7e3503d9bde4beecc011412fd51f1bdee +size 605296 diff --git a/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_wedge.png b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_wedge.png new file mode 100644 index 0000000..328befc --- /dev/null +++ b/ArtSource/Blender/remaster_v3_tools/previews/SM_Tool_WideScythe_wedge.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fd5bc8569e962d96be86c038ec07350e28b4a1d52035f26a29fa49e2e150554 +size 920860 diff --git a/ArtSource/Blender/scripts/gc_up5_check.py b/ArtSource/Blender/scripts/gc_up5_check.py new file mode 100644 index 0000000..24f3f64 --- /dev/null +++ b/ArtSource/Blender/scripts/gc_up5_check.py @@ -0,0 +1,581 @@ +"""Review of the round 5 hand items (gc_up5_tools.py, and anything else that writes into remaster_v3_tools) against the game's FBX files. + +In Blender: + blender -b --factory-startup --python gc_up5_check.py -- views [names] old | new panels per view, materials as the game maps them, + back faces culled like Unity -> remaster_v3_tools/previews/_panels + blender -b --factory-startup --python gc_up5_check.py -- fpv [names] the ViewModel hold (rest and in use), 62 degree overlay camera + (skipped, with a note, for an item without a hold) + blender -b --factory-startup --python gc_up5_check.py -- verify [names] names, parents, origins, axes, sizes, slots, grips vs Assets/Art/Models + blender -b --factory-startup --python gc_up5_check.py -- scene remaster_v3_tools/Hand_Tools_v3_Review.blend: every .blend in + remaster_v3_tools, each beside its game model, in a labelled grid +Outside Blender (python with Pillow): + python gc_up5_check.py compose panels -> previews/_.png, old left, new right + +Names: any item with remaster_v3_tools/fbx/.fbx (no names: TOOLS). Items outside TOOLS get a "full" view, no FPV and a +names/parents/origins check unless they are registered: from another script, + import gc_up5_check as K + K.register("SM_Tool_LawnMower", views=[("full", None, None, 38, -30), ("deck", (0, -0.4, 0.1), 0.2, 30, -40)], + hold=((x, y, z), (ex, ey, ez), (ux, uy, uz), (uex, uey, uez), scale), req=["Body"], grips=[((x, y), "Z", z0, z1, r)]) + K.views(["SM_Tool_LawnMower"]); K.fpv(["SM_Tool_LawnMower"]); K.verify(["SM_Tool_LawnMower"]) +or pass the dicts straight to views(names, views=...), fpv(names, holds=...), verify(names, req=..., grips=...). +""" +import os, sys, math, glob + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.normpath(os.path.join(HERE, "..", "..", "..")) +OUT = os.path.join(ROOT, "ArtSource", "Blender", "remaster_v3_tools") +GAME = os.path.join(ROOT, "Assets", "Art", "Models") +PANELS = os.path.join(OUT, "previews", "_panels") +REVIEW = "Hand_Tools_v3_Review" +TOOLS = ["SM_Tool_WideScythe", "SM_Tool_Scythe", "SM_Tool_GardenShears", "SM_Tool_NailScissors", "SM_Tool_Shears", "SM_Tool_Sickle", + "SM_Tool_Hammer", "SM_Tool_LongScythe"] +DEFAULT_VIEWS = [("full", None, None, 38, -30)] + +# (tag, target or None for the whole model, radius or None, elev, azim) +VIEWS = { + "SM_Tool_WideScythe": [("full", None, None, 38, -30), ("mount", (0.03, -1.74, -0.07), 0.17, 30, -40), ("mount_under", (0.03, -1.74, -0.09), 0.17, -30, -30), + ("braces", (0.38, -1.6, -0.0), 0.45, 42, -12), ("turnbuckle", (0.43, -1.57, 0.045), 0.13, 30, 15), + ("back", (0.42, -1.84, -0.05), 0.2, 52, -25), ("grip", (-0.01, -0.06, 0.0), 0.2, 12, 120), ("butt", (0.0, 0.07, 0.14), 0.15, 25, 150), + ("wedge", (0.11, -1.75, -0.03), 0.07, 45, 40)], + "SM_Tool_Scythe": [("full", None, None, 38, -30), ("mount", (0.02, -1.3, -0.065), 0.13, 30, -35), ("mount_under", (0.02, -1.3, -0.08), 0.13, -30, -30), + ("grip", (0.0, -0.05, 0.03), 0.17, 12, 120), ("nail", (0.05, -1.17, -0.04), 0.15, 25, -60), ("butt", (0.01, 0.1, 0.1), 0.14, 25, 150), + ("horn", (0.05, -0.26, 0.03), 0.15, 15, -70), ("wedge", (0.065, -1.31, -0.04), 0.06, 45, 40)], + "SM_Tool_GardenShears": [("full", None, None, 60, -12), ("pivot", (0.0, -0.145, 0.0), 0.07, 50, -25), ("pivot_under", (0.0, -0.145, 0.0), 0.07, -50, -25), + ("ferrule", (0.0, -0.06, 0.0), 0.08, 35, 35), ("grips", (0.0, 0.1, 0.0), 0.13, 45, -20), ("notch", (0.0, -0.32, 0.0), 0.1, 60, -10)], + "SM_Tool_Shears": [("full", None, None, 60, -12), ("pivot", (0.0, -0.145, 0.0), 0.07, 50, -25), ("ferrule", (0.0, -0.06, 0.0), 0.08, 35, 35)], + "SM_Tool_NailScissors": [("full", None, None, 60, -12), ("pivot", (0.0, -0.145, 0.0), 0.045, 50, -25), ("pivot_under", (0.0, -0.145, 0.0), 0.045, -50, -25), + ("bows", (0.0, 0.02, 0.0), 0.11, 50, -15), ("tips", (-0.012, -0.36, 0.0), 0.08, 55, -30), ("rest", (-0.1, 0.1, 0.0), 0.06, 40, 30)], + "SM_Tool_Sickle": [("full", None, None, 62, -10), ("neck", (0.0, -0.36, 0.26), 0.08, 35, -40), ("pommel", (0.0, 0.03, -0.31), 0.08, 15, 140), + ("grip", (0.0, -0.02, -0.06), 0.14, 10, 70), ("blade", (-0.06, -0.95, 0.26), 0.16, 60, -20), ("spine", (0.11, -1.18, 0.26), 0.12, 30, 160)], + "SM_Tool_Hammer": [("full", None, None, 64, -14), ("head", (-0.02, -0.56, 0.0), 0.16, 30, -120), ("face", (0.17, -0.56, 0.0), 0.08, 20, -60), + ("claw", (-0.22, -0.53, 0.0), 0.11, 35, -150), ("eye", (0.0, -0.62, 0.0), 0.07, 70, -20), + ("boss", (0.0, -0.5, 0.0), 0.1, -12, -100), ("poll", (0.16, -0.56, 0.0), 0.075, 30, -110), ("grip", (0.0, 0.12, 0.0), 0.16, 30, 40)], + "SM_Tool_LongScythe": [("full", None, None, 38, -30), ("mount", (0.02, -1.52, -0.07), 0.14, 30, -35), ("mount_under", (0.02, -1.52, -0.08), 0.14, -30, -30), + ("cradle", (0.25, -1.35, 0.1), 0.33, 35, -25), ("cradle_post", (0.03, -1.25, 0.14), 0.2, 15, 100), + ("grip", (0.0, -0.05, 0.03), 0.17, 12, 120), ("butt", (0.02, 0.1, 0.1), 0.14, 25, 150)], +} +# ViewModel.Holds: pos, euler, usePos, useEuler, scale (Shears is not in the game any more: it borrows GardenShears' hold) +HOLDS = { + "SM_Tool_GardenShears": ((0.25, -0.14, 0.46), (-36, -18, -6), (0.22, -0.2, 0.5), (-24, -14, -6), 0.75), + "SM_Tool_Shears": ((0.25, -0.14, 0.46), (-36, -18, -6), (0.22, -0.2, 0.5), (-24, -14, -6), 0.75), + "SM_Tool_NailScissors": ((0.21, -0.13, 0.4), (-42, -16, -8), (0.2, -0.17, 0.46), (-28, -14, -6), 0.5), + "SM_Tool_Sickle": ((0.27, -0.17, 0.46), (-35, -18, -6), (0.22, -0.19, 0.5), (-20, -14, -6), 0.34), + "SM_Tool_Scythe": ((0.32, -0.1, 0.36), (9, -18, 0), (0.32, -0.11, 0.36), (11, -18, 0), 0.46), + "SM_Tool_LongScythe": ((0.32, -0.1, 0.36), (9, -20, 0), (0.32, -0.11, 0.36), (11, -20, 0), 0.5), + "SM_Tool_WideScythe": ((0.32, -0.1, 0.36), (9, -22, 0), (0.32, -0.11, 0.36), (11, -22, 0), 0.54), + "SM_Tool_Hammer": ((0.27, -0.2, 0.42), (-68, -10, -8), (0.27, -0.2, 0.42), (-68, -10, -8), 0.42), +} +REQ = {"SM_Tool_WideScythe": ["Body"], "SM_Tool_Scythe": ["Body"], "SM_Tool_LongScythe": ["Body"], "SM_Tool_Sickle": ["Body"], "SM_Tool_Hammer": ["Body"], + "SM_Tool_GardenShears": ["Body", "BladeA", "BladeB"], "SM_Tool_Shears": ["Body", "BladeA", "BladeB"], "SM_Tool_NailScissors": ["Body", "BladeA", "BladeB"]} +# where a hand closes: (centre (a, b), axis, lo, hi, radius). Axis "Z": the centre in XY of the geometry within radius between z = lo..hi; +# axis "Y": the centre in XZ between y = lo..hi. Old and new must agree within 5 mm. +GRIPS = { + "SM_Tool_WideScythe": [((0.03, -0.04), "Z", -0.06, 0.02, 0.06), ((-0.03, -0.62), "Z", -0.06, 0.02, 0.06)], + "SM_Tool_Scythe": [((0.03, -0.04), "Z", -0.06, 0.02, 0.06), ((-0.03, -0.66), "Z", -0.06, 0.02, 0.06)], + "SM_Tool_LongScythe": [((0.03, -0.04), "Z", -0.06, 0.02, 0.06), ((-0.03, -0.64), "Z", -0.06, 0.02, 0.06)], + "SM_Tool_Sickle": [((0.0, 0.006), "Z", -0.13, -0.01, 0.075)], + "SM_Tool_Hammer": [((0.0, 0.0), "Y", 0.02, 0.14, 0.07)], + "SM_Tool_NailScissors": [((0.056, 0.06), "Z", -0.03, 0.03, 0.049), ((-0.061, 0.064), "Z", -0.03, 0.03, 0.05)], +} +RES = 800 + + +def register(name, views=None, hold=None, req=None, grips=None): + """Review data for an item outside TOOLS (another script's): any of its views, ViewModel hold, required objects, grip checks.""" + if views is not None: + VIEWS[name] = list(views) + if hold is not None: + HOLDS[name] = hold + if req is not None: + REQ[name] = list(req) + if grips is not None: + GRIPS[name] = list(grips) + + +def items(): + """Every finished item in remaster_v3_tools: .blend, the review blend left out.""" + out = [] + for p in sorted(glob.glob(os.path.join(OUT, "*.blend"))): + n = os.path.splitext(os.path.basename(p))[0] + if n == REVIEW or n.endswith("_Review"): + continue + out.append(n) + return out + + +# ======================================================================= Blender side + +def _bl(): + import bpy + from mathutils import Vector, Matrix + sys.path.insert(0, HERE) + import common as C + import gc_up_machines # noqa: F401 (registers the P_ swatch materials) + return bpy, Vector, Matrix, C + + +def load_fbx(path, W=None): + bpy, Vector, Matrix, C = _bl() + before = set(bpy.data.objects) + bpy.ops.import_scene.fbx(filepath=path) + new = [o for o in bpy.data.objects if o not in before] + bpy.context.view_layer.update() + # the FBX brings its own materials (no textures): move them aside so common.mat builds the real ones under the same names + for m in list(bpy.data.materials): + if not m.get("gc_real") and not m.name.endswith("_imp"): + m.name = m.name.split(".")[0] + "_imp" + for o in new: + if o.type == "MESH": + me = o.data + for i, m in enumerate(me.materials): + if m is None: + continue + nm = m.name.split(".")[0] + nm = nm[:-4] if nm.endswith("_imp") else nm + if nm in C.MATDEFS: + me.materials[i] = C.mat(nm) + me.materials[i]["gc_real"] = True + for m in me.materials: + if m: + m.use_backface_culling = True + if W is not None: + for o in new: + if o.parent is None: + o.matrix_world = W @ o.matrix_world + return new + + +def load_blend(path, W=None): + """The objects of a .blend (an item with no FBX yet), linked into the scene, parentless ones moved by W.""" + bpy, Vector, Matrix, C = _bl() + with bpy.data.libraries.load(path) as (src, dst): + dst.objects = list(src.objects) + new = [] + for o in dst.objects: + if o is None or o.type not in ("MESH", "EMPTY", "ARMATURE"): + continue + bpy.context.scene.collection.objects.link(o) + new.append(o) + bpy.context.view_layer.update() + if W is not None: + for o in new: + if o.parent is None: + o.matrix_world = W @ o.matrix_world + return new + + +def bounds(objs): + bpy, Vector, Matrix, C = _bl() + mn, mx = Vector((1e9,) * 3), Vector((-1e9,) * 3) + for o in objs: + if o.type != "MESH": + continue + for v in o.data.vertices: + w = o.matrix_world @ v.co + mn = Vector(map(min, mn, w)) + mx = Vector(map(max, mx, w)) + return mn, mx + + +def lights(bg=(0.62, 0.72, 0.84), strength=0.55): + bpy, Vector, Matrix, C = _bl() + sc = bpy.context.scene + for nm, en, rot in (("Key", 2.2, (50, 10, -40)), ("Fill", 0.7, (60, 0, 120)), ("Rim", 1.2, (30, 0, 170))): + ld = bpy.data.lights.new(nm, "SUN") + ld.energy = en + ld.angle = math.radians(8) + lo = C.link(bpy.data.objects.new(nm, ld)) + lo.rotation_euler = [math.radians(a) for a in rot] + w = bpy.data.worlds.new("W") + sc.world = w + try: + w.use_nodes = True + except Exception: + pass + n = w.node_tree.nodes.get("Background") + n.inputs[0].default_value = (*bg, 1) + n.inputs[1].default_value = strength + sc.render.engine = "BLENDER_EEVEE" + try: + sc.view_settings.view_transform = "AgX" + except Exception: + pass + + +def shoot(path, target, radius, elev, azim, res=RES, ortho=False): + bpy, Vector, Matrix, C = _bl() + sc = bpy.context.scene + cam_d = bpy.data.cameras.new("cam") + cam_d.lens = 50 + cam = C.link(bpy.data.objects.new("cam", cam_d)) + el, az = math.radians(elev), math.radians(azim) + d = radius / math.tan(math.radians(18)) * 1.05 + tgt = Vector(target) + cam.location = tgt + Vector((math.sin(az) * math.cos(el), -math.cos(az) * math.cos(el), math.sin(el))) * d + cam.rotation_euler = (tgt - cam.location).to_track_quat("-Z", "Y").to_euler() + cam_d.clip_start = d * 0.01 + cam_d.clip_end = d * 10 + 10 + sc.camera = cam + sc.render.resolution_x = sc.render.resolution_y = res + sc.render.filepath = path + bpy.ops.render.render(write_still=True) + bpy.data.objects.remove(cam) + + +def new_path(n): + """The round 5 model of n: its FBX, else its .blend.""" + p = os.path.join(OUT, "fbx", n + ".fbx") + return p if os.path.exists(p) else os.path.join(OUT, n + ".blend") + + +def built(names): + """The names that have a round 5 model; a note for the others.""" + out = [] + for n in names: + if os.path.exists(new_path(n)): + out.append(n) + else: + print(f"V5|{n}: no round 5 model in {OUT}, skipped") + return out + + +def load_any(path, W=None): + return load_blend(path, W) if path.endswith(".blend") else load_fbx(path, W) + + +def views(names, views=None): + """views: {name: [(tag, target, radius, elev, azim)]} over VIEWS; an item with none gets DEFAULT_VIEWS.""" + bpy, Vector, Matrix, C = _bl() + os.makedirs(PANELS, exist_ok=True) + table = dict(VIEWS, **(views or {})) + for n in built(names): + # the frame of each view comes from the new model, so old and new are shot from exactly the same camera + bpy.ops.wm.read_factory_settings(use_empty=True) + objs = load_any(new_path(n)) + mn, mx = bounds(objs) + full = ((mn + mx) / 2, (mx - mn).length / 2 * 0.72) + only, tags = os.environ.get("GC5_ONLY"), os.environ.get("GC5_VIEWS") + for which, path in (("old", os.path.join(GAME, n + ".fbx")), ("new", new_path(n))): + if only and which != only: + continue + if not os.path.exists(path): + print(f"V5|{n}: no {which} model ({path}), skipped") + continue + bpy.ops.wm.read_factory_settings(use_empty=True) + load_any(path) + lights() + for tag, tgt, rad, el, az in table.get(n, DEFAULT_VIEWS): + if tags and tag not in tags.split(","): + continue + t, r = (full if tgt is None else (Vector(tgt), rad)) + shoot(os.path.join(PANELS, f"{n}_{tag}_{which}.png"), t, r, el, az) + + +def euler(x, y, z): + bpy, Vector, Matrix, C = _bl() + return Matrix.Rotation(math.radians(y), 4, "Y") @ Matrix.Rotation(math.radians(x), 4, "X") @ Matrix.Rotation(math.radians(z), 4, "Z") + + +def fpv(names, holds=None): + """The ViewModel rig in Blender space, the overlay camera at the origin looking down Blender -Y (Unity +Z). + holds: {name: (pos, euler, usePos, useEuler, scale)} over HOLDS. An item without a hold is skipped with a note.""" + bpy, Vector, Matrix, C = _bl() + M = Matrix(((-1, 0, 0, 0), (0, 0, -1, 0), (0, 1, 0, 0), (0, 0, 0, 1))) + os.makedirs(PANELS, exist_ok=True) + table = dict(HOLDS, **(holds or {})) + for n in built(names): + if n not in table: + print(f"V5|{n}: no ViewModel hold, no FPV shot (pass holds= or register(name, hold=...))") + continue + pos, eu, upos, ueu, s = table[n] + for pose, (p_, e_) in (("fpv", (pos, eu)), ("fpv_use", (upos, ueu))): + for which, path in (("old", os.path.join(GAME, n + ".fbx")), ("new", new_path(n))): + if not os.path.exists(path): + print(f"V5|{n}: no {which} model, skipped") + continue + bpy.ops.wm.read_factory_settings(use_empty=True) + rig = Matrix.Translation(Vector(p_)) @ euler(*e_) @ Matrix.Scale(s, 4) + W = M @ rig @ M.inverted() + objs = load_any(path) + open_ = 0.35 * 18.0 if pose == "fpv" else 18.0 + for o in objs: + if o.parent is not None: + continue + b = o.matrix_world.copy() + if o.name.startswith("BladeA"): + b = b @ Matrix.Rotation(math.radians(-open_), 4, "Z") + elif o.name.startswith("BladeB"): + b = b @ Matrix.Rotation(math.radians(open_), 4, "Z") + o.matrix_world = W @ b + sc = bpy.context.scene + cam_d = bpy.data.cameras.new("c") + cam_d.sensor_fit = "VERTICAL" + cam_d.angle = math.radians(62) + cam_d.clip_start = 0.01 + cam = C.link(bpy.data.objects.new("c", cam_d)) + cam.rotation_euler = (math.radians(90), 0, math.pi) + sc.camera = cam + lights((0.55, 0.72, 0.42), 0.7) + sc.render.resolution_x, sc.render.resolution_y = 1280, 720 + sc.render.filepath = os.path.join(PANELS, f"{n}_{pose}_{which}.png") + bpy.ops.render.render(write_still=True) + + +def snapshot(path): + """objects -> {name: (type, parent, loc, rot, scale, bbox min, bbox max, tris, [materials])}""" + bpy, Vector, Matrix, C = _bl() + bpy.ops.wm.read_factory_settings(use_empty=True) + load_any(path) if path.endswith(".blend") else bpy.ops.import_scene.fbx(filepath=path) + bpy.context.view_layer.update() + out = {} + for o in bpy.context.scene.objects: + mn, mx = bounds([o]) if o.type == "MESH" else (Vector(), Vector()) + tris = sum(len(p.vertices) - 2 for p in o.data.polygons) if o.type == "MESH" else 0 + mats = [m.name.split(".")[0] for m in o.data.materials if m] if o.type == "MESH" else [] + out[o.name] = (o.type, o.parent.name if o.parent else None, tuple(o.matrix_world.translation), tuple(o.matrix_world.to_euler()), + tuple(o.matrix_world.to_scale()), tuple(mn), tuple(mx), tris, mats) + return out + + +def nib_axis(path, c, z0=-0.06, z1=0.02, r=0.06, axis="Z"): + """Centre of the geometry round a grip point where the fist closes. axis "Z": (x, y) of what lies within r of c = (x, y) between + z0 and z1; axis "Y": (x, z) of what lies within r of c = (x, z) between y = z0 and z1. Returns (a, b, half extent) or None.""" + bpy, Vector, Matrix, C = _bl() + bpy.ops.wm.read_factory_settings(use_empty=True) + load_any(path) if path.endswith(".blend") else bpy.ops.import_scene.fbx(filepath=path) + bpy.context.view_layer.update() + xs, ys = [], [] + for o in bpy.context.scene.objects: + if o.type != "MESH": + continue + for v in o.data.vertices: + w = o.matrix_world @ v.co + a, b, h = (w.x, w.y, w.z) if axis == "Z" else (w.x, w.z, w.y) + if z0 < h < z1 and (a - c[0]) ** 2 + (b - c[1]) ** 2 < r * r: + xs.append(a) + ys.append(b) + if not xs: + return None + return ((min(xs) + max(xs)) / 2, (min(ys) + max(ys)) / 2, (max(xs) - min(xs)) / 2) + + +def verify(names, req=None, grips=None): + """req: {name: [object names]} over REQ (default: the game model's own objects); grips: {name: [(c, axis, lo, hi, r)]} over GRIPS.""" + bad = 0 + sys.path.insert(0, HERE) + rq, gr = dict(REQ, **(req or {})), dict(GRIPS, **(grips or {})) + for n in built(names): + gp = os.path.join(GAME, n + ".fbx") + new = snapshot(new_path(n)) + print(f"V5|{n}") + if not os.path.exists(gp): + print(f"V5| (no game model: {sorted(new)} not compared)") + old = {} + else: + old = snapshot(gp) + if set(old) != set(new): + print(f"V5| FAIL objects differ: old {sorted(old)} new {sorted(new)}") + bad += 1 + for k in sorted(set(old) & set(new)): + o, w = old[k], new[k] + dloc = max(abs(a - b) for a, b in zip(o[2], w[2])) + drot = max(abs(a - b) for a, b in zip(o[3], w[3])) + dsc = max(abs(a - b) for a, b in zip(o[4], w[4])) + ok = o[0] == w[0] and o[1] == w[1] and dloc < 1e-4 and drot < 1e-4 and dsc < 1e-4 + bad += 0 if ok else 1 + ext = lambda s: tuple(round(b - a, 3) for a, b in zip(s[5], s[6])) + print(f"V5| {'ok ' if ok else 'FAIL'} {k:<7} type {w[0]} parent {w[1]} origin {tuple(round(x, 4) for x in w[2])} (d {dloc:.1e}) rot d {drot:.1e} " + f"scale d {dsc:.1e}") + print(f"V5| bbox old {tuple(round(x, 3) for x in o[5])}..{tuple(round(x, 3) for x in o[6])} size {ext(o)}") + print(f"V5| bbox new {tuple(round(x, 3) for x in w[5])}..{tuple(round(x, 3) for x in w[6])} size {ext(w)}") + print(f"V5| tris {o[7]} -> {w[7]}") + extra = sorted(set(w[8]) - set(o[8])) + nomat = sorted(m for m in set(w[8]) if not os.path.exists(os.path.join(ROOT, "Assets", "Art", "Materials", m + ".mat"))) + print(f"V5| slots old {sorted(set(o[8]))}") + print(f"V5| slots new {sorted(set(w[8]))} new slots: {extra or 'none'} without a .mat: {nomat or 'none'}") + if nomat: + bad += 1 + missing = [r for r in rq.get(n, sorted(old)) if r not in new] + if missing: + print(f"V5| FAIL missing {missing}") + bad += 1 + if not old: + continue + for g in gr.get(n, []): + c, axis, lo, hi, r = g + a = nib_axis(gp, c, lo, hi, r, axis) + b = nib_axis(new_path(n), c, lo, hi, r, axis) + d = math.hypot(a[0] - b[0], a[1] - b[1]) if a and b else 9 + ok = d < 0.005 + bad += 0 if ok else 1 + fmt = lambda q: tuple(round(x, 4) for x in q) if q else None + print(f"V5| {'ok ' if ok else 'FAIL'} grip at {c} ({axis} {lo}..{hi}): old centre {fmt(a)} new centre {fmt(b)} (d {d:.4f})") + print("V5|RESULT|" + ("OK" if bad == 0 else f"{bad} problem(s)")) + return bad + + +def scene(names=None, row_width=6.0, gap=0.35): + """Every item in remaster_v3_tools (or `names`): the round 5 model on the left of each cell, the game's model on its right, a label + under each and the item's name under the cell; cells packed in rows. The 3D view in material preview, looking over the grid.""" + bpy, Vector, Matrix, C = _bl() + from mathutils import Quaternion # noqa: F401 + names = names or items() + bpy.ops.wm.read_factory_settings(use_empty=False) + for o in list(bpy.data.objects): + bpy.data.objects.remove(o) + + def label(col, text, loc, size): + cu = bpy.data.curves.new("lbl_" + text, "FONT") + cu.body = text + cu.size = size + t = bpy.data.objects.new("Label_" + text, cu) + t.location = loc + col.objects.link(t) + return t + cells = [] + for n in names: + parts = [] + for which, path in (("v5", new_path(n)), ("game", os.path.join(GAME, n + ".fbx"))): + if not os.path.exists(path): + continue + col = bpy.data.collections.new(f"{n}_{which}") + bpy.context.scene.collection.children.link(col) + objs = load_any(path) + for o in objs: + for c in list(o.users_collection): + c.objects.unlink(o) + col.objects.link(o) + o.name = f"{o.name}_{which}" if not o.name.endswith(which) else o.name + for m in (o.data.materials if o.type == "MESH" else []): + if m: + m.use_backface_culling = False + bpy.context.view_layer.update() + mn, mx = bounds(objs) + parts.append((which, col, objs, mn, mx)) + if parts: + cells.append((n, parts)) + # pack the cells in rows along +X, rows going back along +Y; the rows about as wide as a 16:9 view wants them + sizes = [(sum(mx.x - mn.x for _, _, _, mn, mx in parts) + gap * (len(parts) - 1), max(mx.y - mn.y for _, _, _, mn, mx in parts) + 0.25) + for n, parts in cells] + if sizes: + area = sum((w + gap * 2) * (d + gap * 1.5) for w, d in sizes) + row_width = max(row_width, max(w for w, d in sizes), math.sqrt(area * 1.9)) + x, y, row_d = 0.0, 0.0, 0.0 + lo, hi = Vector((1e9, 1e9, 0)), Vector((-1e9, -1e9, 0)) + for n, parts in cells: + widths = [(mx.x - mn.x) for _, _, _, mn, mx in parts] + w_cell = sum(widths) + gap * (len(parts) - 1) + d_cell = max(mx.y - mn.y for _, _, _, mn, mx in parts) + 0.25 + if x > 0 and x + w_cell > row_width: + x, y, row_d = 0.0, y + row_d + gap * 1.5, 0.0 + cx = x + for (which, col, objs, mn, mx), w in zip(parts, widths): + off = Vector((cx - mn.x, y + 0.25 - mn.y, 0.0)) + for o in objs: + if o.parent is None: + o.matrix_world = Matrix.Translation(off) @ o.matrix_world + label(col, "round 5" if which == "v5" else "game", (cx, y + 0.1, 0.0), 0.05) + cx += w + gap + title = bpy.data.collections.get("Labels") or bpy.data.collections.new("Labels") + if title.name not in bpy.context.scene.collection.children: + bpy.context.scene.collection.children.link(title) + label(title, n.replace("SM_Tool_", "").replace("SM_", ""), (x, y - 0.06, 0.0), 0.1) + lo = Vector((min(lo.x, x), min(lo.y, y), 0)) + hi = Vector((max(hi.x, x + w_cell), max(hi.y, y + d_cell), 0)) + x += w_cell + gap * 2 + row_d = max(row_d, d_cell) + w = bpy.data.worlds.new("W") + bpy.context.scene.world = w + try: + w.use_nodes = True + w.node_tree.nodes["Background"].inputs[0].default_value = (0.62, 0.72, 0.84, 1) + except Exception: + pass + ld = bpy.data.lights.new("Key", "SUN") + ld.energy = 3.0 + lo_ = bpy.data.objects.new("Key", ld) + lo_.rotation_euler = [math.radians(a) for a in (50, 10, -40)] + bpy.context.scene.collection.objects.link(lo_) + tgt = (lo + hi) / 2 if cells else Vector() + W_, D_ = (hi.x - lo.x, hi.y - lo.y) if cells else (3.0, 3.0) + # the viewport's 50 mm lens on a 16:9 view: about 19.8 degrees either side across, 11.4 up and down; looking down at 60 degrees + dist = 1.12 * max(W_ / 2 / math.tan(math.radians(19.8)), D_ * 0.87 / 2 / math.tan(math.radians(11.4)), 1.5) + eye = tgt + Vector((0.0, -0.5, 0.866)) * dist + look = (tgt - eye).normalized() + for scr in bpy.data.screens: + for area in scr.areas: + for sp in area.spaces: + if sp.type != "VIEW_3D": + continue + sp.shading.type = "MATERIAL" + sp.clip_start = 0.005 + sp.clip_end = 1000 + sp.overlay.show_floor = False + r3 = sp.region_3d + r3.view_perspective = "PERSP" + r3.view_rotation = look.to_track_quat("-Z", "Y") + r3.view_location = tgt + r3.view_distance = (tgt - eye).length + path = os.path.join(OUT, REVIEW + ".blend") + bpy.ops.wm.save_as_mainfile(filepath=path, check_existing=False) + print(f"V5|scene: {len(cells)} item(s) -> {path}: " + ", ".join(n for n, _ in cells)) + + +# ======================================================================= compose (outside Blender) + +def compose(keys=None): + """Old | new panels side by side. keys: only panel keys starting with one of these (names, or name_view).""" + from PIL import Image, ImageDraw, ImageFont + try: + font = ImageFont.truetype("arial.ttf", 26) + small = ImageFont.truetype("arial.ttf", 20) + except Exception: + font = small = ImageFont.load_default() + made = [] + for fn in sorted(os.listdir(PANELS)): + if not (fn.endswith("_old.png") or fn.endswith("_new.png")): + continue + key = fn[:-len("_old.png")] + if keys and not any(key.startswith(k) for k in keys): + continue + a, b = os.path.join(PANELS, key + "_old.png"), os.path.join(PANELS, key + "_new.png") + if fn.endswith("_new.png") and os.path.exists(a): + continue # done from the _old side + if not os.path.exists(b): + continue + B = Image.open(b).convert("RGB") + A = Image.open(a).convert("RGB") if os.path.exists(a) else Image.new("RGB", B.size, (60, 62, 66)) + w, h = A.size + bar = 44 + im = Image.new("RGB", (w * 2 + 8, h + bar), (30, 32, 36)) + im.paste(A, (0, bar)) + im.paste(B, (w + 8, bar)) + d = ImageDraw.Draw(im) + d.text((14, 9), "game (round 4)" if os.path.exists(a) else "no game model", fill=(230, 230, 230), font=font) + d.text((w + 22, 9), "round 5", fill=(255, 214, 120), font=font) + d.text((w * 2 + 8 - 14 - d.textlength(key, font=small), 13), key, fill=(170, 170, 170), font=small) + out = os.path.join(OUT, "previews", key + ".png") + im.save(out) + made.append(out) + print("\n".join(made)) + + +def _names(args): + got = [a for a in args if not a.startswith("-")] + return got or TOOLS + + +if __name__ == "__main__": + args = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else sys.argv[1:] + mode = args[0] if args else "views" + names = _names(args[1:]) + if mode == "compose": + compose([a for a in args[1:] if not a.startswith("-")] or None) + elif mode == "views": + views(names) + elif mode == "fpv": + fpv(names) + elif mode == "verify": + verify(names) + elif mode == "scene": + scene([a for a in args[1:] if not a.startswith("-")] or None) diff --git a/ArtSource/Blender/scripts/gc_up5_machines.py b/ArtSource/Blender/scripts/gc_up5_machines.py new file mode 100644 index 0000000..20d6939 --- /dev/null +++ b/ArtSource/Blender/scripts/gc_up5_machines.py @@ -0,0 +1,2474 @@ +"""GRASS CUTTER - fifth round, the hand-held machines: a detail pass on the round-5 pilot's level (gc_up5_tools.py). + +Items, and the generator each one's game FBX really came from (names, children, origins, bounds, triangle counts and slots match +exactly when that generator is run again): + + SM_Tool_LawnMower gc_stage17.lawn_mower Body, Blade, Wheel_FL/FR/RL/RR, Fill P_ slots -> M_Pack, Fill M_Clippings + SM_Tool_HandPump gc_farm_tools.tool_handpump Body, Plunger, Nozzle M_ slots (the farm palette) + SM_Tool_SlurpGun gc_farm_tools.tool_slurpgun Body, Fan (tilted axis), Fill, Nozzle + SM_Tool_HydroCannon gc_farm_tools.tool_hydrocannon Body, Fan, Nozzle + SM_Tool_MegaSiphon gc_farm_tools.tool_megasiphon Body, Ring1, Ring2, Nozzle + (os_crew.py / gc_crew.py build an older look of the same four names: other sizes, other slots. Not used.) + In the game today only the mower is driven by code (CrewAvatar.HoldMower: Blade, Wheel_*, Fill); the four farm machines have no + ToolId and are only rendered by Editor/IconStudio. Their frames are kept all the same; the first-person shots use their old + ViewModel holds (verify_farm_tools.RIGS). + +Every frame is kept: object names, origins, the pivot and axis of every moving part (Blade spins about local Z, wheels about local X, +Fan / Ring* about local Y, Plunger slides along Y, Fill scales on local Z), grip points, overall size, material slot names. +No new game material: the mower keeps P_ swatches (-> M_Pack) plus M_Clippings; the farm machines keep their own M_ slots. +Nothing from the Synty pack is used. + +What changes is the detail, for first person up close: + engines finned cylinder and head, head bolts, a spark plug (hex, ribbed ceramic, terminal) with a rubber boot and an HT lead, + a recoil starter with vents, a rope guide, the rope and a moulded pull handle, a fuel tank with a crimped seam + and a knurled cap, a muffler with a perforated heat shield, a carburettor and air filter + decks a pressed shell: rolled lip, edge rib, crowned top with ribs following the outline, recessed engine panel, height levers in notched + quadrants, moulded height pads, decals; lugged tyres with sidewall ring and lettering on spoked rims, axle nuts showing + handles tube bends, flattened tube ends bolted into brackets with knob nuts, foam grips with end caps, a bail lever + in moulded pivot clips, a control cable held by clips + bags a catcher with a hard tray, panels bulging between piped corner seams, a hem rolled over the frame, rows of stitching + hardware bolts with washers and nuts, threads showing, welded brackets with beads, rivets + +Output never goes to Assets: ArtSource/Blender/remaster_v3_tools/.blend, fbx/.fbx (export settings of common.py), +previews/_.png (game left, round 5 right). +Run (absolute paths): + blender -b --factory-startup --python C:/Github/Grass-Cutters/ArtSource/Blender/scripts/gc_up5_machines.py -- [build] [names] + blender -b --factory-startup --python .../gc_up5_machines.py -- verify [names] names, parents, origins, axes, bounds, slots + blender -b --factory-startup --python .../gc_up5_machines.py -- views [names] old | new panels, $GC5_VIEWS=tag,tag to limit + python .../gc_up5_machines.py compose [names] panels -> previews/_.png +""" +import sys, os, math, time + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.normpath(os.path.join(HERE, "..", "..", "..")) +OUT = os.path.join(ROOT, "ArtSource", "Blender", "remaster_v3_tools") +GAME = os.path.join(ROOT, "Assets", "Art", "Models") +PANELS = os.path.join(OUT, "previews", "_panels") +NAMES = ["SM_Tool_LawnMower", "SM_Tool_HandPump", "SM_Tool_SlurpGun", "SM_Tool_HydroCannon", "SM_Tool_MegaSiphon"] +sys.path.insert(0, HERE) + +try: + import bpy # noqa: F401 + IN_BLENDER = True +except ImportError: + IN_BLENDER = False + +if IN_BLENDER: + for _try in range(8): # gc_up5_tools belongs to another agent and may be mid-edit: wait and retry + try: + from gc_up5_tools import * # noqa: F401,F403 (sweep, bprism, washer, hexnut, thread, bolt5, rivet, bead, ... + round 4 / 3 kits) + import gc_up5_tools as T5 + break + except Exception as _e: # noqa: BLE001 + print("gc_up5_machines: import gc_up5_tools failed, retrying in 60 s:", repr(_e), flush=True) + time.sleep(60) + else: + raise RuntimeError("gc_up5_tools would not import") + import common + import gc_up_machines as UM + import gc_farm_tools as FT + from mathutils import Vector, Matrix + from os_crew import revolve_fn # noqa: F401 + +TAU = 2 * math.pi +DEG = math.radians + + +# ======================================================================= palettes + +class Pal(dict): + __getattr__ = dict.__getitem__ + + +PK = Pal(muff="P_G1", red="P_RED", redd="P_REDD", white="P_WHITE", black="P_BLACK", rub="P_BLACK", plast="P_DGREY", d1="P_G1", d2="P_G2", st="P_G3", + hw="P_G4", br="P_G5", fab="P_CAB", thr="P_CREAM", gold="P_GOLD", tube="P_G3", brass="P_GOLD") +FM = Pal(muff="M_Steel", red="M_PaintRed", white="M_PaintWhite", black="M_Navy", rub="M_Rubber", plast="M_Navy", d1="M_Navy", d2="M_Steel", st="M_Steel", + hw="M_Steel", br="M_Blade", fab="M_Burlap", thr="M_Twine", gold="M_PaintYellow", tube="M_Steel", brass="M_Brass", tim="M_Timber", + lea="M_Leather", rope="M_Rope", tin="M_Tin", yel="M_PaintYellow", glass="M_Glass", teal="M_Teal", trim="M_TrimLine", + clip="M_Clippings") + + +# ======================================================================= lighter hardware (open where it sits on a surface) +# These shadow the gc_up5_tools versions for the calls made here (bolt5 inside gc_up5_tools keeps its own): the face that sits on +# the part is left out, a dome has 8 sides, which roughly halves the cost of the dozens of heads, rivets, washers and nuts. + +def head(P, c, n, r, kind="hex", m="P_G4", ref=None): + """A bolt head sitting on c, facing n. r: shank radius.""" + if kind == "hex": + R, h = r * 1.85, r * 1.25 + P.append(rev("bolthead", [(R, 0.0), (R, h * 0.7), (R * 0.84, h), (0.0, h * 1.04)], c, n, [m], segs=6, ref=ref, ang=20)) + elif kind == "square": + R, h = r * 1.9, r * 1.3 + P.append(rev("bolthead", [(R, 0.0), (R, h * 0.72), (R * 0.82, h), (0.0, h * 1.03)], c, n, [m], segs=4, ref=ref, ang=20)) + else: # dome: a carriage bolt or a rivet + R, h = r * 1.75, r * 1.05 + P.append(rev("bolthead", [(R, 0.0), (R * 0.95, h * 0.32), (R * 0.78, h * 0.7), (R * 0.45, h * 0.95), (0.0, h)], c, n, [m], segs=8, ref=ref, ang=40)) + + +def rivet(P, c, n, r, m="M_Brass", tail=None, L=0.0): + head(P, c, n, r, "dome", m=m) + + +def washer(P, c, n, r, t, m="P_G4", segs=None, ref=None): + segs = segs or (8 if r < 0.016 else 10) + ch = t * 0.4 + P.append(rev("washer", [(r, 0.0), (r, t - ch), (r - ch, t), (0.0, t)], c, n, [m], segs=segs, ref=ref, ang=30)) + return Vector(c) + Vector(n).normalized() * t + + +def hexnut(P, c, n, R, h, m="P_G4", ref=None, name="nut"): + ch = min(h * 0.22, R * 0.2) + P.append(rev(name, [(R - ch, 0.0), (R, ch), (R, h - ch), (R - ch, h), (0.0, h)], c, n, [m], segs=6, ref=ref, ang=20)) + return Vector(c) + Vector(n).normalized() * h + + +# ======================================================================= small geometry + +def V(*a): + return Vector(a[0]) if len(a) == 1 else Vector(a) + + +def rev(name, prof, c, axis, mats, segs=16, ref=None, mod=None, colfn=None, ang=40, cap0=False, cap1=False): + """A lathe about `axis` through c from a profile [(r, z)] (r = 0: a pole). mod(i, a) scales the radius of profile point i at angle a + (knurls, ribs, vents); colfn(i, j) -> slot of the band from profile point i to i + 1.""" + F = fz(c, axis, ref) + rings = [] + for i, (r, z) in enumerate(prof): + if r <= 1e-7: + rings.append([F @ Vector((0.0, 0.0, z))]) + continue + ring = [] + for k in range(segs): + a = TAU * k / segs + rr = r * (mod(i, a) if mod else 1.0) + ring.append(F @ Vector((rr * math.cos(a), rr * math.sin(a), z))) + rings.append(ring) + return rings_mesh(name, rings, mats if isinstance(mats, (list, tuple)) else [mats], colfn=colfn, cap0=cap0, cap1=cap1, ang=ang) + + +def fillet(pts, r, n=4): + """Round every inner corner of a polyline by a bend of radius r (quadratic arcs), like a bent tube.""" + P_ = [Vector(p) for p in pts] + out = [P_[0]] + for i in range(1, len(P_) - 1): + a, b, c = P_[i - 1], P_[i], P_[i + 1] + d0, d1 = (a - b), (c - b) + if d0.length < 1e-9 or d1.length < 1e-9: + continue + d0.normalize() + d1.normalize() + ang = d0.angle(d1) + if ang > PI - 1e-3: + out.append(b) + continue + t = min(r / max(1e-6, math.tan(ang / 2)), (a - b).length * 0.48, (c - b).length * 0.48) + p0, p1 = b + d0 * t, b + d1 * t + for j in range(n + 1): + u = j / n + out.append((1 - u) ** 2 * p0 + 2 * (1 - u) * u * b + u ** 2 * p1) + out.append(P_[-1]) + return out + + +def densify(pts, step): + """Extra stations along straight runs, so a section can change along a path.""" + P_ = [Vector(p) for p in pts] + out = [P_[0]] + for a, b in zip(P_, P_[1:]): + n = max(1, int(math.ceil((b - a).length / step))) + for k in range(1, n + 1): + out.append(a.lerp(b, k / n)) + return out + + +def rr_pts(hw, hd, rc, nc=3, nf=(2, 2)): + """Rounded rectangle with nf = (points along X sides, along Y sides) between corners. [(x, y, flat)] where flat runs 0 at a + corner to 1 in the middle of a side: what bulges or sags between corner seams.""" + rc = min(rc, hw * 0.98, hd * 0.98) + out = [] + corners = ((hw - rc, hd - rc, 0), (-(hw - rc), hd - rc, 90), (-(hw - rc), -(hd - rc), 180), (hw - rc, -(hd - rc), 270)) + for ci, (cx, cy, a0) in enumerate(corners): + for j in range(nc + 1): + a = DEG(a0 + 90 * j / nc) + out.append((cx + rc * math.cos(a), cy + rc * math.sin(a), 0.0)) + nx = corners[(ci + 1) % 4] + m_ = nf[0] if ci in (0, 2) else nf[1] + ex = (cx + rc * math.cos(DEG(a0 + 90)), cy + rc * math.sin(DEG(a0 + 90))) + nxs = (nx[0] + rc * math.cos(DEG(nx[2])), nx[1] + rc * math.sin(DEG(nx[2]))) + for k in range(1, m_ + 1): + f = k / (m_ + 1) + out.append((ex[0] + (nxs[0] - ex[0]) * f, ex[1] + (nxs[1] - ex[1]) * f, math.sin(PI * f))) + return out + + +def rr_ring(hw, hd, rc, z, c=(0.0, 0.0), nc=3, nf=(2, 2), bulge=0.0): + """A ring of rr_pts at height z round c; bulge pushes the middle of each side outwards.""" + pts = rr_pts(hw, hd, rc, nc, nf) + out = [] + for x, y, f in pts: + d = Vector((x / max(hw, 1e-6) ** 2, y / max(hd, 1e-6) ** 2, 0.0)) + d = d.normalized() if d.length > 1e-9 else Vector((1, 0, 0)) + out.append(Vector((c[0] + x, c[1] + y, z)) + d * bulge * f) + return out + + +def slot(P, c, n, along, L, w, h, m, sink=0.0006, bev=True): + """A stamped slot or louvre: a stadium of L x w standing h off a surface (normal n) at c, its long side along `along`.""" + out = [(L / 2 - w / 2 + w / 2 * math.cos(a), w / 2 * math.sin(a)) for a in [DEG(-90 + 180 * k / 2) for k in range(3)]] + out += [(-(L / 2 - w / 2) + w / 2 * math.cos(a), w / 2 * math.sin(a)) for a in [DEG(90 + 180 * k / 2) for k in range(3)]] + P.append(bprism("slot", out, -sink, h, [m], bev=min(h * 0.45, w * 0.3) if bev else 0.0, segs=1, frame=fz(c, n, along), ang=50)) + + +def stitches(name, pts, nrm, m, step=0.016, L=0.0075, w=0.0022, lift=0.0009, phase=0.0): + """A row of stitches along a polyline lying on a surface: each a small domed dash, nrm(p) the surface's outward normal.""" + C = [Vector(p) for p in pts] + Ls = arclen(C) + tot = Ls[-1] + bm = bmesh.new() + s = step * (0.5 + phase) + while s < tot - step * 0.3: + i = next((q for q in range(len(Ls) - 1) if Ls[q + 1] >= s), len(Ls) - 2) + f = (s - Ls[i]) / max(1e-9, Ls[i + 1] - Ls[i]) + p = C[i].lerp(C[i + 1], f) + t = (C[i + 1] - C[i]).normalized() + n = Vector(nrm(p)).normalized() + u = n.cross(t).normalized() + t = u.cross(n) + base = p + n * lift + ring = [base + t * (L / 2), base + u * (w / 2), base - t * (L / 2), base - u * (w / 2)] + vs = [bm.verts.new(q) for q in ring] + top = bm.verts.new(base + n * w * 0.45) + for k in range(4): + bm.faces.new((vs[k], vs[(k + 1) % 4], top)) + s += step + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + o = mesh_obj(name, bm) + set_mats(o, m) + smooth(o, 80) + # every dash must face away from the surface + me = o.data + me.update() + return o + + +def tube5(name, pts, r, m, segs=10, bend=0.03, ang=40, ref=None, cap0=True, cap1=True, rf=None, step=None, nb=5): + """A bent tube: the polyline's corners turned into bends of radius `bend`. rf(s) -> radius along it (default r).""" + C = fillet(pts, bend, n=nb) + if step: + C = densify(C, step) + return sweep(name, C, lambda s, i: circ(rf(s) if rf else r, segs), [m], cap0=cap0, cap1=cap1, ang=ang, ref=ref) + + +def knob_nut(P, c, n, R, m, ref=None, lobes=4): + """A star knob screwed onto a bolt: a moulded lobed disc, a domed top, a boss towards the work.""" + def mod(i, a): + return 1.0 + 0.22 * max(0.0, math.cos(lobes * a)) ** 2 if 1 <= i <= 4 else 1.0 + P.append(rev("knob", [(R * 0.5, 0.0), (R * 0.82, R * 0.32), (R * 0.95, R * 0.45), (R * 0.95, R * 0.85), (R * 0.82, R * 1.0), + (R * 0.4, R * 1.12), (0.0, R * 1.15)], c, n, [m], segs=lobes * 3, ref=ref, mod=mod, ang=45)) + + +def clip_band(P, c, t, r, w, m, ear=None, screw_m=None): + """A strap clip round a tube (axis t, radius r) at c: a band with rounded edges, a tab with a screw on the `ear` side.""" + t = Vector(t).normalized() + prof = [(r + 0.0004, -w / 2), (r + 0.0026, -w / 2 + 0.0012), (r + 0.0026, w / 2 - 0.0012), (r + 0.0004, w / 2)] + P.append(rev("clip", prof, c, t, [m], segs=10, ang=45)) + if ear is not None: + e = (Vector(ear) - t * Vector(ear).dot(t)).normalized() + P.append(rev("clipboss", [(0.0042, -0.0005), (0.0046, 0.003), (0.0038, 0.0052), (0.0, 0.0056)], Vector(c) + e * (r + 0.0015), e, [m], segs=8)) + head(P, Vector(c) + e * (r + 0.0068), e, 0.0018, "dome", m=screw_m or m) + + +# ======================================================================= hardware kit for the machines + +def crimp_seam(P, ring, n_out, m, r=0.0022): + """A crimped seam flange running round a closed ring of points (a tank's two halves).""" + pts = [Vector(p) for p in ring] + [Vector(ring[0]), Vector(ring[1])] + P.append(sweep("seam", pts, lambda s, i: [(0.0, -r * 0.55), (r * 1.4, -r * 0.45), (r * 1.9, 0.0), (r * 1.4, r * 0.45), (0.0, r * 0.55)], + [m], cap0=False, cap1=False, ang=50, frm=_ring_frames(pts, n_out))) + + +def _ring_frames(pts, up): + """Frames along a closed ring lying roughly in a plane normal to `up`: N outward, B along `up`.""" + up = Vector(up).normalized() + n = len(pts) + T, N, B = [], [], [] + for i in range(n): + t = (pts[min(i + 1, n - 1)] - pts[max(i - 1, 0)]).normalized() + b = up + nn = t.cross(b).normalized() + T.append(t) + N.append(nn) + B.append(b) + # the cross product may point inwards: make N point away from the centre + cen = sum(pts, Vector()) / n + if N[0].dot(pts[0] - cen) < 0: + N = [-x for x in N] + return T, N, B + + +def spark_plug(P, base, d, M, lead=None, boot=True): + """A spark plug screwed into a head at `base` along d: a washer, a hex, a ribbed white ceramic, the terminal; a rubber boot pushed + over it and an HT lead along `lead` (points) from the boot back to the coil.""" + d = Vector(d).normalized() + q = washer(P, base, d, 0.0105, 0.0016, m=M.hw) + q = hexnut(P, q, d, 0.0105, 0.0085, m=M.hw, name="plughex") + P.append(rev("ceramic", [(0.0078, -0.001), (0.0078, 0.002), (0.0062, 0.004), (0.0066, 0.007), (0.0058, 0.009), (0.0063, 0.012), (0.0055, 0.014), + (0.0059, 0.017), (0.0048, 0.02), (0.0042, 0.024), (0.0, 0.0245)], q, d, [M.white], segs=12, ang=50)) + e = q + d * 0.024 + if boot: + P.append(rev("boot", [(0.0048, -0.008), (0.0068, -0.006), (0.0072, 0.0), (0.0066, 0.004), (0.0071, 0.007), (0.0064, 0.011), (0.0068, 0.014), + (0.0058, 0.02), (0.0042, 0.026), (0.0036, 0.029)], e, d, [M.rub], segs=12, ang=50)) + if lead: + pts = [e + d * 0.027] + [Vector(p) for p in lead] + P.append(tube5("lead", pts, 0.0034, M.rub, segs=6, bend=0.02, ang=50, nb=3)) + else: + P.append(rev("terminal", [(0.002, 0.0), (0.0032, 0.001), (0.0032, 0.005), (0.0, 0.006)], e, d, [M.hw], segs=8)) + + +def fin_stack(P, c, axis, ref, w0, h0, rc, n, pitch, t, shrink, m, core=None, mat_core=None): + """Cooling fins: n thin plates (rounded rectangles w x h, bevelled edges) stacked along `axis` from c, each smaller by `shrink`, + on a core block (hw, hh) that fills the gaps.""" + axis = Vector(axis).normalized() + for k in range(n): + w, h = w0 - shrink * k, h0 - shrink * k * 0.9 + F = fz(Vector(c) + axis * (k * pitch), axis, ref) + P.append(bprism("fin", rrect(w / 2, h / 2, rc, 1), -t / 2, t / 2, [m], bev=t * 0.42, segs=1, frame=F, min_ang=30, ang=40)) + if core: + hw, hh = core + F = fz(Vector(c) - axis * pitch * 0.4, axis, ref) + P.append(bprism("core", rrect(hw, hh, min(hw, hh) * 0.5, 2), 0.0, pitch * (n - 0.2), [mat_core or m], bev=0.002, segs=1, frame=F)) + + +def recoil(P, c, n, R, H, M, ref=None, vents=10, cover=None, cap=None): + """A recoil starter: a pressed dome cover (radius R, height H along n from c) with a rolled foot, stamped vent slots round the + crown, a centre cap held by three screws.""" + n = Vector(n).normalized() + cover = cover or M.white + prof = [(R * 0.97, -0.004), (R, -0.002), (R * 1.01, 0.0015), (R * 0.99, H * 0.32), (R * 0.96, H * 0.55), (R * 0.88, H * 0.78), (R * 0.72, H * 0.93), + (R * 0.5, H), (0.0, H * 1.01)] + P.append(rev("recoil", prof, c, n, [cover], segs=22, ref=ref, ang=38)) + P.append(rev("recfoot", [(R * 1.005, -0.0045), (R * 1.04, -0.0035), (R * 1.05, -0.001), (R * 1.03, 0.001), (R * 1.0, 0.0012)], c, n, [M.d1], segs=12, ref=ref, ang=50)) + F = fz(c, n, ref) + for k in range(vents): + a = TAU * (k + 0.5) / vents + rr = R * 0.79 + zc = H * 0.86 + p = F @ Vector((rr * math.cos(a), rr * math.sin(a), zc)) + nrm = (F.to_3x3() @ Vector((math.cos(a) * 0.55, math.sin(a) * 0.55, 1.0))).normalized() + al = (F.to_3x3() @ Vector((math.cos(a), math.sin(a), -0.5))).normalized() + slot(P, p, nrm, al, R * 0.2, R * 0.065, 0.0012, M.black, bev=False) + cp = Vector(c) + n * H + P.append(rev("reccap", [(R * 0.4, -0.001), (R * 0.42, 0.002), (R * 0.4, 0.0045), (R * 0.3, 0.0065), (0.0, 0.007)], cp, n, [cap or M.d2], segs=16, ang=40)) + for k in range(3): + a = TAU * k / 3 + 0.3 + p = F @ Vector((R * 0.32 * math.cos(a), R * 0.32 * math.sin(a), H + 0.006)) + head(P, p, n, 0.0022, "dome", m=M.hw) + + +def pull_handle(P, c, d, M, L=0.06, r=0.0085, m=None): + """A moulded pull-start handle across d at c: a fat grip swelling in the middle, finger ridges underneath, the rope knotted in a boss.""" + d = Vector(d).normalized() + a, b = Vector(c) - d * L / 2, Vector(c) + d * L / 2 + C = [a.lerp(b, k / 6) for k in range(7)] + + def sec(s, i): + rr = r * (0.82 + 0.3 * math.sin(PI * s) - 0.08 * (1 if 0.25 < s < 0.75 and i % 2 else 0)) + return circ((rr * 1.15, rr), 8) + P.append(sweep("pullh", C, sec, [m or M.black], ang=50, ref=(0, 0, 1))) + + +def rope_line(P, pts, r, m, segs=5): + """A rope or cord with a twist: a slightly lobed section rolled along the run.""" + C = densify(fillet(pts, 0.03, 3), max(r * 10, 0.025)) + Lt = arclen([Vector(p) for p in C])[-1] + + def sec(s, i): + return [(r * (1 + 0.14 * math.cos(3 * (q * TAU / segs) - s * Lt / (r * 5.0))) * math.cos(q * TAU / segs), + r * (1 + 0.14 * math.cos(3 * (q * TAU / segs) - s * Lt / (r * 5.0))) * math.sin(q * TAU / segs)) for q in range(segs)] + P.append(sweep("rope", C, sec, [m], ang=60)) + + +def muffler(P, c, axis, R, L, M, shield=True, ref=None, spout=None, holes=True): + """A muffler can along `axis` from c: rolled end seams, bolts on the flange, a perforated heat shield over the top half, a spout.""" + axis = Vector(axis).normalized() + prof = [(0.0, 0.0), (R * 0.82, 0.0), (R * 0.95, 0.003), (R, 0.007), (R * 1.04, 0.009), (R, 0.011), (R, L - 0.011), (R * 1.04, L - 0.009), (R, L - 0.007), + (R * 0.95, L - 0.003), (R * 0.8, L), (0.0, L)] + P.append(rev("muff", prof, c, axis, [M.muff], segs=12, ref=ref, ang=40)) + if shield: + F = fz(c, axis, ref) + rr = R + 0.0045 + + def fn(u, v, off): + a = DEG(-20 + 220 * v) + return F @ Vector(((rr + off) * math.cos(a), (rr + off) * math.sin(a), 0.006 + (L - 0.012) * u)) + P.append(FT.grid_slab("shield", fn, 4, 8, 0.0011, -0.0011, M.black, smooth_ang=50)) + for i in range(3 if holes else 0): + for j in range(2): + a = DEG(20 + 140 * (j + 0.5) / 2 + (14 if i % 2 else 0)) + p = F @ Vector(((rr + 0.0012) * math.cos(a), (rr + 0.0012) * math.sin(a), 0.012 + (L - 0.024) * (i + 0.5) / 3)) + nrm = (F.to_3x3() @ Vector((math.cos(a), math.sin(a), 0))).normalized() + P.append(rev("hole", [(0.0035, -0.0004), (0.0028, 0.0002), (0.0, 0.0001)], p, nrm, [M.d1], segs=8, ang=60)) + if spout: + a, b = Vector(spout[0]), Vector(spout[1]) + P.append(tube5("spout", [a, b], R * 0.3, M.d1, segs=10, cap1=False)) + P.append(rev("spoutlip", [(R * 0.24, -0.001), (R * 0.33, 0.0), (R * 0.35, 0.004), (R * 0.26, 0.005)], b, (b - a), [M.d1], segs=10)) + + +def tread_tyre(P, M, out, R=0.1, W=0.044, pitches=10, rim_m=None, hub_m=None): + """A small treaded tyre about local X at the origin (out = +1 / -1: which side faces out). The carcass and its tread are one + surface: chevron lugs stand out of the crown with steep walls and wrap over the shoulders, so the outline reads as a tyre. A raised + ring and moulded lettering on the outer sidewall, a bead ridge where the tyre meets the rim's rolled lip, a spoked rim, a bearing + boss, the axle nut on its washer with the thread showing.""" + hw = W / 2 + X = Vector((out, 0, 0)) + F = fz(Vector(), X, (0, 0, 1)) + Rc = R - 0.0058 + # profile across the tyre (inner side first): (r, z along the axle, lug lift weight, chevron lean) + pr = [(0.645 * R, -0.9 * hw, 0.0, -1), (0.82 * R, -1.08 * hw, 0.0, -1), (Rc - 0.0035, -0.99 * hw, 0.45, -1), + (Rc, -0.8 * hw, 1.0, -1), (Rc, 0.0, 1.0, 0), (Rc, 0.8 * hw, 1.0, 1), (Rc - 0.0035, 0.99 * hw, 0.45, 1), (0.855 * R, 1.07 * hw, 0.0, 1), + (0.79 * R, 1.13 * hw, 0.0, 1), (0.745 * R, 1.07 * hw, 0.0, 1), (0.695 * R, 1.09 * hw, 0.0, 1), (0.645 * R, 0.9 * hw, 0.0, 1)] + ph = (0.0, 0.075, 0.5, 0.575) # per pitch: wall foot, lug top, lug top, wall foot; then the groove + rings = [] + for r, z, w, lean in pr: + sh = 0.32 * abs(lean) + ring = [] + for k in range(pitches): + for j, p in enumerate(ph): + a = TAU * (k + p + sh) / pitches + rr = r + (R - Rc) * w * (1.0 if j in (1, 2) else 0.0) + ring.append(F @ Vector((rr * math.cos(a), rr * math.sin(a), z))) + rings.append(ring) + P.append(rings_mesh("tyre", rings, [M.rub], cap0=False, cap1=False, ang=48)) + # moulded lettering on the outer sidewall: one arc of raised strokes + glyphs = {"H": [(-1.5, 0, 0.45, 3), (1.5, 0, 0.45, 3)], "T": [(0, -0.4, 0.45, 2.6), (0, 2.6, 2.0, 0.45)], "L": [(-1.0, 0, 0.45, 3), (0.6, -2.6, 1.5, 0.45)], + "I": [(0, 0, 0.45, 3)], "E": [(-1.3, 0, 0.45, 3), (0.4, 2.6, 1.5, 0.45), (0.4, -2.6, 1.5, 0.45)]} + rl, zl = 0.886 * R, 1.03 * hw + nrm2 = Vector((0.27, 0.96)) # the sidewall's slope there, (radial, axial) + for k, g in enumerate("HTLIHT"): + a0 = 0.9 + k * 0.072 + for du, dv, hu, hv in glyphs[g]: + a = a0 + du * 0.001 / rl + rad = Vector((math.cos(a), math.sin(a), 0.0)) + c = F @ (rad * (rl + dv * 0.001) + Vector((0, 0, zl - dv * 0.001 * 0.28))) + n = (F.to_3x3() @ (rad * nrm2.x + Vector((0, 0, nrm2.y)))).normalized() + tg = (F.to_3x3() @ Vector((-math.sin(a), math.cos(a), 0.0))).normalized() + outl = [(-hu * 0.001, -hv * 0.001), (hu * 0.001, -hv * 0.001), (hu * 0.001, hv * 0.001), (-hu * 0.001, hv * 0.001)] + P.append(bprism("letter", outl, -0.0005, 0.001, [M.rub], segs=1, frame=fz(c, n, tg))) + # the rim: a dished steel wheel, its lip rolled over the tyre's bead, four spokes to the hub + rim = rim_m or M.white + P.append(rev("rimseat", [(0.6 * R, -0.9 * hw), (0.668 * R, -0.93 * hw), (0.678 * R, -0.86 * hw), (0.648 * R, -0.72 * hw), (0.648 * R, 0.72 * hw), + (0.678 * R, 0.86 * hw), (0.668 * R, 0.93 * hw), (0.6 * R, 0.9 * hw)], Vector(), X, [rim], segs=12, ref=(0, 0, 1), ang=40)) + for k in range(4): + a = TAU * k / 4 + 0.3 + rad = Vector((0.0, math.cos(a), math.sin(a))) + tng = Vector((0.0, -math.sin(a), math.cos(a))) + C = [rad * R * 0.2 + X * hw * 0.35, rad * R * 0.6 + X * hw * 0.05] + P.append(sweep("spoke", C, lambda s, i: rrect(0.0055 + 0.002 * s, 0.003, 0.0018, 1), [rim], ref=tuple(tng), ang=40)) + hub = hub_m or M.d2 + P.append(rev("hub", [(0.0, -hw * 0.75), (R * 0.12, -hw * 0.78), (R * 0.2, -hw * 0.6), (R * 0.22, hw * 0.1), (R * 0.2, hw * 0.4), (R * 0.15, hw * 0.48), + (R * 0.12, hw * 0.5), (0.0, hw * 0.5)], Vector(), X, [hub], segs=8, ref=(0, 0, 1), ang=40)) + # the axle nut on its washer outside the hub, the thread end showing + q = washer(P, X * hw * 0.5, X, 0.0115, 0.0016, m=M.hw) + q = hexnut(P, q, X, 0.0092, 0.0062, m=M.hw, ref=(0, 0, 1)) + P.append(rev("axend", [(0.0042, -0.001), (0.0042, 0.0022), (0.0034, 0.0034), (0.0, 0.0036)], q, X, [M.st], segs=8)) + + +def fill5(x0, x1, y0, y1, z0, z_edge, z_top, seed=1717, name="Fill", m="M_Clippings", nx=11, ny=8, strands=24): + """Clippings heaped in the catcher: a soft mound over a rounded footprint, lumps and hollows where it fell in, loose blades of + grass standing out of it. Origin at the bottom (the game scales it on local Z).""" + rnd = random.Random(seed) + cx, cy, hx, hy = (x0 + x1) / 2, (y0 + y1) / 2, (x1 - x0) / 2, (y1 - y0) / 2 + blobs = [(rnd.uniform(-0.7, 0.7), rnd.uniform(-0.6, 0.6), rnd.uniform(-0.6, 1.0), rnd.uniform(0.18, 0.34)) for _ in range(7)] + span = z_top - z_edge + + def sq(u, v): + """The square (u, v) in -1..1 pulled into a squircle, and its radius 0..1.""" + mx = max(abs(u), abs(v)) + if mx < 1e-9: + return 0.0, 0.0, 0.0 + k = mx / (abs(u) ** 4 + abs(v) ** 4) ** 0.25 + return u * k, v * k, mx + + def hgt(u, v, rs): + z = z_edge + span * 0.62 * (1.0 - rs ** 2.4) + for bu, bv, a, sg in blobs: + z += span * 0.22 * a * math.exp(-((u - bu) ** 2 + (v - bv) ** 2) / (2 * sg * sg)) * (1.0 - rs ** 3) + z += span * 0.06 * math.sin(7.3 * u + 2.1) * math.sin(6.1 * v + 0.7) * (1.0 - rs ** 2) + return min(z, z_top - 0.0015) + bm = bmesh.new() + G = [] + for i in range(nx): + row = [] + for j in range(ny): + u, v = -1 + 2 * i / (nx - 1), -1 + 2 * j / (ny - 1) + su, sv, rs = sq(u, v) + row.append(bm.verts.new((cx + hx * su, cy + hy * sv, hgt(u, v, rs)))) + G.append(row) + for i in range(nx - 1): + for j in range(ny - 1): + bm.faces.new((G[i][j], G[i + 1][j], G[i + 1][j + 1], G[i][j + 1])) + rim = [G[i][0] for i in range(nx)] + [G[nx - 1][j] for j in range(1, ny)] + [G[i][ny - 1] for i in range(nx - 2, -1, -1)] + [G[0][j] for j in range(ny - 2, 0, -1)] + low = [bm.verts.new((v.co.x, v.co.y, z0)) for v in rim] + for k in range(len(rim)): + j = (k + 1) % len(rim) + bm.faces.new((rim[k], rim[j], low[j], low[k])) + bm.faces.new(list(reversed(low))) + # loose blades: thin three-sided spikes leaning out of the heap + for _ in range(strands): + u, v = rnd.uniform(-0.85, 0.85), rnd.uniform(-0.8, 0.8) + su, sv, rs = sq(u, v) + p = Vector((cx + hx * su, cy + hy * sv, hgt(u, v, rs) - 0.002)) + a = rnd.uniform(0, TAU) + L = rnd.uniform(0.012, 0.022) + d = Vector((math.cos(a) * 0.8, math.sin(a) * 0.8, rnd.uniform(0.35, 0.9))).normalized() + tip = p + d * L + tip.z = min(tip.z, z_top - 0.0008) + side = d.cross(Vector((0, 0, 1))) + side = side.normalized() if side.length > 1e-6 else Vector((1, 0, 0)) + b = [bm.verts.new(p + side * 0.0026), bm.verts.new(p - side * 0.0026), bm.verts.new(p + d.cross(side).normalized() * 0.0012)] + t = bm.verts.new(tip) + for q in range(3): + bm.faces.new((b[q], b[(q + 1) % 3], t)) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + bmesh.ops.triangulate(bm, faces=[f for f in bm.faces if len(f.verts) > 4], ngon_method="EAR_CLIP") + o = mesh_obj(name, bm) + set_mats(o, m) + uv_box(o, 1.0) + UM.one_uv(o) + smooth(o, 60) + set_origin(o, (cx, cy, z0)) + return o + + +# ======================================================================= SM_Tool_LawnMower + +def lawn_mower(): + M = PK + G, YC, HW, HD = -0.95, -0.80, 0.53, 0.36 + P = [] + # ---- the deck: one pressed shell. From the rolled skirt a stiffening rib runs round the edge; inside it the crown rises in two + # more ribs that follow the outline, then steps down into a recessed panel round the engine mount. The skirt is rolled out into + # a bead at the bottom. + ZR = -0.7302 # floor of the engine panel + RX, RY, RRC, RCY = 0.205, 0.165, 0.05, -0.83 # the panel: half width, half depth, corner radius, centre y + + def rec_ring(inset, z): + return [Vector((x, RCY + y, z)) for x, y, _ in rr_pts(RX - inset, RY - inset, max(0.004, RRC - inset), nc=3, nf=(2, 1))] + z0 = -0.7275 + outer = [Vector((x, YC + y, z0)) for x, y, _ in rr_pts(HW - 0.105, HD - 0.105, 0.015, nc=3, nf=(2, 1))] + inner = rec_ring(0.0, z0) + dist = [(a - b).length for a, b in zip(outer, inner)] + # across the band from the plateau edge (s 0) to the panel edge (s 1): (s, crown rise, rib) + S = [(1.0, 0.004, 0), (0.93, 0.0075, 0), (0.82, 0.0105, 0), (0.71, 0.012, 0), (0.66, 0.0122, 1), (0.61, 0.012, 0), (0.48, 0.0122, 0), + (0.35, 0.0102, 0), (0.3, 0.0098, 1), (0.25, 0.0092, 0), (0.12, 0.0055, 0)] + pre = rec_ring(0.04, ZR), rec_ring(0.008, ZR), rec_ring(0.0035, ZR + 0.0022) + pre = list(pre) + for s_, rise, rib in S: + ring = [] + for a, b, dd in zip(outer, inner, dist): + cr = min(1.0, dd / 0.12) # the crown is lower where the band is narrow (in front of the engine) + kr = max(0.0, min(1.0, (dd - 0.075) / 0.04)) # no room for the ribs there + ring.append(a.lerp(b, s_) + Vector((0, 0, rise * cr * 1.35 + 0.0075 * rib * kr))) + pre.append(ring) + prof = [(-0.105, -0.7275), (-0.076, -0.728), (-0.067, -0.7222), (-0.057, -0.7222), (-0.048, -0.729), + (-0.038, -0.734), (-0.024, -0.745), (-0.012, -0.761), (-0.004, -0.779), (0.0, -0.8), (0.0, -0.866)] + cx_, cz_, rr_ = 0.0042, -0.8755, 0.0076 + for a in (110, 20, -70, -175): + prof.append((cx_ + rr_ * math.cos(DEG(a)), cz_ + rr_ * math.sin(DEG(a)))) + prof += [(-0.0032, -0.866), (-0.0032, -0.8), (-0.03, -0.741), (-0.105, -0.7318)] + rings = pre + [[Vector((x, YC + y, z)) for x, y, _ in rr_pts(HW + d, HD + d, 0.12 + d, nc=3, nf=(2, 1))] for d, z in prof] + npre = len(pre) + deck = rings_mesh("deck", rings, [M.red, M.redd], colfn=lambda i, j: 1 if (i < 2 or 11 + npre <= i <= 14 + npre) else 0, ang=34) + P.append(deck) + from mathutils.bvhtree import BVHTree + bpy.context.view_layer.update() + bvh = BVHTree.FromObject(deck, bpy.context.evaluated_depsgraph_get()) + + def on_deck(x, y): + hit = bvh.ray_cast(Vector((x, y, -0.5)), Vector((0, 0, -1))) + return (hit[0], hit[1]) if hit[0] is not None else (Vector((x, y, z0)), Vector((0, 0, 1))) + + def plate(name, out, c, h, m, rings_=(0.55,), inset=0.0012, sink=0.0006, walls=True): + """A transfer or a pressed pad lying on the deck: its outline (2D, round c) dropped onto the surface, a bevelled edge, a top + that follows the crown.""" + c = Vector(c) + bm = bmesh.new() + RR = [] + cen2 = Vector((c.x, c.y)) + for ri, (f, up) in enumerate([(1.0, -sink)] + [(1.0, h)] + [(k, h) for k in rings_]): + if not walls and ri == 0: + continue + row = [] + for u, v in out: + q = Vector((u, v)) + if ri == 1: + q = q - q.normalized() * inset if q.length > inset * 2 else q + q = cen2 + q * f + p, n = on_deck(q.x, q.y) + row.append(bm.verts.new(p + n * up)) + RR.append(row) + p, n = on_deck(c.x, c.y) + vc = bm.verts.new(p + n * h) + nn = len(out) + for a in range(len(RR) - 1): + for j in range(nn): + bm.faces.new((RR[a][j], RR[a][(j + 1) % nn], RR[a + 1][(j + 1) % nn], RR[a + 1][j])) + for j in range(nn): + bm.faces.new((RR[-1][j], RR[-1][(j + 1) % nn], vc)) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + for f_ in bm.faces: + f_.normal_update() + if sum(f_.normal.z for f_ in bm.faces) < 0: + bmesh.ops.reverse_faces(bm, faces=bm.faces) + o = mesh_obj(name, bm) + set_mats(o, m) + smooth(o, 40) + P.append(o) + # a white bead pressed round the skirt + zb = [-0.846, -0.843, -0.818, -0.815] + db = [0.0004, 0.0032, 0.0032, 0.0004] + rings = [[Vector((x, YC + y, z)) for x, y, _ in rr_pts(HW + d, HD + d, 0.12 + d, nc=3, nf=(2, 1))] for d, z in zip(db, zb)] + P.append(rings_mesh("deckband", rings, [M.white], cap0=False, cap1=False, ang=50)) + # decal panels on the crown between the ribs: white transfers, the maker's name on the right, the cutting heights on the left + for sx in (-1, 1): + cx = sx * 0.322 + plate("decal", rrect(0.026, 0.15, 0.012, 2), (cx, YC - 0.03), 0.0009, M.white) + for k, (L, dy) in enumerate(((0.09, 0.06), (0.06, 0.02), (0.075, -0.035), (0.04, -0.075)) if sx > 0 else ((0.11, 0.05), (0.03, -0.02), (0.03, -0.06))): + plate("dtxt", rrect(0.0042 if k == 0 else 0.0028, L / 2, 0.0015, 1), (cx + (0.008 if k else 0.0) * (1 if k % 2 else -1), YC - 0.03 + dy), 0.0013, + M.red if sx > 0 else M.black, rings_=(), inset=0.0, walls=False) + # a warning transfer on the front of the deck + LB = (-0.3, -1.022) + plate("label", rrect(0.05, 0.022, 0.006, 2), LB, 0.0009, M.gold) + plate("labtri", rounded_outline([(0.0, 0.013), (-0.012, -0.008), (0.012, -0.008)], 0.0025, 1), (LB[0] - 0.026, LB[1]), 0.0014, M.black, rings_=(), + inset=0.0, walls=False) + for k in range(2): + plate("labtxt", rrect(0.018 - 0.005 * k, 0.002, 0.0012, 1), (LB[0] + 0.014, LB[1] + 0.005 - 0.01 * k), 0.0014, M.black, rings_=(), inset=0.0, + walls=False) + # the moulded height-adjust pads on the shoulder at each wheel, a white tick for each notch of the quadrant below + for x, y in ((0.57, -1.08), (-0.57, -1.08), (0.57, -0.52), (-0.57, -0.52)): + s = 1 if x > 0 else -1 + py = y + (0.02 if y < -0.8 else -0.02) + plate("hpad", rrect(0.019, 0.04, 0.01, 2), (s * 0.49, py), 0.0022, M.redd, inset=0.0025) + for k in range(5): + plate("htick", rrect(0.0075 - (0.002 if k % 2 else 0.0), 0.0013, 0.0008, 1), (s * (0.493 + (0.002 if k % 2 else 0.0)), py - 0.028 + 0.014 * k), 0.0028, + M.white, rings_=(), inset=0.0, walls=False) + + # ---- the engine: a vertical-shaft engine under a black shroud, cylinder head with fins and the plug poking out the front + sc = Vector((0.0, -0.83, 0.0)) + srings = [] + for hw, hd, rc, z in ((0.168, 0.148, 0.045, -0.736), (0.17, 0.15, 0.048, -0.725), (0.17, 0.15, 0.05, -0.645), (0.168, 0.148, 0.048, -0.641), + (0.17, 0.15, 0.05, -0.637), (0.17, 0.15, 0.05, -0.59), (0.167, 0.147, 0.049, -0.575), (0.159, 0.139, 0.046, -0.565), + (0.148, 0.128, 0.042, -0.5605), (0.13, 0.11, 0.036, -0.5595)): + srings.append([Vector((x, sc.y + y, z)) for x, y, _ in rr_pts(hw, hd, rc, nc=3, nf=(2, 2))]) + P.append(rings_mesh("shroud", srings, [M.black], ang=36)) + # cooling-air louvres in the shroud's front beside the head, a red primer bulb on the left, a maker's plate on the right + for k in range(4): + slot(P, Vector((0.1 + 0.014 * k, -0.9805, -0.632)), (0, -1, 0), (0, 0, 1), 0.05, 0.0072, 0.0014, M.plast) + + P.append(rev("primer", [(0.0125, 0.003), (0.0135, 0.007), (0.0125, 0.012), (0.009, 0.0158), (0.0, 0.017)], Vector((-0.1705, -0.76, -0.612)), (-1, 0, 0), [M.red], + segs=12, ang=60)) + P.append(bprism("badge", rrect(0.045, 0.018, 0.006, 1), -0.0006, 0.0016, [M.red], bev=0.0006, segs=1, frame=fz(Vector((0.1702, -0.85, -0.615)), (1, 0, 0), (0, 1, 0)))) + P.append(bprism("badgeline", rrect(0.034, 0.0028, 0.0015, 1), 0.0016, 0.0024, [M.white], bev=0.0003, segs=1, frame=fz(Vector((0.1702, -0.85, -0.615)), (1, 0, 0), (0, 1, 0)))) + # the engine's mounting bolts in the recessed panel, each on a washer + for sx in (-1, 1): + for yy in (-0.965, -0.695): + q = washer(P, Vector((sx * 0.185, yy, ZR - 0.0003)), (0, 0, 1), 0.0105, 0.0016, m=M.hw) + head(P, q, (0, 0, 1), 0.0052, "hex", m=M.hw, ref=(1, 0.3, 0)) + # recoil starter on top: pressed white cover, vents, cap; the rope out of a guide on its side + recoil(P, Vector((0.0, -0.83, -0.5592)), (0, 0, 1), 0.108, 0.029, M, ref=(1, 0, 0), vents=5, cover=M.white, cap=M.d2) + ga = DEG(38) + gp = Vector((0.106 * math.cos(ga), -0.83 + 0.106 * math.sin(ga), -0.5465)) + gn = Vector((math.cos(ga), math.sin(ga), 0.0)) + P.append(rev("ropeguide", [(0.0068, -0.004), (0.0078, 0.0), (0.0074, 0.0035), (0.0052, 0.0052), (0.0034, 0.0045), (0.003, 0.0)], gp, gn, [M.d2], segs=12)) + # fuel tank: two pressed halves crimped together, a filler neck, a knurled cap with a breather tab + tc = Vector((0.145, -0.685, 0.0)) + tr = [] + for hw, hd, rc, z in ((0.046, 0.056, 0.016, -0.662), (0.053, 0.063, 0.02, -0.656), (0.055, 0.065, 0.021, -0.645), (0.055, 0.065, 0.021, -0.618), + (0.055, 0.065, 0.021, -0.612), (0.055, 0.065, 0.021, -0.585), (0.051, 0.061, 0.019, -0.575), (0.042, 0.052, 0.015, -0.5705)): + tr.append([Vector((tc.x + x, tc.y + y, z)) for x, y, _ in rr_pts(hw, hd, rc, nc=3, nf=(1, 1))]) + P.append(rings_mesh("tank", tr, [M.red], ang=40)) + crimp_seam(P, [Vector((tc.x + x, tc.y + y, -0.615)) for x, y, _ in rr_pts(0.055, 0.065, 0.021, nc=3, nf=(1, 1))], (0, 0, 1), M.red, r=0.0021) + P.append(rev("neck", [(0.0125, -0.0035), (0.0125, 0.004), (0.0135, 0.0055), (0.0125, 0.007)], Vector((0.145, -0.685, -0.571)), (0, 0, 1), [M.d2], segs=14)) + + def knurl(i, a): + return 1.0 + (0.07 * math.cos(12 * a) if 1 <= i <= 3 else 0.0) + P.append(rev("tankcap", [(0.0135, 0.0), (0.0175, 0.0008), (0.0182, 0.004), (0.0182, 0.0125), (0.0168, 0.0158), (0.009, 0.0178), (0.0, 0.0182)], + Vector((0.145, -0.685, -0.5645)), (0, 0, 1), [M.black], segs=16, mod=knurl, ang=45)) + P.append(bprism("captab", rounded_outline([(-0.004, -0.009), (0.004, -0.009), (0.004, 0.009), (-0.004, 0.009)], 0.0025, 1), 0.0, 0.007, [M.black], + bev=0.0012, segs=1, frame=Matrix.Translation((0.145, -0.685, -0.5475)))) + # air filter on the front left: a cover with a ribbed lid and a screw, on a base, a hose to the carburettor + fc = Vector((-0.17, -0.885, 0.0)) + fr = [] + for hw, hd, rc, z in ((0.049, 0.064, 0.017, -0.682), (0.05, 0.065, 0.018, -0.656), (0.053, 0.068, 0.019, -0.654), + (0.053, 0.068, 0.019, -0.648), (0.05, 0.065, 0.018, -0.646), (0.049, 0.064, 0.018, -0.612), (0.045, 0.06, 0.016, -0.603), + (0.036, 0.051, 0.012, -0.6)): + fr.append([Vector((fc.x + x, fc.y + y, z)) for x, y, _ in rr_pts(hw, hd, rc, nc=3, nf=(1, 1))]) + P.append(rings_mesh("filter", fr, [M.d2, M.d1], colfn=lambda i, j: 1 if i in (1, 2, 3) else 0, ang=40)) + for k in range(4): + y0 = fc.y - 0.045 + 0.03 * k + C = [Vector((fc.x - 0.032, y0, -0.6005)), Vector((fc.x + 0.032, y0, -0.6005))] + P.append(sweep("frib", C, lambda s, i: [(0.0028, -0.0006), (0.0018, 0.0022), (-0.0018, 0.0022), (-0.0028, -0.0006)], [M.d2], ref=(0, 1, 0), ang=50)) + P.append(rev("fscrew", [(0.0, 0.0), (0.009, 0.0), (0.0095, 0.003), (0.007, 0.006), (0.0, 0.0065)], Vector((fc.x, fc.y, -0.6005)), (0, 0, 1), [M.black], segs=8, + mod=lambda i, a: 1.0 + (0.12 * math.cos(6 * a) if i in (1, 2) else 0.0))) + # muffler at the back left, its shield, a spout pointing down and back + muffler(P, Vector((-0.17, -0.705, -0.66)), (0, 1, 0), 0.029, 0.075, M, ref=(0, 0, 1), spout=((-0.17, -0.632, -0.668), (-0.17, -0.618, -0.688)), holes=False) + + # the cylinder: fins on the barrel and the head poking out of the front of the shroud, head bolts, the plug and its lead + fin_stack(P, Vector((0.0, -0.986, -0.668)), (0, -1, 0), (1, 0, 0), 0.13, 0.092, 0.012, 5, 0.0082, 0.0034, 0.004, M.d1, + core=(0.05, 0.034), mat_core=M.d1) + hc = Vector((0.0, -1.03, -0.668)) + P.append(bprism("head", rrect(0.056, 0.04, 0.014, 3), 0.0, 0.012, [M.d1, M.d2], bev=0.003, segs=2, frame=fz(hc + Vector((0, 0.012, 0)), (0, -1, 0), (1, 0, 0)), bev_slot=1)) + for sx in (-1, 1): + for sz in (-1, 1): + head(P, hc + Vector((sx * 0.04, -0.0005, sz * 0.025)), (0, -1, 0), 0.0034, "hex", m=M.hw, ref=(1, 0, 0)) + spark_plug(P, hc + Vector((0.0, -0.001, 0.009)), (0, -1, 0.42), M, + lead=[(0.0, -1.075, -0.636), (-0.03, -1.07, -0.62), (-0.075, -1.0, -0.6), (-0.095, -0.985, -0.605)]) + P.append(rev("grommet", [(0.0042, -0.002), (0.0068, 0.0), (0.007, 0.003), (0.0042, 0.004)], Vector((-0.095, -0.979, -0.605)), (0, -1, 0), [M.rub], segs=10)) + # control bracket on the back of the shroud: a plate, the lever the cable pulls, a spring, the cable clamp + cb = Vector((-0.085, -0.678, -0.612)) + P.append(bprism("ctlplate", rounded_outline([(-0.022, -0.018), (0.022, -0.018), (0.022, 0.016), (-0.022, 0.016)], 0.006, 1), -0.0015, 0.0015, [M.d2], + bev=0.0, segs=1, frame=fz(cb, (0, 1, 0), (1, 0, 0)))) + + P.append(tube5("ctllever", [cb + Vector((0.004, 0.004, 0.0)), cb + Vector((0.016, 0.006, 0.012)), cb + Vector((0.02, 0.006, 0.026))], 0.0026, M.hw, segs=8, bend=0.006)) + # ---- the deck's rear chute into the bag: a rounded tunnel with a flange round its mouth, bolted + C = [Vector((0.0, -0.468, -0.792)), Vector((0.0, -0.43, -0.792)), Vector((0.0, -0.392, -0.79))] + + def chsec(s, i): + return rrect(0.168 - 0.002 * s, 0.066 - 0.002 * s, 0.03, 3) + P.append(sweep("chute", C, chsec, [M.d1], ref=(1, 0, 0), ang=40)) + fl = [Vector((0.0, -0.392, -0.79)), Vector((0.0, -0.384, -0.79))] + P.append(sweep("chflange", fl, lambda s, i: rrect(0.18, 0.078, 0.036, 3), [M.d1, M.d2], colfn=lambda i, j: 1 if j < 0 else 0, ref=(1, 0, 0), ang=40)) + + # a hinged flap over the chute's top, its rod in two knuckles and a coil spring + hz = -0.718 + P.append(tube5("hingerod", [(-0.19, -0.462, hz), (0.19, -0.462, hz)], 0.0038, M.hw, segs=8)) + for sx in (-1, 1): + P.append(rev("knuckle", [(0.0048, -0.008), (0.0068, -0.007), (0.0072, 0.0), (0.0068, 0.007), (0.0048, 0.008)], Vector((sx * 0.175, -0.462, hz)), (1, 0, 0), + [M.d1], segs=8)) + + flap = [Vector((0.0, -0.462, hz)), Vector((0.0, -0.44, hz - 0.002)), Vector((0.0, -0.41, hz - 0.004))] + P.append(sweep("flap", flap, lambda s, i: rrect(0.172, 0.0022, 0.0018, 1), [M.d1], ref=(1, 0, 0), ang=40)) + + # ---- wheels' stub axles and the height levers in notched quadrants on the skirt + hubs = {"Wheel_FL": (0.57, -1.08), "Wheel_FR": (-0.57, -1.08), "Wheel_RL": (0.57, -0.52), "Wheel_RR": (-0.57, -0.52)} + R = 0.1 + for n_, (x, y) in hubs.items(): + s = 1 if x > 0 else -1 + zc = G + R + X = Vector((s, 0, 0)) + P.append(tube5("axle", [(s * 0.5, y, zc), (s * 0.556, y, zc)], 0.0085, M.hw, segs=6)) + # the quadrant: a plate bolted to the skirt, five notches along its arc + Fq = Matrix((Vector((0, 1, 0)), Vector((0, 0, 1)), X)).transposed().to_4x4() + Fq.translation = Vector((s * 0.5345, y, zc)) + arc = [] + for k in range(6): + a = DEG(40 + 70 * k / 5) + rr = 0.105 - (0.007 if k in (2, 4) else 0.0) + + arc.append((rr * math.cos(a), rr * math.sin(a))) + out = [(0.03, -0.012), (0.03, 0.03)] + arc + [(-0.012, 0.03), (-0.012, -0.012)] + Fl = Fq @ Matrix.Diagonal((1, 1, s, 1)) if s < 0 else Fq + P.append(bprism("quadrant", out, -0.0035, 0.0, [M.d2, M.st], bev=0.0009, segs=1, frame=Fl, bev_slot=1, min_ang=30)) + for p in ((0.018, 0.0),): + head(P, Fq @ Vector((p[0], p[1], 0.0)), X, 0.0034, "hex", m=M.hw, ref=(0, 1, 0)) + # the lever: a flat bar from the axle up through the notch, a moulded knob, a washer and nut on the pivot + tip = Vector((s * 0.5395, y + 0.05, zc + 0.104)) + lv = [Vector((s * 0.5395, y, zc)), Vector((s * 0.5395, y + 0.03, zc + 0.065)), tip] + P.append(sweep("lever", fillet(lv, 0.05, 2), lambda sf, i: rrect(0.0022, 0.0075, 0.0018, 1), [M.st], ref=(1, 0, 0), ang=40)) + q = washer(P, Vector((s * 0.5418, y, zc)), X, 0.012, 0.0016, m=M.hw) + hexnut(P, q, X, 0.0105, 0.0065, m=M.hw, ref=(0, 1, 0)) + d = (tip - lv[1]).normalized() + P.append(rev("leverknob", [(0.0, -0.002), (0.0085, 0.0), (0.0125, 0.008), (0.0125, 0.022), (0.0095, 0.029), (0.0, 0.031)], + tip - d * 0.004, d, [M.black], segs=6, ang=50)) + + + # ---- the handle + # grip bar: a tube, foam grips with flared collars, pivot clips for the bail past their ends, end plugs + P.append(tube5("gripbar", [(-0.296, 0.0, 0.0), (0.296, 0.0, 0.0)], 0.0155, M.tube, segs=14, cap0=False, cap1=False)) + for sg in (-1, 1): + def gm(i, a): + return 1.0 + xs = [0.094, 0.098, 0.104, 0.108] + [0.112 + 0.0105 * k for k in range(14)] + [0.255, 0.258] + prof = [(0.0158, 0.0), (0.0235, 0.002), (0.0245, 0.006), (0.0215, 0.011)] + for k in range(9): + prof.append((0.0212 + (0.0015 if k % 2 == 0 else 0.0) + 0.0012 * math.sin(PI * k / 8), 0.016 + 0.017 * k)) + prof += [(0.0222, 0.157), (0.0175, 0.159)] + P.append(rev("grip", prof, Vector((sg * 0.094, 0.0, 0.0)), (sg, 0, 0), [M.rub], segs=10, ang=50)) + # bail pivot clip: a moulded block clamped round the bar, a screw through it + cpos = Vector((sg * 0.27, 0.0, 0.0)) + P.append(rev("pclip", [(0.0158, -0.012), (0.0195, -0.011), (0.0215, -0.008), (0.0218, 0.008), (0.0195, 0.011), (0.0158, 0.012)], cpos, (1, 0, 0), + [M.black], segs=8, ang=40)) + P.append(bprism("pclipboss", rounded_outline([(-0.012, -0.004), (0.012, -0.004), (0.012, 0.024), (-0.012, 0.024)], 0.008, 1), -0.009, 0.009, [M.black], + bev=0.002, segs=1, frame=fz(cpos + Vector((0, 0, -0.008)), (1, 0, 0), (0, -1, -0.6)))) + head(P, cpos + Vector((sg * 0.0, -0.016, -0.026)) + Vector((-sg * 0.0095, 0, 0)), (-sg, 0, 0), 0.0024, "dome", m=M.hw) + P.append(rev("endplug", [(0.0, 0.0), (0.0158, 0.0), (0.0168, 0.002), (0.0165, 0.0065), (0.012, 0.0095), (0.0, 0.0105)], Vector((sg * 0.296, 0.0, 0.0)), + (sg, 0, 0), [M.black], segs=8, ang=50)) + # the tee: a cast sleeve on the bar, a socket down the shaft, a bolt through + sh0, J = Vector((0.0, -0.02, -0.02)), Vector((0.0, -0.38, -0.56)) + dsh = (J - sh0).normalized() + P.append(rev("teesleeve", [(0.0156, -0.042), (0.0215, -0.041), (0.0242, -0.036), (0.0248, 0.0), (0.0242, 0.036), (0.0215, 0.041), (0.0156, 0.042)], + Vector((0, 0, 0)), (1, 0, 0), [M.d1], segs=12, ang=40)) + + P.append(rev("teesock", [(0.0225, -0.002), (0.0232, 0.012), (0.0218, 0.046), (0.0228, 0.05), (0.0228, 0.056), (0.0198, 0.06)], sh0 - dsh * 0.0, dsh, + [M.d1], segs=12, ang=40)) + nb = dsh.cross(Vector((1, 0, 0))).normalized() + bolt5(P, sh0 + dsh * 0.04 + Vector((0.0235, 0, 0)), (1, 0, 0), 0.047, 0.0042, kind="hex", m=M.hw, ref=nb, thr=0.004) + # shaft, yoke and the two lower arms, bends, flattened ends into brackets with knob nuts + P.append(tube5("shaft", [sh0 + dsh * 0.03, J], 0.019, M.tube, segs=14, cap0=False)) + P.append(rev("yokesock", [(0.0205, -0.05), (0.0232, -0.046), (0.0238, -0.01), (0.026, 0.0), (0.03, 0.012)], J, dsh, [M.d1], segs=12, ang=40)) + P.append(bprism("yoke", rounded_outline([(-0.05, -0.03), (0.05, -0.03), (0.05, 0.02), (-0.05, 0.02)], 0.016, 2), -0.022, 0.022, [M.d1, M.d2], + bev=0.0045, segs=1, frame=fz(J + Vector((0, -0.004, -0.012)), (0, -0.25, 1), (1, 0, 0)), bev_slot=1)) + for sx in (-1, 1): + head(P, J + Vector((sx * 0.032, -0.03, 0.008)), (0, -0.55, 0.85), 0.0042, "hex", m=M.hw, ref=(1, 0, 0)) + for s in (-1, 1): + A0 = J + Vector((s * 0.04, -0.008, -0.022)) + end = Vector((s * 0.42, -0.488, -0.708)) + pts = [A0, Vector((s * 0.2, -0.42, -0.62)), end] + C = densify(fillet(pts, 0.12, 4), 0.08) + Lc = arclen(C)[-1] + + def armsec(sf, i, Lc=Lc): + x = sf * Lc + k = max(0.0, min(1.0, (x - (Lc - 0.06)) / 0.04)) # flattened over the last 4-6 cm + ci = circ(0.015, 10) + fl = rrect(0.0055, 0.0175, 0.005, 2) + return [(a * (1 - k) + c_ * k, b * (1 - k) + d_ * k) for (a, b), (c_, d_) in zip(ci, fl)] + P.append(sweep("arm", C, armsec, [M.tube], ref=(1, 0, 0), ang=45)) + # the bracket: a base plate on the deck, two lugs welded on (beads), a bolt across with a star knob + bc = Vector((s * 0.42, -0.488, -0.7268)) + P.append(bprism("brkbase", rounded_outline([(-0.032, -0.03), (0.032, -0.03), (0.032, 0.03), (-0.032, 0.03)], 0.01, 1), 0.0, 0.004, [M.d1, M.d2], + bev=0.0012, segs=1, frame=Matrix.Translation(bc), bev_slot=1)) + + eye = Vector((s * 0.42, -0.488, -0.7)) + hp, Lb = clevis(P, eye, (0, 0, 1), (1, 0, 0), 0.03, 0.004, 0.024, 0.012, 0.0118, m=M.d1, bead_m=M.d2, bead_at=0.022) + q = washer(P, hp if s > 0 else hp - Vector((Lb, 0, 0)), (s, 0, 0), 0.008, 0.0014, m=M.hw) + head(P, q, (s, 0, 0), 0.0046, "hex", m=M.hw, ref=(0, 0, 1)) + far = (hp - Vector((Lb, 0, 0))) if s > 0 else hp + q = washer(P, far, (-s, 0, 0), 0.008, 0.0014, m=M.hw) + knob_nut(P, q, (-s, 0, 0), 0.016, M.black, ref=(0, 0, 1)) + # the bail: a red bar in front of the grips, its legs turning back into the pivot clips, a tab where the cable hooks on + BY_, BZ_ = -0.074, -0.03 + bail = [(-0.27, -0.006, -0.024), (-0.273, -0.05, -0.033), (-0.266, BY_, BZ_), (0.266, BY_, BZ_), (0.273, -0.05, -0.033), (0.27, -0.006, -0.024)] + P.append(tube5("bail", bail, 0.0092, M.red, segs=8, bend=0.02, nb=3)) + for sg in (-1, 1): + P.append(rev("bailend", [(0.0092, 0.0), (0.0104, 0.002), (0.0098, 0.0048), (0.0, 0.0054)], Vector((sg * 0.27, -0.006, -0.024)), (0, 1, 0.5), + [M.black], segs=10)) + # a moulded rubber grip on the bail in front of each hand grip: end collars, a fat ribbed middle + gp_ = [(0.0098, 0.0), (0.0128, 0.002), (0.0132, 0.008), (0.0118, 0.012)] + for k in range(4): + z_ = 0.024 + 0.027 * k + gp_ += [(0.0124, z_ - 0.004), (0.0131, z_), (0.0124, z_ + 0.004)] + gp_ += [(0.0118, 0.118), (0.0132, 0.122), (0.0128, 0.128), (0.0098, 0.13)] + P.append(rev("bailgrip", gp_, Vector((sg * 0.243, BY_, BZ_)), (-sg, 0, 0), [M.rub], segs=7, ang=50)) + tab = Vector((0.03, BY_, BZ_)) + P.append(bprism("bailtab", rounded_outline([(-0.008, 0.0), (0.008, 0.0), (0.006, 0.022), (-0.006, 0.022)], 0.004, 2), -0.0016, 0.0016, [M.d2], + bev=0.0007, segs=1, frame=fz(tab, (1, 0, 0), (0, 0.2, -1)) @ Matrix.Rotation(DEG(90), 4, "Z"))) + # the cable: from the tab back along the shaft, held by clips, out to the control bracket on the engine + cp = [tab + Vector((0.0, 0.002, -0.02)), Vector((0.03, -0.06, -0.075)), Vector((0.028, -0.1, -0.14))] + cp += [sh0 + dsh * k + Vector((0.026, 0.0, 0.0)) for k in (0.2, 0.32, 0.45, 0.55)] + cp += [Vector((0.03, -0.39, -0.555)), Vector((0.012, -0.47, -0.6)), Vector((-0.04, -0.6, -0.6)), Vector((-0.08, -0.665, -0.61))] + Cc = resample(cp, 20) + P.append(sweep("cable", Cc, lambda s, i: circ(0.0036, 6), [M.black], ang=60)) + P.append(rev("cablend", [(0.0036, -0.006), (0.0052, -0.004), (0.0052, 0.004), (0.0036, 0.006)], Cc[-1] + Vector((0.0, 0.0, 0.0)), (Cc[-1] - Cc[-2]), [M.hw], segs=10)) + for k in (0.24, 0.42): + c = sh0 + dsh * k + clip_band(P, c, dsh, 0.019, 0.012, M.black, ear=(1, 0, 0), screw_m=M.hw) + # the cable runs through the clip's tab + # a rope guide on the shaft with the pull handle resting in it; the rope from the starter's guide + rg = sh0 + dsh * 0.36 + clip_band(P, rg, dsh, 0.019, 0.014, M.black) + hook = rg + Vector((-0.031, 0.0, 0.0)) + P.append(bprism("rguide", rounded_outline([(-0.012, -0.007), (0.012, -0.007), (0.012, 0.007), (-0.012, 0.007)], 0.005, 1), -0.004, 0.004, [M.black], + bev=0.0015, segs=1, frame=fz(rg + Vector((-0.024, 0, 0)), (1, 0, 0), dsh))) + P.append(rev("rguide_eye", [(0.0042, -0.0045), (0.0072, -0.004), (0.0078, 0.0), (0.0072, 0.004), (0.0042, 0.0045)], hook, dsh, [M.black], segs=12)) + ph = hook - dsh * 0.022 + rope_line(P, [gp + gn * 0.006, gp + gn * 0.03 + Vector((0, 0.04, 0.02)), hook - dsh * 0.03 + Vector((-0.004, 0.0, -0.01)), hook + dsh * 0.004], 0.0034, M.white, segs=5) + pull_handle(P, ph + Vector((-0.004, 0.0, -0.006)), (1, 0, 0), M, L=0.07, r=0.0095, m=M.black) + + # ---- the bag hanger: a bar under the shaft, welded on, the catcher's hooks hanging from it + hgc = sh0 + dsh * 0.5 + Vector((0, 0, -0.028)) + P.append(tube5("hanger", [hgc + Vector((-0.165, 0, 0)), hgc + Vector((0.165, 0, 0))], 0.0065, M.d2, segs=10)) + P.append(bprism("hangerplate", rounded_outline([(-0.018, -0.03), (0.018, -0.03), (0.018, 0.012), (-0.018, 0.012)], 0.008, 1), -0.003, 0.003, [M.d2], + bev=0.0, segs=1, frame=fz(sh0 + dsh * 0.5 + Vector((0, 0, -0.012)), (1, 0, 0), (0, 0, 1)))) + + + # ---- the catcher: a hard tray, fabric walls bulging between piped corner seams, the hem rolled over the frame, stitching + BX, BY0, BY1, BZ0, BZ1 = 0.23, -0.37, -0.05, -0.9, -0.62 + bc = (BY0 + BY1) / 2 + hd = (BY1 - BY0) / 2 + NF = (2, 1) + + tray = [(BX - 0.03, hd - 0.03, 0.04, BZ0, 0.0), (BX - 0.012, hd - 0.012, 0.05, BZ0 + 0.003, 0.0), (BX - 0.002, hd - 0.002, 0.056, BZ0 + 0.013, 0.0), + (BX + 0.002, hd + 0.002, 0.058, -0.862, 0.0), (BX + 0.005, hd + 0.005, 0.06, -0.858, 0.0), (BX + 0.005, hd + 0.005, 0.06, -0.853, 0.0), + (BX - 0.004, hd - 0.004, 0.056, -0.852, 0.0)] + rings = [rr_ring(a, b, c, z, (0.0, bc), nc=3, nf=NF, bulge=g) for a, b, c, z, g in tray] + P.append(rings_mesh("tray", rings, [M.plast], ang=40, cap1=False)) + wall = [(BX - 0.002, -0.857, 0.0), (BX + 0.003, -0.84, 0.006), (BX + 0.006, -0.8, 0.012), (BX + 0.006, -0.74, 0.012), (BX + 0.004, -0.68, 0.009), + (BX + 0.001, -0.64, 0.004), (BX + 0.0, -0.628, 0.0)] + hem = [(BX + 0.012, -0.622, 0.0), (BX + 0.013, -0.61, 0.0), (BX + 0.004, -0.6035, 0.0), (BX - 0.008, -0.606, 0.0), (BX - 0.013, -0.618, 0.0)] + inner = [(BX - 0.012, -0.64, 0.0), (BX - 0.016, -0.84, 0.0)] + + seq = wall + hem + inner + rings = [] + for w, z, g in seq: + dw = w - BX + rings.append(rr_ring(BX + dw, hd + dw, 0.06 + dw * 0.5, z, (0.0, bc), nc=3, nf=NF, bulge=g)) + P.append(rings_mesh("bag", rings, [M.fab], ang=55, cap0=False)) + # piping down the four corners, stitched both sides + for cx_s, cy_s in ((1, 1), (-1, 1), (-1, -1), (1, -1)): + q = [] + for w, z, g in wall: + dw = w - BX + ex, ey, r_ = BX + dw, hd + dw, 0.06 + dw * 0.5 + q.append(Vector((cx_s * (ex - r_ + r_ * 0.7071 + 0.0008), bc + cy_s * (ey - r_ + r_ * 0.7071 + 0.0008), z))) + q = [qq for qq in q if qq.z < -0.632] + P.append(sweep("piping", q, lambda s, i: circ(0.0042, 5), [M.fab], ref=(0, 0, 1), ang=60)) + # stitching under the hem and above the tray + for z, lift in ((-0.634, 0.0055), (-0.846, 0.003)): + pts = [Vector((x, bc + y, z)) for x, y, _ in rr_pts(BX + lift, hd + lift, 0.06 + lift * 0.5, nc=4, nf=(6, 4))] + pts.append(pts[0]) + P.append(stitches("stitch", pts, lambda p, bc=bc: Vector((p.x, p.y - bc, 0.0)), M.thr, step=0.04 if z > -0.7 else 0.05)) + + + # the label on the back panel, stitched round + lb = Vector((0.0, BY1 + 0.0172, -0.742)) + P.append(bprism("baglabel", rrect(0.095, 0.034, 0.01, 2), -0.004, 0.0018, [M.red], bev=0.0008, segs=1, frame=fz(lb, (0, 1, 0), (1, 0, 0)))) + P.append(bprism("labelband", rrect(0.07, 0.006, 0.003, 2), 0.0018, 0.0026, [M.white], bev=0.0004, segs=1, frame=fz(lb, (0, 1, 0), (1, 0, 0)))) + pts = [lb + Vector((x, 0.0021, z)) for x, z in [(p[0], p[1]) for p in rrect(0.088, 0.027, 0.007, 2)]] + + pts.append(pts[0]) + P.append(stitches("lstitch", pts, lambda p: (0, 1, 0), M.thr, step=0.015, L=0.0065, w=0.0018, lift=0.0005)) + # the frame shows where the hooks come out of the hem; the hooks run up to the hanger + for s in (-1, 1): + a = Vector((s * 0.15, BY0 + 0.004, BZ1 + 0.018)) + b = hgc + Vector((s * 0.15, 0.0, 0.0)) + pts = [a, a + Vector((0, 0, 0.04)), b + Vector((0, -0.006, -0.03)), b + Vector((0, 0.0, -0.0075)), b + Vector((0, 0.009, 0.0)), b + Vector((0, 0.003, 0.0085))] + P.append(tube5("baghook", pts, 0.0034, M.d2, segs=4, bend=0.008, nb=2)) + P.append(rev("hookferrule", [(0.0035, -0.006), (0.0058, -0.005), (0.006, 0.004), (0.0035, 0.006)], a + Vector((0, 0, 0.006)), (0, 0, 1), [M.black], segs=8)) + parts_report(P, "Body") + o = tfin4(P, "Body", uv=2.4, ang=32) + + # ---- Blade: a bar, ground edges at both ends, sails bent up at the trailing edge, a boss adapter, the centre bolt and washer + zb = -0.895 + B = [] + B.append(rev("adapter", [(0.0, -0.0075), (0.05, -0.0075), (0.056, -0.0045), (0.058, 0.0), (0.04, 0.003), (0.03, 0.008), (0.024, 0.0122), (0.0, 0.0122)], + Vector((0.0, YC, zb)), (0, 0, 1), [M.d2], segs=12, ang=40)) + for sg in (-1, 1): + rings_b = [] + n = 8 + for i in range(n + 1): + u = i / n + x = sg * (0.03 + 0.3 * u) + w = 0.025 + lift = 0.0 if u < 0.72 else (u - 0.72) / 0.28 + sail = 0.026 * lift ** 1.5 + edge_k = 0.0 if u < 0.55 else min(1.0, (u - 0.55) / 0.06) + # section across Y: leading edge (towards the spin) ground thin, trailing edge bent up into the sail + le = -sg # the blade spins +Z: at +X the leading side is +Y... keep it simple: leading on -sg*Y + t = 0.003 + pts = [] + pts.append((YC + le * w, zb + t * (1 - 0.85 * edge_k))) + pts.append((YC + le * w * (1 - 0.35 * edge_k), zb + t)) + pts.append((YC - le * w * 0.55, zb + t)) + pts.append((YC - le * w * (0.9), zb + t + sail * 0.55)) + pts.append((YC - le * w * (1.0 + 0.1 * lift), zb + t + sail)) + pts.append((YC - le * w * (1.0 + 0.1 * lift) - le * 0.0008, zb + sail - 0.0005)) + pts.append((YC - le * w * 0.86, zb - t + sail * 0.5)) + pts.append((YC - le * w * 0.5, zb - t)) + pts.append((YC + le * w * (1 - 0.35 * edge_k), zb - t)) + pts.append((YC + le * w, zb - t * (1 - 0.85 * edge_k))) + rings_b.append([Vector((x, y, z)) for y, z in pts]) + tipr = [Vector((r.x + sg * 0.0025, r.y, r.z)) for r in rings_b[-1]] + rings_b.append(tipr) + B.append(rings_mesh("blade", rings_b, [M.st, M.br], colfn=lambda i, j, n=n: 1 if (j in (0, 8, 9) and i > n * 0.55) else 0, ang=30)) + q = washer(B, Vector((0.0, YC, zb - 0.0035)), (0, 0, -1), 0.024, 0.003, m=M.hw) + head(B, q, (0, 0, -1), 0.008, "hex", m=M.hw, ref=(1, 0, 0)) + blade = tfin4(B, "Blade", uv=2.4, ang=30) + set_origin(blade, (0, YC, zb)) + + # ---- wheels + for n_, (x, y) in hubs.items(): + W_ = [] + tread_tyre(W_, M, 1 if x > 0 else -1, R=R, W=0.044, pitches=10) + w = tfin4(W_, n_, uv=2.4, ang=34) + w.location = (x, y, G + R) + + # ---- Fill: the clippings heaped in the catcher, origin on its floor + fill5(-BX + 0.04, BX - 0.04, BY0 + 0.04, BY1 - 0.04, BZ0 + 0.045, BZ1 - 0.035, BZ1 + 0.008) + return {} + + +# ======================================================================= farm machines: shared parts + +def parts_report(P, name): + if os.environ.get("GC_PARTS"): # triangle count per part, for trimming + cnt = {} + for q in P: + if q is not None: + k = q.name.split(".")[0] + cnt[k] = cnt.get(k, 0) + sum(len(f.vertices) - 2 for f in q.data.polygons) + print("PARTS", name, sum(cnt.values()), sorted(cnt.items(), key=lambda kv: -kv[1])) + + +def ffin(P, name, uv=4.0, ang=42): + """gc_farm_tools.done (box UVs for parts without their own, one UV layer, join) plus weighted normals for the bevels.""" + if os.environ.get("GC_PARTS"): # triangle count per part, for trimming + cnt = {} + for q in P: + if q is not None: + k = q.name.split(".")[0] + cnt[k] = cnt.get(k, 0) + sum(len(f.vertices) - 2 for f in q.data.polygons) + print("PARTS", name, sorted(cnt.items(), key=lambda kv: -kv[1])) + o = FT.done([q for q in P if q is not None], name, uv=uv, ang=ang) + weighted(o) + return o + + +def place(parts, M4): + for o in parts: + apply_xform(o) + o.data.transform(M4) + return parts + + +def timber(o, along, s=2.4): + FT.grain(o, along, s) + return o + + +def hbolt(P, M, a, n, L, r, ref=None, nut=True, thr=None, w_head=True): + """bolt5 in the farm palette: steel washers, head and nut, the thread poking out.""" + bolt5(P, a, n, L, r, kind="hex", m=M.hw, m_nut=M.hw, m_thr=M.st, w_head=w_head, nut=nut, thr=thr, ref=ref) + + +def dome8(P, c, n, r, m): + """A low domed head (carriage bolt, rivet), cheaper than head(..., "dome").""" + P.append(rev("dome", [(r * 1.75, -0.0004), (r * 1.62, r * 0.42), (r * 1.1, r * 0.86), (0.0, r * 1.02)], c, n, [m], segs=8, ang=50)) + + +def cbolt(P, M, a, n, r, L=None, m=None): + """A carriage bolt through timber: a domed head on n, a square neck sunk in the wood; the nut and washer on the far side if L.""" + dome8(P, a, n, r, m or M.hw) + if L: + n = Vector(n).normalized() + b = Vector(a) - n * L + q = washer(P, b, -n, r * 2.1, r * 0.35, m=M.hw) + q = hexnut(P, q, -n, r * 1.8, r * 1.4, m=M.hw) + thread(P, q - (-n) * 0.002, -n, r * 0.9, r * 1.2 + 0.002, m=M.st) + + +def grain5(o, along, c, s=2.0, board=0, v0=0.5): + """gc_farm_tools.grain measured from the timber's own centre: across the part U stays inside one of the texture's four boards + (no board line down a face), along it V stays inside one tile of the texture (no seam half way along).""" + d = Vector(along).normalized() + a = d.orthogonal().normalized() + b = d.cross(a) + c = Vector(c) + u0 = 0.125 + 0.25 * (board % 4) + bm = bmesh.new() + bm.from_mesh(o.data) + uv = bm.loops.layers.uv.verify() + for f in bm.faces: + ua = a if abs(f.normal.dot(a)) < abs(f.normal.dot(b)) else b + for l in f.loops: + q = l.vert.co - c + l[uv].uv = (u0 + q.dot(ua) * s, v0 + q.dot(d) * s) + bm.to_mesh(o.data) + bm.free() + o["uv_done"] = True + return o + + +def timber5(P, M, lo, hi, axis, ch=0.004, ends=(True, True), s=2.0, off=(0.0, 0.0), seed=0, bow=0.0012, name="beam"): + """A sawn timber from corner lo to corner hi, its grain along `axis` (0 = X, 1 = Y): every long edge chamfered, a slight bow and + twist (no timber is dead straight), the sawn ends closed by end grain (growth rings round a pith off to one side).""" + lo, hi = Vector(lo), Vector(hi) + c = (lo + hi) / 2 + hs = (hi - lo) / 2 + a_ax = 1 - axis if axis in (0, 1) else 0 # the other horizontal axis + ha, hb = hs[a_ax], hs[2] + ch = min(ch, ha * 0.4, hb * 0.4) + sec = [(ha, -hb + ch), (ha, hb - ch), (ha - ch, hb), (-ha + ch, hb), (-ha, hb - ch), (-ha, -hb + ch), (-ha + ch, -hb), (ha - ch, -hb)] + rnd = random.Random(seed) + ph = rnd.uniform(0, TAU) + A = Vector((0, 0, 0)) + A[axis] = 1.0 + Bv = Vector((0, 0, 0)) + Bv[a_ax] = 1.0 + Z = Vector((0, 0, 1)) + n = 4 + rings = [] + for k in range(n + 1): + t = k / n + w = math.sin(PI * t) + cc = c + A * (hs[axis] * (2 * t - 1)) + Bv * (bow * w * math.cos(ph)) + Z * (bow * 0.6 * w * math.sin(ph)) + tw = 0.012 * (t - 0.5) * math.cos(ph * 1.7) # a little twist + ring = [] + for u, v in sec: + uu, vv = u * math.cos(tw) - v * math.sin(tw), u * math.sin(tw) + v * math.cos(tw) + ring.append(cc + Bv * uu + Z * vv) + rings.append(ring) + o = rings_mesh(name, rings, [M.tim], cap0=not ends[0], cap1=not ends[1], ang=30) + L = hs[axis] * 2 + s = min(s, 0.9 / max(L, 1e-6)) + P.append(grain5(o, A, c, s, board=seed, v0=0.5 + 0.04 * math.sin(seed))) + for e, ring, sg in ((ends[0], rings[0], -1), (ends[1], rings[-1], 1)): + if not e: + continue + cen = sum(ring, Vector()) / len(ring) + pith = cen + Bv * (ha * rnd.uniform(-1.6, 1.6)) + Z * (hb * rnd.choice((-1.5, 1.5))) + P.append(endgrain_cap("endgrain", [Vector(p) for p in ring], cen, A * sg, 0.0006, pith, m=M.tim)) + return o + + +def strap_u(P, M, pts, w, th, ref, m=None, bend=0.004): + """A forged iron strap bent along pts (a flat bar w wide, th thick, its width along ref).""" + C = fillet([Vector(p) for p in pts], bend, n=2) + P.append(sweep("strap", C, lambda s, i: rrect(w / 2, th / 2, min(th * 0.45, w * 0.2), 1), [m or M.d1], ref=ref, ang=35)) + + +def hull2d(pts): + """Convex hull of 2D points, counter-clockwise.""" + P_ = sorted(set((round(x, 7), round(y, 7)) for x, y in pts)) + if len(P_) < 3: + return P_ + + def cross(o, a, b): + return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]) + lower, upper = [], [] + for p in P_: + while len(lower) >= 2 and cross(lower[-2], lower[-1], p) <= 0: + lower.pop() + lower.append(p) + for p in reversed(P_): + while len(upper) >= 2 and cross(upper[-2], upper[-1], p) <= 0: + upper.pop() + upper.append(p) + return lower[:-1] + upper[:-1] + + +def offset2d(pts, d): + """Offset a convex counter-clockwise outline outwards by d (vertex normals).""" + n = len(pts) + out = [] + for i in range(n): + a, b, c = Vector(pts[i - 1]), Vector(pts[i]), Vector(pts[(i + 1) % n]) + t0, t1 = (b - a).normalized(), (c - b).normalized() + n0, n1 = Vector((t0.y, -t0.x)), Vector((t1.y, -t1.x)) + nm = (n0 + n1) + nm = nm.normalized() if nm.length > 1e-9 else n0 + k = max(0.5, nm.dot(n0)) + out.append((b.x + nm.x * d / k, b.y + nm.y * d / k)) + return out + + +def densify2d(pts, step): + out = [] + n = len(pts) + for i in range(n): + a, b = Vector(pts[i]), Vector(pts[(i + 1) % n]) + m = max(1, int(math.ceil((b - a).length / step))) + for k in range(m): + q = a.lerp(b, k / m) + out.append((q.x, q.y)) + return out + + +def rclamp(P, M, c, t, r, w=0.014, th=0.0035, ear=(1, 0, 0), m=None, bolt=True): + """A forged clamp round a round bar (axis t, radius r) at c: a band with rolled edges, two pinch ears on the `ear` side, a bolt + through them with a washer and a nut.""" + m = m or M.d1 + t = Vector(t).normalized() + prof = [(r + 0.0003, -w / 2), (r + th * 0.8, -w / 2 + 0.0008), (r + th, -w / 2 + 0.0022), (r + th, w / 2 - 0.0022), (r + th * 0.8, w / 2 - 0.0008), + (r + 0.0003, w / 2)] + P.append(rev("rclamp", prof, c, t, [m], segs=14, ang=45)) + if ear is None: + return + e = (Vector(ear) - t * Vector(ear).dot(t)).normalized() + b = t.cross(e) + gap = 0.004 + for sz in (-1, 1): + Fm = Matrix((e, t, b)).transposed().to_4x4() + Fm.translation = Vector(c) + e * (r - 0.002) + b * sz * (gap / 2 + th / 2) + out = rounded_outline([(0.0, -w * 0.46), (0.02, -w * 0.46), (0.02, w * 0.46), (0.0, w * 0.46)], 0.005, 2) + P.append(bprism("ear", out, -th / 2, th / 2, [m], bev=0.0009, segs=1, frame=Fm)) + if bolt: + bc = Vector(c) + e * (r + 0.011) + hbolt(P, M, bc + b * (gap / 2 + th), b, gap + 2 * th, 0.0034, ref=t, thr=0.004) + + +def oval_wrap(name, fr, z0, z1, rxf, ryf, pitch, depth, m, segs=18, rows=3, n=2.3): + """A strip wound in a helix round an oval handle (frame fr, axis local Z, radii rxf(z), ryf(z)), each turn lapped over the last.""" + turns = (z1 - z0) / pitch + nph = int(math.ceil(turns * segs)) + 1 + prof = [0.5, 0.82, 1.0, 0.9] if rows == 3 else [0.5 + 0.5 * (q / rows) ** 0.8 for q in range(rows + 1)] + bm = bmesh.new() + G = [] + for k in range(nph + 1): + ph = TAU * k / segs + base = z0 + pitch * (k / segs) - pitch + row = [] + for q in range(rows + 1): + z = base + pitch * q / rows + inside = z0 - 1e-6 <= z <= z1 + 1e-6 + zc = min(max(z, z0), z1) + d = depth * prof[q] * (1.0 if inside else 0.2) + c_, s_ = math.cos(ph), math.sin(ph) + sx_, sy_ = math.copysign(abs(c_) ** (2.0 / n), c_), math.copysign(abs(s_) ** (2.0 / n), s_) + row.append(bm.verts.new(tuple(fr @ Vector(((rxf(zc) + d) * sx_, (ryf(zc) + d) * sy_, zc))))) + G.append(row) + for k in range(nph): + for q in range(rows): + bm.faces.new((G[k][q], G[k + 1][q], G[k + 1][q + 1], G[k][q + 1])) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + f0 = bm.faces[len(bm.faces) // 2] + f0.normal_update() + cax = fr @ Vector((0, 0, (z0 + z1) / 2)) + if f0.normal.dot(f0.calc_center_median() - cax) < 0: + bmesh.ops.reverse_faces(bm, faces=bm.faces) + o = mesh_obj(name, bm) + set_mats(o, m) + smooth(o, 55) + return o + + +def grip5(P, M, loc=(0, 0, 0), tilt=12.0, h0=-0.09, h1=0.06, rx=0.023, ry=0.03, wrap=True): + """The farm pistol grip on the same frame as gc_farm_tools.grip: a turned oval timber handle swelling under the palm, finger + ridges down its front, a leather strip wound round it, an iron pommel cap held by a nut, a brass ferrule with two rivets.""" + fr = Matrix.Translation(Vector(loc)) @ Matrix.Rotation(DEG(tilt), 4, "X") + H = h1 - h0 + rings = [] + for k in range(15): + t = k / 14 + waist = 1.0 + 0.1 * math.sin(math.pi * min(1.0, t * 1.15)) + rings.append((0, 0, rx * waist, ry * waist, h0 + H * t, 2.3)) + g = FT.loft("grip", rings, segs=14, m=M.tim, frame=fr, cap0=False, cap1=True, smooth_ang=70) + # finger ridges on the front (-Y) face where the wrap leaves off + me = g.data + finv = fr.inverted() + for v in me.vertices: + p = finv @ v.co + if p.y < -ry * 0.5 and h0 + H * 0.05 < p.z < h0 + H * 0.2: + v.co = fr @ (p + Vector((0, -0.0018 * math.sin((p.z - h0) / (H * 0.15) * PI * 2) ** 2, 0))) + P.append(timber(g, fr.to_3x3() @ Vector((0, 0, 1)), 2.4)) + wf = lambda z: 1.0 + 0.1 * math.sin(math.pi * min(1.0, (z - h0) / H * 1.15)) + if wrap: + za, zb = h0 + H * 0.24, h0 + H * 0.68 + P.append(oval_wrap("wrap", fr, za, zb, lambda z: rx * wf(z) * 1.005, lambda z: ry * wf(z) * 1.005, 0.0135, 0.0026, M.lea)) + for zz in (za - 0.002, zb + 0.002): + k = wf(zz) + P.append(FT.loft("welt", [(0, 0, rx * k * 1.0, ry * k * 1.0, zz - 0.0035, 2.3), (0, 0, rx * k * 1.1, ry * k * 1.08, zz - 0.0018, 2.3), + (0, 0, rx * k * 1.12, ry * k * 1.1, zz, 2.3), (0, 0, rx * k * 1.1, ry * k * 1.08, zz + 0.0018, 2.3), + (0, 0, rx * k * 1.0, ry * k * 1.0, zz + 0.0035, 2.3)], segs=12, m=M.brass, frame=fr, cap0=False, cap1=False, smooth_ang=60)) + + # pommel: an iron cap over the bottom, a domed nut on the tie rod + P.append(FT.loft("pommel", [(0, 0, rx * 0.72, ry * 0.72, h0 - 0.013, 2.3), (0, 0, rx * 1.18, ry * 1.14, h0 - 0.009, 2.4), (0, 0, rx * 1.26, ry * 1.22, h0 - 0.003, 2.4), + (0, 0, rx * 1.26, ry * 1.22, h0 + 0.006, 2.4), (0, 0, rx * 1.12, ry * 1.1, h0 + 0.011, 2.3), (0, 0, rx * 1.02, ry * 1.02, h0 + 0.013, 2.3)], + segs=14, m=M.d1, frame=fr, smooth_ang=60)) + bn = fr @ Vector((0, 0, h0 - 0.013)) + ax = (fr.to_3x3() @ Vector((0, 0, -1))).normalized() + q = washer(P, bn, ax, 0.008, 0.0012, m=M.hw) + P.append(rev("pnut", [(0.0, 0.0), (0.0058, 0.0), (0.0062, 0.002), (0.0058, 0.005), (0.0035, 0.0072), (0.0, 0.0078)], q, ax, [M.hw], segs=6, ang=30)) + # ferrule at the top, rolled rims, two rivets + P.append(FT.loft("ferrule", [(0, 0, rx * 1.06, ry * 1.06, h1 - 0.017, 2.3), (0, 0, rx * 1.15, ry * 1.13, h1 - 0.015, 2.3), (0, 0, rx * 1.12, ry * 1.1, h1 - 0.012, 2.3), + (0, 0, rx * 1.12, ry * 1.1, h1 - 0.004, 2.3), (0, 0, rx * 1.16, ry * 1.14, h1 - 0.002, 2.3), (0, 0, rx * 1.06, ry * 1.06, h1 + 0.001, 2.3)], + segs=14, m=M.brass, frame=fr, cap0=False, cap1=False, smooth_ang=60)) + for sx in (-1, 1): + p = fr @ Vector((sx * rx * 1.12, 0, h1 - 0.008)) + head(P, p, (fr.to_3x3() @ Vector((sx, 0, 0))).normalized(), 0.0022, "dome", m=M.brass) + return fr + + +def trigger5(P, M, y0=-0.03, z0=0.042, drop=0.05, m=None): + """A throttle trigger in front of the grip: a curved lever with finger ridges on a pivot pin, a lock-out lever behind the grip's top, + a bent guard loop. Returns where the throttle cable leaves the grip.""" + m = m or M.yel + C = fillet([(0, y0, z0), (0, y0 - 0.018, z0 - 0.022), (0, y0 - 0.019, z0 - 0.04), (0, y0 - 0.01, z0 - drop)], 0.012, 4) + + def sec(s, i): + w = 0.0062 * (1 - 0.25 * s) + h = 0.0085 * (1 - 0.3 * s) * (1.0 + (0.12 if (i % 3 == 1 and s > 0.35) else 0.0)) + return rrect(w, h, min(w, h) * 0.7, 2) + P.append(sweep("trig", C, sec, [m], ref=(1, 0, 0), ang=45)) + pv = Vector((0, y0 + 0.002, z0 - 0.003)) + for sx in (-1, 1): + head(P, pv + Vector((sx * 0.0064, 0, 0)), (sx, 0, 0), 0.0024, "dome", m=M.hw) + # the guard: a bent iron loop from the grip's front down round the trigger and back into the grip + P.append(tube5("tguard", [(0, y0 - 0.002, z0 + 0.004), (0, y0 - 0.05, z0), (0, y0 - 0.056, z0 - 0.04), (0, y0 - 0.034, z0 - 0.072), (0, y0 + 0.012, z0 - 0.078)], + 0.0052, M.d1, segs=8, bend=0.014, nb=4)) + # the lock-out: a short flat lever sticking back off the top of the grip, pivoting in a boss, a ribbed pad where the palm presses it + pv2 = Vector((0, 0.022, z0 - 0.012)) + P.append(rev("lockboss", [(0.0042, -0.0072), (0.0052, -0.0064), (0.0055, 0.0), (0.0052, 0.0064), (0.0042, 0.0072)], pv2, (1, 0, 0), [M.d1], segs=10, ang=45)) + for sx in (-1, 1): + dome8(P, pv2 + Vector((sx * 0.0072, 0, 0)), (sx, 0, 0), 0.0015, M.hw) + tipv = pv2 + Vector((0, 0.03, 0.002)) + + def lsec(s, i): + w = 0.0062 * (1.0 - 0.25 * max(0.0, s - 0.75) / 0.25) + return rrect(w, 0.0019, 0.0014, 1) + P.append(sweep("lockout", [pv2 + Vector((0, 0.002, 0.0015)), pv2.lerp(tipv, 0.5) + Vector((0, 0, 0.002)), tipv], lsec, [M.d1], ref=(1, 0, 0), ang=40)) + for k in range(3): + q = pv2.lerp(tipv, 0.55 + 0.15 * k) + Vector((0, 0, 0.0032 - 0.0003 * k)) + P.append(bprism("lockrib", [(-0.0048, -0.0007), (0.0048, -0.0007), (0.0048, 0.0007), (-0.0048, 0.0007)], -0.0006, 0.0012, [M.lea], segs=1, + frame=fz(q, (0, -0.2, 1), (1, 0, 0)))) + return Vector((0, y0 - 0.008, z0 + 0.012)) + + +def cable5(P, M, pts, clips=(), r=0.0032, m=None, n=40): + """A throttle cable along pts with clips at the given point indices (each clip: a strap round the cable and what it is held to).""" + C = resample([Vector(p) for p in pts], n) + P.append(sweep("cable", C, lambda s, i: circ(r, 6), [m or M.black], ang=60)) + for c, t, rr in clips: + rclamp(P, M, c, t, rr + r * 2.2, w=0.008, th=0.0018, ear=None, m=m or M.black) + for e, d in ((C[0], C[0] - C[1]), (C[-1], C[-1] - C[-2])): + P.append(rev("ferr", [(r * 0.9, -0.006), (r * 1.4, -0.0045), (r * 1.4, 0.003), (r * 0.6, 0.0045)], e, d, [M.brass], segs=8)) + return C + + +def tank5(P, M, c, rx, ry, h, cap_x=None, band=True): + """A pressed petrol tank: flat top and bottom with rolled shoulders, two halves crimped together round the middle, a painted band, + a filler neck and a knurled brass cap (off centre at cap_x).""" + tr = [] + rc = min(rx, ry) * 0.48 + for k, (fx, z) in enumerate(((0.88, 0.0), (0.97, 0.004), (1.0, 0.012), (1.0, h * 0.5 - 0.003), (1.0, h * 0.5 + 0.003), (1.0, h - 0.012), (0.97, h - 0.004), + (0.86, h))): + tr.append([Vector((c[0] + x, c[1] + y, c[2] + z)) for x, y, _ in rr_pts(rx * fx, ry * fx, rc * fx, nc=3, nf=(1, 1))]) + P.append(rings_mesh("tank", tr, [M.red], ang=40)) + crimp_seam(P, [Vector((c[0] + x, c[1] + y, c[2] + h * 0.5)) for x, y, _ in rr_pts(rx, ry, rc, nc=3, nf=(2, 1))], (0, 0, 1), M.red, r=0.0019) + if band: + br = [[Vector((c[0] + x, c[1] + y, c[2] + z)) for x, y, _ in rr_pts(rx + d, ry + d, rc + d, nc=3, nf=(1, 1))] + for d, z in ((0.0002, h * 0.6), (0.0014, h * 0.6 + 0.0012), (0.0014, h * 0.8 - 0.0012), (0.0002, h * 0.8))] + P.append(rings_mesh("tband", br, [M.white], cap0=False, cap1=False, ang=50)) + if cap_x is not None: + fc = Vector((c[0] + cap_x, c[1], c[2] + h - 0.0005)) + P.append(rev("neck", [(0.0135, -0.002), (0.0135, 0.005), (0.015, 0.0065), (0.0135, 0.008)], fc, (0, 0, 1), [M.d1], segs=12)) + + def knurl(i, a): + return 1.0 + (0.07 * math.cos(12 * a) if 1 <= i <= 3 else 0.0) + P.append(rev("tcap", [(0.014, 0.0065), (0.019, 0.007), (0.0205, 0.0105), (0.0205, 0.0185), (0.0185, 0.0215), (0.01, 0.0235), (0.0, 0.024)], fc, (0, 0, 1), + [M.brass], segs=24, mod=knurl, ang=45)) + head(P, fc + Vector((0, 0, 0.0238)), (0, 0, 1), 0.0025, "dome", m=M.d1) + + +def engine5(c, M, s=1.0, pull=1, tank=True, tilt=0.0, stack=False): + """gc_farm_tools.two_stroke on the same layout and size, as a real little engine: crankcase split by a bolted flange, a finned barrel + and head with head bolts, the plug, boot and lead to the coil, a pressed recoil starter on the pull side with the rope out of a grommet + to a turned toggle, a muffler (shielded can, or a vertical can with a stack, flue and rain cap), a carburettor with a pancake air filter + and choke lever at the front, a crimped tank behind with a knurled cap and a fuel line. Returns (parts, carb lever point in world).""" + E = [] + X = Vector((pull, 0, 0)) + rings = [] + for hw, rc, z in ((0.054, 0.02, -0.0425), (0.062, 0.024, -0.038), (0.064, 0.026, -0.03), (0.064, 0.026, -0.005), (0.0675, 0.028, -0.0035), + (0.0675, 0.028, 0.0035), (0.064, 0.026, 0.005), (0.064, 0.026, 0.03), (0.06, 0.023, 0.038), (0.048, 0.017, 0.0425)): + rings.append([Vector((x, y, z)) for x, y, _ in rr_pts(hw, hw, rc, nc=2, nf=(1, 1))]) + E.append(rings_mesh("crank", rings, [M.d1], ang=40)) + for sx in (-1, 1): + for sy in (-1, 1): + head(E, Vector((sx * 0.052, sy * 0.052, 0.0035)), (0, 0, 1), 0.0034, "hex", m=M.hw, ref=(1, 0, 0)) + # the barrel and its fins, the head + E.append(rev("barrel", [(0.03, 0.038), (0.03, 0.14)], Vector(), (0, 0, 1), [M.d1], segs=14)) + fin_stack(E, Vector((0, 0, 0.052)), (0, 0, 1), (1, 0, 0), 0.104, 0.096, 0.014, 7, 0.0128, 0.0042, 0.0055, M.st) + E.append(bprism("head", rrect(0.04, 0.037, 0.012, 2), 0.137, 0.158, [M.d1, M.st], bev=0.004, segs=2, bev_slot=1)) + for sy in (-1, 1): + E.append(bprism("hfin", rrect(0.036, 0.0022, 0.0018, 1), 0.157, 0.165, [M.d1], bev=0.001, segs=1, frame=Matrix.Translation((0, sy * 0.021, 0)))) + for sx in (-1, 1): + for sy in (-1, 1): + q = washer(E, Vector((sx * 0.03, sy * 0.029, 0.158)), (0, 0, 1), 0.0055, 0.0011, m=M.hw) + head(E, q, (0, 0, 1), 0.0032, "hex", m=M.hw, ref=(1, 0, 0)) + coil = Vector((pull * 0.032, -0.054, 0.057)) + E.append(bprism("coil", rrect(0.013, 0.0145, 0.005, 2), -0.0075, 0.0075, [M.d1], bev=0.0025, segs=1, frame=fz(coil, (0, -1, 0), (1, 0, 0)))) + for sx in (-1, 1): + head(E, coil + Vector((sx * 0.0085, -0.0075, -0.006)), (0, -1, 0), 0.0022, "hex", m=M.hw, ref=(1, 0, 0)) + spark_plug(E, Vector((0, 0, 0.1585)), (0, 0, 1), M, lead=[(pull * 0.012, -0.004, 0.2275), (pull * 0.03, -0.04, 0.2), (pull * 0.034, -0.064, 0.12), + coil + Vector((0, -0.003, 0.0155))]) + # recoil on the pull side; rope from a grommet at its foot to a turned toggle + recoil(E, X * 0.066, X, 0.054, 0.02, M, ref=(0, 0, 1), vents=5, cover=M.red, cap=M.d1) + + gp = Vector((pull * 0.08, 0.038, -0.022)) + E.append(rev("grommet", [(0.003, -0.003), (0.0058, -0.002), (0.006, 0.002), (0.0038, 0.003)], gp, (pull * 0.3, 0.5, -0.8), [M.brass], segs=10)) + kp = Vector((pull * 0.118, 0.036, -0.034)) + rope_line(E, [gp, gp + Vector((pull * 0.022, 0.002, -0.008)), kp + Vector((-pull * 0.004, 0.0, 0.012)), kp + Vector((0, 0, 0.004))], 0.0022, M.rope) + tg = rev("toggle", [(0.0, -0.028), (0.0062, -0.0275), (0.0095, -0.024), (0.0104, -0.016), (0.009, -0.01), (0.0106, -0.004), (0.0106, 0.004), + (0.009, 0.01), (0.0104, 0.016), (0.0095, 0.024), (0.0062, 0.0275), (0.0, 0.028)], kp + Vector((0, 0, -0.004)), (0, 1, 0), [M.tim], segs=10) + E.append(timber(tg, (0, 1, 0))) + E.append(rev("knot", [(0.0, -0.004), (0.004, -0.003), (0.0048, 0.0), (0.004, 0.003), (0.0, 0.004)], kp + Vector((0, 0, 0.0075)), (0, 0, 1), [M.rope], segs=8)) + # muffler on the far side + if stack: + ex = Vector((-pull * 0.083, 0, 0.012)) + muffler(E, ex + Vector((0, 0, -0.02)), (0, 0, 1), 0.034, 0.1, M, ref=(1, 0, 0), shield=True) + E.append(tube5("stack", [ex + Vector((0, 0, 0.078)), ex + Vector((0, 0, 0.205))], 0.0145, M.d1, segs=12, cap1=False)) + rclamp(E, M, ex + Vector((0, 0, 0.12)), (0, 0, 1), 0.0145, w=0.01, th=0.003, ear=(pull, 0, 0)) + E.append(rev("flue", [(0.0142, -0.004), (0.0152, 0.0), (0.02, 0.008), (0.025, 0.017), (0.0262, 0.022), (0.0236, 0.0235), (0.019, 0.018), (0.0142, 0.012)], + ex + Vector((0, 0, 0.198)), (0, 0, 1), [M.d1], segs=14)) + hc = ex + Vector((0, 0, 0.231)) + E.append(rev("raincap", [(0.0, 0.016), (0.012, 0.0145), (0.027, 0.009), (0.0335, 0.0035), (0.0335, 0.0005), (0.029, 0.0015), (0.012, 0.006), (0.0, 0.007)], + hc, (0, 0, 1), [M.st], segs=16)) + for k in range(3): + a = TAU * k / 3 + 0.4 + p0 = ex + Vector((0.024 * math.cos(a), 0.024 * math.sin(a), 0.22)) + E.append(tube5("capleg", [p0, p0 + Vector((0.004 * math.cos(a), 0.004 * math.sin(a), 0.015))], 0.0018, M.st, segs=5)) + else: + mc = Vector((-pull * 0.082, -0.055, 0.012)) + muffler(E, mc, (0, 1, 0), 0.03, 0.11, M, ref=(0, 0, 1), spout=((-pull * 0.082, 0.055, 0.006), (-pull * 0.082, 0.071, -0.002))) + E.append(tube5("expipe", [(-pull * 0.03, -0.012, 0.062), (-pull * 0.06, -0.012, 0.06), (-pull * 0.074, -0.012, 0.04)], 0.0085, M.d1, segs=10, bend=0.012)) + E.append(bprism("exflange", rrect(0.016, 0.012, 0.004, 1), -0.0025, 0.0025, [M.d1], bev=0.001, segs=1, + frame=fz(Vector((-pull * 0.033, -0.012, 0.062)), (-pull, 0, 0), (0, 0, 1)))) + for sy in (-1, 1): + head(E, Vector((-pull * 0.0358, -0.012 + sy * 0.01, 0.062)), (-pull, 0, 0), 0.0026, "hex", m=M.hw, ref=(0, 0, 1)) + # carburettor and air filter at the front, the choke lever, the throttle lever the cable pulls + cb = Vector((0.0, -0.072, 0.012)) + E.append(bprism("carb", rrect(0.016, 0.014, 0.005, 2), -0.009, 0.009, [M.d1], bev=0.0025, segs=1, frame=fz(cb, (0, -1, 0), (1, 0, 0)))) + fc = cb + Vector((0, -0.009, 0)) + E.append(rev("filter", [(0.0, -0.001), (0.024, -0.001), (0.0285, 0.002), (0.029, 0.006), (0.0285, 0.012), (0.026, 0.0145), (0.012, 0.016), (0.0, 0.0165)], fc, + (0, -1, 0), [M.st], segs=18, mod=lambda i, a: 1.0 + (0.035 * math.cos(16 * a) if i in (3, 4) else 0.0), ang=45)) + E.append(rev("wingnut", [(0.0, 0.0), (0.0065, 0.0), (0.007, 0.003), (0.005, 0.0055), (0.0, 0.006)], fc + Vector((0, -0.0163, 0)), (0, -1, 0), [M.d1], segs=8, + mod=lambda i, a: 1.0 + (0.45 * max(0.0, math.cos(a)) ** 4 + 0.45 * max(0.0, -math.cos(a)) ** 4 if i in (1, 2) else 0.0))) + lv = cb + Vector((pull * 0.017, -0.002, 0.004)) + E.append(sweep("choke", [lv, lv + Vector((pull * 0.006, -0.004, 0.014))], lambda s, i: rrect(0.0025, 0.0016, 0.001, 1), [M.yel], ref=(0, 1, 0))) + tl = cb + Vector((-pull * 0.017, 0.0, 0.0)) + E.append(rev("tlever", [(0.0, -0.002), (0.0055, -0.002), (0.0055, 0.002), (0.0, 0.002)], tl, (pull, 0, 0), [M.st], segs=8)) + if tank: + tank5(E, M, (0.0, 0.098, 0.008), 0.064, 0.044, 0.09, cap_x=0.027) + tap = Vector((-pull * 0.035, 0.054, 0.014)) + E.append(rev("tap", [(0.0, 0.0), (0.0045, 0.0), (0.0045, 0.008), (0.0035, 0.012), (0.0, 0.012)], tap + Vector((0, 0.002, 0)), (0, -1, 0), [M.brass], segs=8)) + E.append(tube5("fuel", [tap + Vector((0, -0.01, 0)), tap + Vector((-pull * 0.01, -0.03, -0.022)), tap + Vector((-pull * 0.01, -0.1, -0.03)), + cb + Vector((-pull * 0.012, 0.004, -0.012))], 0.0028, M.brass, segs=6, bend=0.014, nb=3)) + Mx = Matrix.Translation(Vector(c)) @ Matrix.Rotation(DEG(tilt), 4, "X") @ Matrix.Scale(s, 4) + place(E, Mx) + return E, Mx @ (tl + Vector((-pull * 0.002, 0, 0))) + + +# ======================================================================= SM_Tool_HandPump (Clip-Vac) + +def comb5(name, pts, t, M, m, edge, frame): + """A cutter comb from gc_farm_tools.comb_pts: a plate with every edge bevelled and the bevels ground bright.""" + o = FT.prism(name, pts, t, frame, m) + o.data.materials.append(common.mat(edge)) + b = o.modifiers.new("bev", "BEVEL") + b.width = min(0.0024, t * 0.3) + b.segments = 1 + b.limit_method = "ANGLE" + b.angle_limit = DEG(30) + b.material = 1 + common.bake(o) + smooth(o, 35) + return o + + + +def plate_normals(o, zmid): + """A thin concave plate can come out of recalc_face_normals with its big faces turned in: point every face away from the mid plane.""" + me = o.data + for p in me.polygons: + c = p.center + if abs(p.normal.z) > 0.7 and (p.normal.z > 0) != (c.z > zmid): + p.flip() + me.update() + + +def hand_pump(): + M = FM + P = [] + Z, YB = 0.072, 0.16 + FR = FT.M_fwd((0, YB - 0.005, Z)) + # ---- the cast gearbox barrel (the old loft, finer), cast ribs along its top, a parting flange down each side with bolts + P.append(FT.loft("case", [(0, 0, 0, 0, -0.002), (0, 0, 0.03, 0.034, 0.0, 2.6), (0, 0, 0.046, 0.05, 0.012, 2.8), (0, 0, 0.053, 0.058, 0.04, 3.0), + (0, 0, 0.056, 0.06, 0.16, 3.0), (0, 0, 0.054, 0.058, 0.25, 3.0), (0, 0, 0.044, 0.05, 0.29, 2.8)], + segs=24, m=M.red, frame=FR, cap1=True, smooth_ang=60)) + # the barrel is cast in two halves bolted together through a pair of flanges round its middle: the flanges stand proud of the + # barrel, a parting line between them, six bolts through both, heads in front and nuts behind + DF = 0.146 + rings = [] + for dz, g in ((-0.0135, 0.0004), (-0.0122, 0.0086), (-0.0102, 0.0112), (-0.0016, 0.0112), (-0.0005, 0.0094), (0.0005, 0.0094), (0.0016, 0.0112), + (0.0102, 0.0112), (0.0122, 0.0086), (0.0135, 0.0004)): + rings.append((0, 0, 0.056 + g, 0.06 + g, DF + dz, 3.0)) + P.append(FT.loft("flange", rings, segs=24, m=M.red, frame=FR, cap0=False, cap1=False, smooth_ang=40)) + FAX = (FR.to_3x3() @ Vector((0, 0, 1))).normalized() + for k in range(6): + a = TAU * k / 6 + TAU / 12 + c_, s_ = math.cos(a), math.sin(a) + ex, ey = math.copysign(abs(c_) ** (2.0 / 3.0), c_), math.copysign(abs(s_) ** (2.0 / 3.0), s_) + bp = FR @ Vector(((0.056 + 0.0062) * ex, (0.06 + 0.0062) * ey, DF)) + out_ = (FR.to_3x3() @ Vector((ex, ey, 0.0))).normalized() + q = washer(P, bp + FAX * 0.0102, FAX, 0.0062, 0.0011, m=M.hw, ref=out_) + head(P, q, FAX, 0.0029, "hex", m=M.hw, ref=out_) + q = hexnut(P, bp - FAX * 0.0102, -FAX, 0.0054, 0.0041, m=M.hw, ref=out_) + thread(P, q + FAX * 0.002, -FAX, 0.0026, 0.004, m=M.st) + for sx in (-1, 1): + C = [FR @ Vector((sx * 0.02, 0.0605, d)) for d in (0.06, 0.12, 0.18, 0.226)] + + def ribsec(s, i): + k = min(1.0, s * 6, (1 - s) * 6) + return [(0.0045, -0.003), (0.0034, 0.0026 * k + 0.0004), (0.0, 0.0036 * k + 0.0004), (-0.0034, 0.0026 * k + 0.0004), (-0.0045, -0.003)] + P.append(sweep("castrib", C, ribsec, [M.red], ref=(1, 0, 0), ang=50)) + # strap bands (navy) bolted under the barrel, painted yellow lines between them + for d in (0.044, 0.232): + FT.body_band(P, FR, 0.054, 0.059, d, d + 0.024, M.d1, n=3.0, grow=0.004, segs=24) + for sx in (-1, 1): + P.append(bprism("bear", rounded_outline([(-0.004, 0.0), (0.004, 0.0), (0.004, 0.018), (-0.004, 0.018)], 0.003, 2), -0.0022, 0.0022, [M.d1], + bev=0.0008, segs=1, frame=fz(FR @ Vector((sx * 0.004, -0.058, d + 0.012)), (1, 0, 0), (0, 0, -1)) @ Matrix.Rotation(DEG(90), 4, "Z"))) + hbolt(P, M, FR @ Vector((0.0062, -0.066, d + 0.012)), (1, 0, 0), 0.0124, 0.0026, ref=(0, 0, 1), thr=0.003) + for d in (0.1, 0.18): + FT.body_band(P, FR, 0.0555, 0.0595, d, d + 0.012, M.yel, n=3.0, grow=0.0018, segs=24) + # bearing boss at the back where the push rod goes in: a brass bush, a felt seal lip, three screws + P.append(rev("bush", [(0.0105, -0.016), (0.019, -0.014), (0.0205, -0.012), (0.0205, 0.003), (0.0175, 0.006), (0.0115, 0.0075), (0.0098, 0.004)], + Vector((0, YB, Z)), (0, 1, 0), [M.brass], segs=16)) + for k in range(3): + a = TAU * k / 3 + 0.5 + head(P, Vector((0.0158 * math.cos(a), YB + 0.003, Z + 0.0158 * math.sin(a))), (0, 1, 0), 0.0017, "dome", m=M.hw) + # ---- the neck down to the cutter bar: a casting with fillets, a flange bolted onto the bar, an oil plug + nr = [] + for hw, hd, rc, z in ((0.046, 0.017, 0.012, -0.024), (0.046, 0.017, 0.012, -0.018), (0.04, 0.042, 0.014, -0.015), (0.039, 0.041, 0.016, 0.02), + (0.041, 0.043, 0.016, 0.05), (0.047, 0.047, 0.02, 0.066), (0.05, 0.05, 0.022, 0.07)): + nr.append([Vector((x, -0.112 + y, z)) for x, y, _ in rr_pts(hw, hd, rc, nc=3, nf=(1, 1))]) + P.append(rings_mesh("neck", nr, [M.d1], ang=40)) + P.append(bprism("neckcap", rrect(0.044, 0.015, 0.006, 2), -0.023, 0.007, [M.d1, M.st], bev=0.003, segs=1, bev_slot=1, frame=Matrix.Translation((0, -0.142, 0)))) + for sx in (-1, 1): + q = washer(P, Vector((sx * 0.032, -0.142, 0.007)), (0, 0, 1), 0.0062, 0.0012, m=M.hw) + head(P, q, (0, 0, 1), 0.0036, "hex", m=M.hw, ref=(1, 0, 0)) + P.append(rev("oilplug", [(0.0, 0.0), (0.0085, 0.0), (0.009, 0.002), (0.0085, 0.004), (0.0058, 0.0045), (0.0058, 0.0085), (0.0, 0.009)], + Vector((0.0, -0.154, 0.035)), (0, -1, 0.2), [M.brass], segs=6, ang=30)) + # ---- the cutter bar (rolled towards the eye like the old one): fixed comb with ground edges, guide bar, bolts with spacers and nuts + C = [] + C.append(comb5("combL", FT.comb_pts(-0.1, -0.56, 6, 0.03, 0.104), 0.0095, M, M.st, M.br, Matrix.Translation((0, 0, -0.033)))) + C.append(bprism("guide", rrect(0.015, 0.2, 0.006, 2), -0.0105, 0.0, [M.d1, M.st], bev=0.0025, segs=1, bev_slot=1, frame=Matrix.Translation((0, -0.33, 0)))) + C.append(rev("guidetip", [(0.0, -0.0105), (0.0135, -0.0105), (0.015, -0.0085), (0.015, -0.002), (0.0135, 0.0), (0.0, 0.0)], Vector((0, -0.53, 0)), (0, 0, 1), + [M.d1], segs=14)) + for k in range(5): + c = Vector((0, -0.2 - k * 0.075, 0.0)) + q = washer(C, c, (0, 0, 1), 0.0098, 0.0016, m=M.brass) + head(C, q, (0, 0, 1), 0.0055, "hex", m=M.hw, ref=(1, 0.3, 0)) + q = washer(C, c - Vector((0, 0, 0.0425)), (0, 0, -1), 0.0085, 0.0014, m=M.hw) + q = hexnut(C, q, (0, 0, -1), 0.0095, 0.007, m=M.hw) + thread(C, q + Vector((0, 0, 0.002)), (0, 0, -1), 0.0045, 0.005, m=M.st) + place(C, FT.ROLL) + P += C + # ---- grip, clamp and trigger + grip5(P, M, (0, 0, 0), tilt=10, h1=0.032) + cr = [] + for hw, hd, rc, z in ((0.027, 0.034, 0.012, 0.015), (0.031, 0.038, 0.014, 0.018), (0.031, 0.038, 0.014, 0.032), (0.027, 0.034, 0.012, 0.035)): + cr.append([Vector((x, y, z)) for x, y, _ in rr_pts(hw, hd, rc, nc=3, nf=(1, 1))]) + P.append(rings_mesh("clamp", cr, [M.d1], ang=40)) + for sy in (-1, 1): + head(P, Vector((0.031, sy * 0.022, 0.025)), (1, 0, 0), 0.0034, "hex", m=M.hw, ref=(0, 0, 1)) + trigger5(P, M, y0=-0.03, z0=0.022, drop=0.05) + # ---- the tin chute: scoops the clippings off the bar root and up into the bag; a rolled lip at its mouth, a riveted seam, a bracket + cp = [(0, -0.232, 0.03), (0, -0.19, 0.05), (0, -0.14, 0.098), (0, -0.092, 0.165), (0, -0.05, 0.19)] + P.append(FT.duct("chute", cp, lambda s: (0.062 - 0.012 * s, 0.03 + 0.024 * s), M.tin, segs=20, nu=2.2, vs=5.0)) + P.append(FT.duct("mouth", [(0, -0.2365, 0.0292), (0, -0.2255, 0.0312)], lambda s: (0.0675 + 0.002 * math.sin(s * PI), 0.0355), M.st, segs=20, per=2)) + P.append(FT.duct("chutein", [(0, -0.226, 0.031), (0, -0.21, 0.036)], lambda s: (0.056, 0.024), M.d1, segs=16, per=1, cap=True)) + Cc = catmull([Vector(p) for p in cp], 4) + for k in range(2, len(Cc) - 2, 2): + a, b = Cc[k - 1], Cc[k + 1] + T_ = (b - a).normalized() + N_ = T_.cross(Vector((1, 0, 0))).normalized() + s = k / (len(Cc) - 1) + hz = 0.03 + 0.024 * s + p = Cc[k] + N_ * (hz * 1.0 + 0.0008) * (1 if N_.z > 0 else -1) + rivet(P, p, (N_ if N_.z > 0 else -N_), 0.0028, m=M.brass) + P.append(sweep("chutebrk", fillet([Vector((0, -0.142, 0.026)), Vector((0, -0.142, 0.07)), Vector((0, -0.125, 0.105))], 0.02, 3), + lambda s, i: rrect(0.016, 0.0025, 0.0018, 1), [M.d1], ref=(1, 0, 0), ang=40)) + hbolt(P, M, Vector((0.0, -0.1375, 0.06)), (0, 1, 0), 0.0075, 0.003, ref=(1, 0, 0), thr=0.003) + # ---- the burlap catch bag (the old one), a seam down its top in twine stitches, the gathered neck tied off, a clamped steel ring, + # two leather straps with stitched edges and real buckles + bz = 0.19 + BF = FT.M_axis("Y", (0, -0.06, bz)) + rings = [(0, 0, 0.05, 0.05, -0.012), (0, 0, 0.056, 0.054, 0.0), (0, 0.002, 0.074, 0.068, 0.03), (0, 0.004, 0.087, 0.076, 0.075), (0, 0.003, 0.09, 0.078, 0.13), + (0, 0.0, 0.085, 0.074, 0.185), (0, -0.002, 0.066, 0.058, 0.232), (0, -0.002, 0.04, 0.036, 0.262), (0, -0.002, 0.024, 0.022, 0.28), (0, -0.002, 0.022, 0.02, 0.29), + (0, -0.002, 0.03, 0.026, 0.302), (0, -0.002, 0.036, 0.03, 0.316), (0, -0.002, 0.022, 0.02, 0.312)] + bag = FT.loft("bag", rings, segs=22, m=M.fab, frame=BF, cap0=True, cap1=True, smooth_ang=70) + FT.pleats(bag, (0, -0.06, bz), (0, 1, 0), n=6, amp=0.12, t0=0.2, t1=0.27) + FT.wobble(bag, 0.008, 9.0, seed=2.0) + FT.around(bag, (0, -0.06, bz), (0, 1, 0), nu=3.6, s=7.0) + P.append(bag) + # the seam: a raised ridge along the top of the sack, stitched in twine + bvh = None + from mathutils.bvhtree import BVHTree + bpy.context.view_layer.update() + bvh = BVHTree.FromObject(bag, bpy.context.evaluated_depsgraph_get()) + seam = [] + for k in range(22): + y = -0.045 + 0.215 * k / 21 + hit = bvh.ray_cast(Vector((0.0, y, bz + 0.2)), Vector((0, 0, -1))) + if hit[0] is not None: + seam.append(hit[0] - Vector((0, 0, 0.0015))) + if len(seam) > 3: + P.append(sweep("seam", seam, lambda s, i: [(0.0036, -0.001), (0.002, 0.0028), (-0.002, 0.0028), (-0.0036, -0.001)], [M.fab], ref=(1, 0, 0), ang=60)) + for sx in (-1, 1): + row = [] + for p in seam[1:-1]: + hit = bvh.ray_cast(p + Vector((sx * 0.009, 0, 0.05)), Vector((0, 0, -1))) + if hit[0] is not None: + row.append(hit[0]) + if len(row) > 2: + P.append(stitches("stitch", row, lambda p, bz=bz: Vector((p.x, 0.0, p.z - bz)), M.thr, step=0.012, L=0.0065, w=0.0022, lift=0.0008)) + FT.tie(P, (0, 0.23, bz - 0.002), (0, 1, 0), 0.0245, m=M.thr, + tails=[[(0.02, 0.234, bz + 0.012), (0.05, 0.242, bz + 0.01), (0.07, 0.232, bz - 0.03), (0.075, 0.236, bz - 0.06)]]) + rclamp(P, M, Vector((0, -0.058, bz)), (0, 1, 0), 0.051, w=0.012, th=0.0035, ear=(0, 0, -1), m=M.st) + for yy in (0.03, 0.135): + pts = [(0.056, yy, 0.09), (0.082, yy, 0.13), (0.09, yy, 0.19), (0.068, yy, 0.243), (0.0, yy, 0.27), (-0.068, yy, 0.243), (-0.09, yy, 0.19), (-0.082, yy, 0.13), + (-0.056, yy, 0.09)] + C = resample([Vector(p) for p in pts], 26) + sc = [] + for p in C: + hit = bvh.ray_cast(Vector((0, yy, bz)) + (p - Vector((0, yy, bz))) * 1.6, -(p - Vector((0, yy, bz))).normalized()) + sc.append(hit[0] + (p - Vector((0, yy, bz))).normalized() * 0.0028 if hit[0] is not None else p) + P.append(sweep("strap", sc, lambda s, i: [(-0.0028, -0.0125), (0.0, -0.0128), (0.0028, -0.0125), (0.0032, 0.0), (0.0028, 0.0125), (0.0, 0.0128), + (-0.0028, 0.0125), (-0.0032, 0.0)], [M.lea], ref=(0, 1, 0), ang=50)) + for side in (-1, 1): + row = [p + Vector((0, side * 0.0092, 0)) + (p - Vector((0, yy, bz))).normalized() * 0.0028 for p in sc[1:-1]] + P.append(stitches("lstitch", row, lambda p, yy=yy: Vector((p.x, 0.0, p.z - bz)), M.thr, step=0.011, L=0.006, w=0.0018, lift=0.0004)) + # the buckle: a brass frame with a bar and a tongue, the strap's end through a keeper loop + bkc = Vector((0.0915, yy, 0.185)) + Fb = fz(bkc, (1, 0, 0), (0, 0, 1)) + ring = [Vector((0.0, 0.0, 0.0))] + frm = [Fb @ Vector((x, y, 0.0)) for x, y in rrect(0.016, 0.017, 0.006, 2)] + frm.append(frm[0]) + frm.append(frm[1]) + P.append(sweep("buckle", frm, lambda s, i: circ(0.0022, 6), [M.brass], cap0=False, cap1=False, ang=60)) + P.append(tube5("bbar", [Fb @ Vector((0.0, -0.017, 0.0)), Fb @ Vector((0.0, 0.017, 0.0))], 0.0018, M.brass, segs=6)) + P.append(tube5("tongue", [Fb @ Vector((0.0, 0.0, 0.0)), Fb @ Vector((0.014, 0.0, 0.0025)), Fb @ Vector((0.018, 0.0, 0.001))], 0.0014, M.brass, segs=6, bend=0.004)) + P.append(bprism("keeper", rrect(0.004, 0.0145, 0.0025, 2), -0.0015, 0.0045, [M.lea], bev=0.0008, segs=1, frame=fz(bkc + Vector((0, 0, -0.026)), (1, 0, 0), (0, 0, 1)))) + body = ffin(P, "Body") + + # ---- Plunger: T-handle + push rod + the moving upper comb + Q = [] + cU = comb5("combU", FT.comb_pts(-0.16, -0.54, 5, 0.024, 0.1, phase=0.3), 0.0075, M, M.st, M.br, Matrix.Translation((0, 0, -0.0235))) + + place([cU], FT.ROLL) + Q.append(cU) + lk = [] + for hw, hd, rc, z in ((0.022, 0.022, 0.008, -0.015), (0.025, 0.025, 0.01, -0.012), (0.025, 0.025, 0.01, 0.012), (0.022, 0.022, 0.008, 0.015)): + lk.append([Vector((x, -0.162 + y, z)) for x, y, _ in rr_pts(hw, hd, rc, nc=2, nf=(1, 1))]) + Q.append(rings_mesh("linkU", lk, [M.d1], ang=40)) + for sx in (-1, 1): + head(Q, Vector((sx * 0.01, -0.162, 0.015)), (0, 0, 1), 0.0032, "hex", m=M.hw, ref=(1, 0, 0)) + Q.append(rev("rod", [(0.0, -0.115), (0.0078, -0.114), (0.0085, -0.11), (0.0085, 0.11), (0.0078, 0.114), (0.0, 0.115)], Vector((0, YB + 0.005, Z)), (0, 1, 0), + [M.st], segs=12)) + Q.append(rev("rodcol", [(0.0085, -0.009), (0.0118, -0.008), (0.0128, -0.005), (0.0128, 0.005), (0.0118, 0.008), (0.0085, 0.009)], Vector((0, YB + 0.104, Z)), + (0, 1, 0), [M.brass], segs=14)) + head(Q, Vector((0, YB + 0.104, Z + 0.0128)), (0, 0, 1), 0.0022, "hex", m=M.hw) + # the T: a turned timber cross handle with grooves, iron end ferrules with a domed rivet, a red cast tee with a bolt through + for sx in (-1, 1): + prof = [(0.0, 0.0), (0.012, 0.0), (0.0165, 0.006), (0.0205, 0.012), (0.0198, 0.02), (0.0208, 0.026), (0.0212, 0.04), (0.0205, 0.05), (0.0185, 0.054)] + h_ = rev("thandle", prof, Vector((sx * 0.026, YB + 0.126, Z)), (sx, 0, 0), [M.tim], segs=14, cap1=True) + Q.append(timber(h_, (1, 0, 0))) + Q.append(rev("tcap", [(0.0178, -0.003), (0.0222, -0.002), (0.0228, 0.006), (0.0215, 0.01), (0.012, 0.0125), (0.0, 0.013)], + Vector((sx * 0.08, YB + 0.126, Z)), (sx, 0, 0), [M.d1], segs=14)) + tb = [] + for hw, hd, rc, z in ((0.02, 0.02, 0.008, -0.025), (0.025, 0.025, 0.011, -0.021), (0.025, 0.025, 0.011, 0.021), (0.02, 0.02, 0.008, 0.025)): + tb.append([Vector((z, YB + 0.126 + y, Z + x)) for x, y, _ in rr_pts(hw, hd, rc, nc=3, nf=(1, 1))]) + Q.append(rings_mesh("tblock", tb, [M.red], ang=40)) + hbolt(Q, M, Vector((0, YB + 0.126, Z + 0.025)), (0, 0, 1), 0.05, 0.0034, ref=(1, 0, 0), thr=0.004) + pl = ffin(Q, "Plunger", uv=5.0) + set_origin(pl, (0, YB, Z)) + empty("Nozzle", (0, -0.55, -0.018)) + return {} + + + + +def near(C, p): + """Index, point and tangent of polyline C nearest to p.""" + p = Vector(p) + i = min(range(len(C)), key=lambda k: (C[k] - p).length) + t = (C[min(i + 1, len(C) - 1)] - C[max(i - 1, 0)]).normalized() + return i, C[i], t + + +def cast_block(name, c, hw, hd, h, m, rc=None, z0=None, flare=0.0): + """A casting: a rounded block hw x hd, h high above c (or from z0), its edges eased, a little draft (flare) towards the bottom.""" + rc = rc if rc is not None else min(hw, hd) * 0.4 + zb = c[2] if z0 is None else z0 + rings = [] + for k, (f, dz) in enumerate(((0.9, 0.0), (1.0 + flare, 0.0025), (1.0 + flare * 0.6, h * 0.3), (1.0, h - 0.004), (0.92, h - 0.0008), (0.8, h))): + rings.append([Vector((c[0] + x, c[1] + y, zb + dz)) for x, y, _ in rr_pts(hw * f, hd * f, rc * f, nc=2, nf=(1, 1))]) + return rings_mesh(name, rings, [m], ang=40) + + +# ======================================================================= SM_Tool_SlurpGun (Weed Whacker) + +def slurp_gun(): + M = FM + P = [] + A = Vector((0, 0.17, 0.092)) + Ax = Vector((0, 0.42, 0.907)).normalized() + E = Vector((0, -0.655, -0.112)) + D = E + Ax * 0.12 + Cp = Vector((0, -0.5, -0.03)) + Cs = resample([A, Vector((0, -0.1, 0.05)), Vector((0, -0.38, 0.003)), Cp, D, E + Ax * 0.03], 64, per=5) + P.append(sweep("shaft", Cs, lambda s, i: circ(0.0235, 14), [M.st], ref=(1, 0, 0), ang=40)) + # shaft clamps (the old hoops), bolted + for p in ((0, -0.1, 0.05), (0, -0.5, -0.03)): + i, c, t = near(Cs, p) + rclamp(P, M, c, t, 0.0235, w=0.016, th=0.004, ear=(1, 0, 0)) + # ---- the engine on the back of the shaft, a cast saddle under it with two clamps round the shaft + E5, carb = engine5((0, 0.13, 0.157), M, s=0.92, pull=1, tank=False) + P += E5 + P.append(cast_block("mount", (0, 0.13, 0.0), 0.027, 0.052, 0.02, M.d1, z0=0.1, flare=0.08)) + for y in (0.095, 0.165): + i, c, t = near(Cs, (0, y, 0.09)) + rclamp(P, M, c, t, 0.0235, w=0.014, th=0.0035, ear=(-1, 0, 0)) + # ---- the red fuel tank carrying the mix jar, its bracket clamped to the shaft + tank5(P, M, (0, -0.065, 0.098), 0.072, 0.066, 0.09, cap_x=None) + P.append(cast_block("tbrk", (0, -0.065, 0.0), 0.022, 0.032, 0.036, M.d1, z0=0.063, flare=0.15)) + i, c, t = near(Cs, (0, -0.065, 0.045)) + rclamp(P, M, c, t, 0.0235, w=0.016, th=0.004, ear=(1, 0, 0)) + # the jar: a knurled base ring, glass with a moulded thread at the neck, a knurled lid, a turned cork, a wire bail over it + CF = Vector((0, -0.065, 0.202)) + + def kn(i, a): + return 1.0 + (0.025 * math.cos(20 * a) if i in (2, 3) else 0.0) + P.append(rev("jarbase", [(0.0, -0.016), (0.056, -0.016), (0.061, -0.013), (0.062, -0.008), (0.062, 0.002), (0.058, 0.005), (0.056, 0.006)], CF, (0, 0, 1), + [M.d1], segs=28, mod=kn, ang=40)) + jar = [(0.056, 0.0), (0.0595, 0.006), (0.06, 0.014), (0.06, 0.088), (0.0555, 0.104), (0.047, 0.112), (0.047, 0.115), (0.049, 0.117), (0.047, 0.119), + (0.049, 0.121), (0.047, 0.123)] + P.append(rev("jar", jar, CF, (0, 0, 1), [M.glass], segs=24, ang=50)) + P.append(rev("lid", [(0.0, 0.142), (0.038, 0.142), (0.048, 0.139), (0.0515, 0.134), (0.0515, 0.118), (0.049, 0.113), (0.0465, 0.112)], CF, (0, 0, 1), [M.st], + segs=28, mod=lambda i, a: 1.0 + (0.03 * math.cos(24 * a) if i in (3, 4) else 0.0), ang=45)) + ck = rev("cork", [(0.0, 0.0), (0.0145, 0.0), (0.0165, 0.003), (0.017, 0.012), (0.0158, 0.016), (0.0, 0.0168)], CF + Vector((0, 0, 0.1415)), (0, 0, 1), [M.tim], segs=12) + P.append(timber(ck, (0, 0, 1))) + for sx in (-1, 1): + P.append(rev("bailpivot", [(0.0, 0.0), (0.0045, 0.0), (0.005, 0.003), (0.0, 0.0045)], CF + Vector((sx * 0.062, 0, -0.006)), (sx, 0, 0), [M.d1], segs=8)) + bail = [CF + Vector((-0.0635, 0, -0.006)), CF + Vector((-0.0635, 0, 0.122)), CF + Vector((-0.045, 0.026, 0.148)), CF + Vector((0.045, 0.026, 0.148)), + CF + Vector((0.0635, 0, 0.122)), CF + Vector((0.0635, 0, -0.006))] + P.append(tube5("bail", bail, 0.0024, M.d1, segs=6, bend=0.014, nb=4)) + fill = FT.lathe("Fill", [(0.0, 0.0), (0.052, 0.0), (0.052, 0.106), (0.0, 0.106)], segs=18, m="M_GrassFill", frame=Matrix.Translation(CF), smooth_ang=30) + # fuel line from a nipple on the tank top to the carburettor, held by a clip on the engine mount + P.append(rev("nipple", [(0.0, 0.0), (0.006, 0.0), (0.006, 0.004), (0.004, 0.006), (0.0042, 0.012), (0.0035, 0.014)], Vector((0.045, -0.02, 0.1875)), (0, 0, 1), + [M.brass], segs=8)) + P.append(tube5("fuel", [(0.045, -0.02, 0.2), (0.055, 0.0, 0.215), (0.06, 0.04, 0.2), (0.03, 0.062, 0.175), carb + Vector((0.01, 0.004, -0.012))], + 0.0032, M.brass, segs=6, bend=0.016, nb=3)) + # ---- the rear grip, its cast clamp onto the shaft, the trigger; the throttle cable from the grip up to the carburettor + grip5(P, M, (0, 0, 0), tilt=12, h1=0.05) + P.append(cast_block("clamp", (0, 0.004, 0.0), 0.0325, 0.0425, 0.056, M.d1, z0=0.028, flare=0.06)) + i, c, t = near(Cs, (0, 0.004, 0.07)) + for sx in (-1, 1): + hbolt(P, M, Vector((sx * 0.0325, 0.022 * sx, 0.06)), (sx, 0, 0), 0.065, 0.0034, ref=(0, 0, 1), nut=False) + ce = trigger5(P, M, y0=-0.034, z0=0.03, drop=0.05) + cable5(P, M, [ce, (0.02, -0.05, 0.058), (0.042, -0.03, 0.08), (0.05, 0.02, 0.11), (0.04, 0.05, 0.15), carb + Vector((0.004, -0.002, 0.0))], + clips=[(Vector((0.05, 0.02, 0.11)), (0, 1, 0.6), 0.0)], n=30) + # ---- the loop handle: a bent tube loop out of a cast clamp on the shaft, a turned timber grip across its top in brass ferrules + Ly, Lz = -0.215, 0.031 + lp = [(0.0, Ly, Lz), (0.05, Ly, Lz + 0.03), (0.098, Ly, Lz + 0.1), (0.075, Ly, Lz + 0.17), (0.0, Ly, Lz + 0.19), (-0.075, Ly, Lz + 0.17), (-0.098, Ly, Lz + 0.1), + (-0.05, Ly, Lz + 0.03), (0.0, Ly, Lz)] + loop = resample([Vector(p) for p in lp], 44, per=6) + loop[0] = loop[-1] = Vector((0.0, Ly, Lz)) + for half in (loop[:23], loop[22:]): + P.append(sweep("loop", half, lambda s, i: circ(0.011, 10), [M.d1], ref=(0, 1, 0), ang=40)) + P.append(cast_block("loopclamp", (0, Ly, 0.0), 0.034, 0.024, 0.05, M.d1, z0=Lz - 0.012, flare=0.1)) + i, c, t = near(Cs, (0, Ly, Lz)) + rclamp(P, M, c, t, 0.0235, w=0.022, th=0.004, ear=None) + knob_nut(P, Vector((0.035, Ly, Lz + 0.02)), (1, 0, 0), 0.016, M.d1, ref=(0, 0, 1)) + head(P, Vector((-0.035, Ly, Lz + 0.02)), (-1, 0, 0), 0.004, "hex", m=M.hw, ref=(0, 0, 1)) + gz = Lz + 0.183 + for sx in (-1, 1): + prof = [(0.0, 0.0), (0.0165, 0.0), (0.0195, 0.006), (0.0205, 0.014), (0.0192, 0.022), (0.0206, 0.03), (0.0208, 0.046), (0.019, 0.054), (0.0175, 0.056)] + g = rev("loopgrip", prof, Vector((0.0, Ly, gz)), (sx, 0, 0), [M.tim], segs=12, cap1=True) + P.append(timber(g, (1, 0, 0))) + P.append(rev("lferrule", [(0.0168, -0.006), (0.0206, -0.005), (0.0214, -0.002), (0.0214, 0.004), (0.0206, 0.006), (0.0168, 0.007)], + Vector((sx * 0.06, Ly, gz)), (sx, 0, 0), [M.brass], segs=12)) + # ---- the gear head at the shaft's end: a ribbed casting, a clamp collar with its bolt, a grease nipple; the guard bolted to it + GF = FT.frame_on(E, Ax, up=(0, 1, 0)) + P.append(rev("gear", [(0.0, -0.03), (0.03, -0.031), (0.038, -0.028), (0.044, -0.022), (0.048, -0.006), (0.048, 0.004), (0.044, 0.026), (0.034, 0.05), + (0.029, 0.058), (0.029, 0.068), (0.031, 0.07), (0.031, 0.08), (0.026, 0.083), (0.0, 0.083)], E, Ax, [M.d1], segs=20, ref=(0, 1, 0), + mod=lambda i, a: 1.0 + (0.07 * max(0.0, math.cos(4 * a)) ** 6 if 4 <= i <= 7 else 0.0), ang=40)) + hbolt(P, M, GF @ Vector((0.034, 0.012, 0.074)), (GF.to_3x3() @ Vector((0, -1, 0))).normalized(), 0.026, 0.003, nut=True, thr=0.003) + P.append(rev("grease", [(0.0, 0.0), (0.0045, 0.0), (0.0045, 0.004), (0.0032, 0.0055), (0.0032, 0.008), (0.0038, 0.009), (0.0, 0.0105)], + GF @ Vector((0.046, 0.0, 0.0)), (GF.to_3x3() @ Vector((1, 0, 0))).normalized(), [M.brass], segs=6)) + gr = 0.158 + + def shell(u, v, off): + a = DEG(28 + 124 * u) + rr = 0.032 + (gr - 0.032) * v + return GF @ Vector((rr * math.cos(a), rr * math.sin(a), 0.03 - 0.045 * v * v + off)) + P.append(FT.grid_slab("guard", shell, 16, 4, 0.0035, -0.0035, M.red, smooth_ang=50)) + P.append(sweep("guardrim", [shell(i / 20, 1.0, 0.0) for i in range(21)], lambda s, i: circ(0.0082, 8), [M.st], ang=50)) + for vv in (0.45, 0.78): + P.append(sweep("guardrib", [shell(0.05 + 0.9 * i / 12, vv, 0.0035) for i in range(13)], + lambda s, i: [(0.004, -0.001), (0.0026, 0.0028), (-0.0026, 0.0028), (-0.004, -0.001)], [M.yel], ang=50, + ref=tuple((GF.to_3x3() @ Vector((0, 0, 1))).normalized()))) + for u in (0.2, 0.8): + p = shell(u, 0.12, 0.0035) + n = (GF.to_3x3() @ Vector((0, 0, 1))).normalized() + q = washer(P, p, n, 0.0062, 0.0012, m=M.hw) + head(P, q, n, 0.0036, "hex", m=M.hw) + # the line cutter: a small toothed blade riveted to the guard's rim where the line sweeps past + p0, p1 = shell(0.93, 0.93, 0.0), shell(1.0, 0.93, 0.0) + nrm = (GF.to_3x3() @ Vector((0, 0, 1))).normalized() + Fb = fz((p0 + p1) / 2, nrm, (p1 - p0)) + teeth = [(-0.012, -0.006), (0.012, -0.006), (0.012, 0.004)] + [(0.012 - 0.024 * k / 6 - (0.002 if k % 2 else 0.0), 0.007 + (0.003 if k % 2 else 0.0)) for k in range(7)] + P.append(bprism("cutter", teeth, -0.0045, -0.0025, [M.st, M.d1], bev=0.0006, segs=1, frame=Fb, bev_slot=1)) + for xx in (-0.006, 0.006): + head(P, Fb @ Vector((xx, -0.002, -0.0025)), -nrm, 0.0018, "dome", m=M.hw) + body = ffin(P, "Body") + + # ---- Fan: the line head, built about local Y (local -Y to the ground): a spool with flanges and the wound line showing, + # eyelets the four lines come out of, a ribbed bump knob + Q = [] + AX = FT.M_axis("Y") + Q.append(FT.lathe("spool", [(0.0, 0.0), (0.03, 0.002), (0.046, -0.002), (0.051, -0.006), (0.052, -0.011), (0.047, -0.014), (0.034, -0.015), (0.034, -0.03), + (0.05, -0.031), (0.058, -0.036), (0.0615, -0.046), (0.06, -0.06), (0.05, -0.069), (0.0, -0.072)], segs=24, m=M.yel, frame=AX, smooth_ang=40)) + for k in range(2): + t = FT.torus("wound", 0.039, 0.0062, seg=20, rseg=6, m=M.red) + t.data.transform(AX @ Matrix.Translation((0, 0, -0.0192 - 0.007 * k))) + Q.append(t) + Q.append(rev("bump", [(0.028, -0.068), (0.0305, -0.074), (0.029, -0.082), (0.024, -0.09), (0.016, -0.096), (0.0, -0.0995)], Vector(), (0, 1, 0), [M.d1], segs=16, + mod=lambda i, a: 1.0 + (0.06 * math.cos(8 * a) if 1 <= i <= 3 else 0.0), ang=50)) + for k in range(4): + a = TAU * k / 4 + 0.4 + dirv = Vector((math.cos(a), 0, math.sin(a))) + tan = Vector((-math.sin(a), 0, math.cos(a))) + ey = dirv * 0.0605 + FT.Y_UP * -0.043 + Q.append(rev("eyelet", [(0.0038, -0.003), (0.0062, -0.0025), (0.0066, 0.0), (0.0062, 0.0025), (0.0038, 0.003)], ey, dirv, [M.d1], segs=10)) + pts = [dirv * 0.05 + FT.Y_UP * -0.043, dirv * 0.1 + FT.Y_UP * -0.045 + tan * 0.004, dirv * 0.19 + FT.Y_UP * -0.05 + tan * 0.022] + Q.append(sweep("line", resample(pts, 10, per=3), lambda s, i: circ(0.0068 * (1 - 0.2 * s), 6), [M.trim], ang=60)) + fan = FT.spinner(Q, "Fan", E - Ax * 0.03, Ax) + weighted(fan) + set_origin(fill, (0, -0.065, 0.202)) + uv_box(fill, 4.0) + empty("Nozzle", tuple(E - Ax * 0.11)) + return {} + + +# ======================================================================= SM_Tool_HydroCannon (Mulch Cannon) + +def fan5(name, loc, r, hub, n, M, m_blade, m_hub, pitch=32.0): + """A cast fan spinning about the forward axis (Blender -Y): a domed hub with a nose nut and bolts, twisted blades with rounded tips + and a thinner trailing edge, a shroud ring round the tips.""" + Q = [] + FR = FT.M_fwd(loc) + loc = Vector(loc) + Q.append(FT.lathe("hub", [(0.0, -0.016), (hub * 0.7, -0.016), (hub, -0.009), (hub * 1.02, 0.002), (hub, 0.008), (hub * 0.78, 0.014), (hub * 0.42, 0.019), + (0.0, 0.0205)], segs=18, m=m_hub, frame=FR, cap0=True, smooth_ang=40)) + fwd = Vector((0, -1, 0)) + q = hexnut(Q, loc + fwd * 0.0195, fwd, 0.0075, 0.006, m=m_blade, ref=(1, 0, 0)) + P_ = Q + for k in range(3): + a = TAU * (k + 0.5) / 3 + p = FR @ Vector((hub * 0.6 * math.cos(a), hub * 0.6 * math.sin(a), 0.0165)) + head(P_, p, fwd, 0.0022, "hex", m=m_blade) + for k in range(n): + th0 = TAU * k / n + rings = [] + nu, nv = 6, 5 + for i in range(nu + 1): + u = i / nu + rho = hub * 0.85 + (r - hub * 0.85) * u + span = 0.55 + 0.22 * u + tip = 1.0 if u < 0.8 else math.sqrt(max(0.0, 1 - ((u - 0.8) / 0.2) ** 2)) * 0.75 + 0.25 + ring = [] + for side in (1, -1): + vs = [j / nv for j in range(nv + 1)] + if side < 0: + vs = vs[::-1] + for v in vs: + vv = 0.5 + (v - 0.5) * tip + th = th0 + (vv - 0.5) * span + ax = (vv - 0.5) * rho * span * math.tan(DEG(pitch * (1.1 - 0.4 * u))) + t = 0.0026 * (0.35 + 0.65 * math.sin(PI * min(1.0, max(0.0, v * 0.9 + 0.1)))) + ring.append(FR @ Vector((rho * math.cos(th), rho * math.sin(th), ax + side * t))) + rings.append(ring) + Q.append(rings_mesh("blade", rings, [m_blade], ang=40)) + Q.append(FT.lathe("shroud", [(r + 0.002, -0.009), (r + 0.006, -0.0085), (r + 0.0085, -0.004), (r + 0.0085, 0.004), (r + 0.006, 0.0085), (r + 0.002, 0.009)], + segs=32, m=m_hub, frame=FR, cap0=False, cap1=False, smooth_ang=50)) + o = ffin(Q, name, uv=6.0) + set_origin(o, loc) + return o + + +def hydro_cannon(): + M = FM + P = [] + Z, YR = 0.143, 0.2 + FR = FT.M_fwd((0, YR, Z)) + tube = FT.lathe("tube", [(0.0, -0.002), (0.066, 0.0), (0.096, 0.028), (0.102, 0.06), (0.102, 0.52), (0.1, 0.61), (0.11, 0.655), (0.14, 0.712), (0.178, 0.752), + (0.194, 0.776)], segs=32, m=M.st, frame=FR, smooth_ang=60) + FT.around(tube, (0, YR, Z), (0, 1, 0), nu=3.0, s=2.0) + P.append(tube) + P.append(FT.lathe("rim", [(0.186, 0.768), (0.2, 0.77), (0.212, 0.782), (0.204, 0.794), (0.186, 0.792), (0.178, 0.782)], segs=32, m=M.red, frame=FR, smooth_ang=70)) + P.append(FT.lathe("throat", [(0.18, 0.784), (0.15, 0.742), (0.112, 0.694), (0.094, 0.652), (0.09, 0.61), (0.03, 0.604), (0.0, 0.604)], segs=32, m=M.d1, frame=FR)) + for d in (0.05, 0.44): + FT.body_band(P, FR, 0.102, 0.102, d, d + 0.044, M.red, n=2.0, grow=0.004, segs=32) + FT.body_band(P, FR, 0.102, 0.102, 0.585, 0.605, M.d1, n=2.0, grow=0.005, segs=32) + # the lap seam along the tube (a strip on the 45 degree line), domed rivets through it + a45 = Vector((0.7071, 0, 0.7071)) + C = [Vector((0, YR - d, Z)) + a45 * 0.1022 for d in (0.1, 0.25, 0.4, 0.5)] + P.append(sweep("lapseam", C, lambda s, i: [(-0.0005, -0.009), (0.0014, -0.0085), (0.0018, 0.0), (0.0014, 0.0085), (-0.0005, 0.009)], [M.st], + ref=tuple(a45), ang=50)) + for k in range(10): + d = 0.12 + k * 0.035 + rivet(P, Vector((0, YR - d, Z)) + a45 * 0.1035, a45, 0.0034, m=M.brass) + for k in range(10): + a = TAU * (k + 0.5) / 10 + rivet(P, FR @ Vector((0.203 * math.cos(a), 0.203 * math.sin(a), 0.7955)), (0, -1, 0), 0.0042, m=M.brass) + # ---- the timber carriage: saddles across, rails along, carriage bolts through, steel straps over the tube into the saddles + for y in (0.012, -0.33): + timber5(P, M, (-0.137, y - 0.037, 0.03), (0.137, y + 0.037, 0.09), 0, ch=0.006, s=2.0, off=(0.13 if y > 0 else 0.4, 0.0), seed=31 if y > 0 else 32) + C = [Vector((x, y, Z + 0.1045 * math.sqrt(max(0.0, 1 - (x / 0.1045) ** 2)) if abs(x) < 0.1045 else 0.088)) for x in [-0.118 + 0.236 * k / 16 for k in range(17)]] + for k, x in enumerate([-0.118 + 0.236 * k / 16 for k in range(17)]): + if abs(x) < 0.1045: + a = math.acos(max(-1.0, min(1.0, x / 0.1045))) + C[k] = Vector((0.1045 * math.cos(a), y, Z + 0.1045 * math.sin(a))) + else: + C[k] = Vector((x, y, 0.091)) + C[0].z = C[-1].z = 0.091 + P.append(sweep("saddlestrap", C, lambda s, i: rrect(0.0025, 0.012, 0.0018, 1), [M.d1], ref=(0, 0, 1), ang=35)) + for sx in (-1, 1): + cbolt(P, M, Vector((sx * 0.112, y, 0.0935)), (0, 0, 1), 0.0042, L=0.0635) + for sx in (-1, 1): + x0, x1 = sorted((sx * 0.112, sx * 0.158)) + timber5(P, M, (x0, -0.41, 0.078), (x1, 0.16, 0.128), 1, ch=0.0055, s=1.8, off=(0.14 * sx, 0.3), seed=40 + sx) + # a forged strap over the rail where it sits on each bearer, bolted through the rail + for y in (0.012, -0.33): + yy = y + 0.026 + strap_u(P, M, [(sx * 0.1093, yy, 0.0905), (sx * 0.1093, yy, 0.1292), (sx * 0.1607, yy, 0.1292), (sx * 0.1607, yy, 0.0905)], 0.02, 0.0026, (0, 1, 0), + bend=0.003) + head(P, Vector((sx * 0.162, yy, 0.108)), (sx, 0, 0), 0.0036, "hex", m=M.hw, ref=(0, 0, 1)) + dome8(P, Vector((sx * 0.1080, yy, 0.108)), (-sx, 0, 0), 0.0032, M.hw) + for y in (0.012, -0.33): + cbolt(P, M, Vector((sx * 0.135, y, 0.128)), (0, 0, 1), 0.0055, L=0.098) + for y in (-0.385, 0.135): + cbolt(P, M, Vector((sx * 0.135, y, 0.128)), (0, 0, 1), 0.0045) + # ---- grips; the throttle cable from the rear grip along the carriage, clipped, up to the carburettor + grip5(P, M, (0, 0, 0), tilt=12, h1=0.046) + ce = trigger5(P, M, y0=-0.033, z0=0.028, drop=0.05) + grip5(P, M, (0, -0.33, 0), tilt=0, h0=-0.07, h1=0.04) + E5, carb = engine5((0, 0.112, 0.295), M, s=0.92, pull=-1, tank=True, tilt=-6) + P += E5 + cp = [ce, (0.02, -0.05, 0.04), (0.06, -0.04, 0.06), (0.105, -0.01, 0.1), (0.112, 0.03, 0.17), (0.095, 0.05, 0.235), (0.05, 0.05, 0.27), carb + Vector((0.004, 0, 0))] + cable5(P, M, cp, clips=[], n=36) + for p, n in (((0.1062, -0.005, 0.12), (0.72, 0, -0.1)), ((0.1005, 0.035, 0.19), (0.5, 0, 0.6))): + head(P, Vector(p) - Vector(n).normalized() * 0.001, n, 0.0022, "dome", m=M.hw) + # the engine plate on the tube: a saddle casting, four bolts, a strap round the tube on each side + P.append(cast_block("seat", (0, 0.112, 0.0), 0.055, 0.065, 0.032, M.d1, z0=0.236, flare=0.06)) + for sx in (-1, 1): + for sy in (-1, 1): + q = washer(P, Vector((sx * 0.045, 0.112 + sy * 0.054, 0.268)), (0, 0, 1), 0.006, 0.0012, m=M.hw) + head(P, q, (0, 0, 1), 0.0034, "hex", m=M.hw, ref=(1, 0, 0)) + # ---- the tin hopper, leaning towards the operator: a riveted seam up its side, a rolled rim, a clamped neck band, two braces + HC = Vector((0, -0.145, 0.222)) + HF = Matrix.Translation(HC) @ Matrix.Rotation(DEG(-12), 4, "X") + hax = (HF.to_3x3() @ Vector((0, 0, 1))).normalized() + ho = FT.lathe("hopper", [(0.066, 0.0), (0.068, 0.032), (0.096, 0.075), (0.128, 0.128), (0.15, 0.17), (0.153, 0.178)], segs=28, m=M.tin, frame=HF, smooth_ang=70) + FT.around(ho, HC, hax, nu=3.0, s=6.0) + P.append(ho) + P.append(FT.lathe("hin", [(0.15, 0.178), (0.122, 0.134), (0.09, 0.09), (0.06, 0.05), (0.0, 0.05)], segs=28, m=M.d1, frame=HF)) + P.append(rev("hrim", [(0.149, -0.004), (0.157, -0.0055), (0.1635, -0.002), (0.165, 0.004), (0.161, 0.0095), (0.154, 0.0105), (0.149, 0.007)], + HF @ Vector((0, 0, 0.18)), hax, [M.st], segs=28, ang=50)) + P.append(rev("hband", [(0.066, -0.009), (0.072, -0.008), (0.0745, -0.004), (0.0745, 0.004), (0.072, 0.008), (0.066, 0.009)], HF @ Vector((0, 0, 0.022)), hax, + [M.red], segs=24, ang=50)) + ang_s = DEG(250) + sp = [HF @ Vector(((rr + 0.001) * math.cos(ang_s), (rr + 0.001) * math.sin(ang_s), z)) for rr, z in ((0.068, 0.035), (0.096, 0.075), (0.128, 0.128), (0.15, 0.168))] + P.append(sweep("hseam", resample(sp, 8), lambda s, i: [(-0.0004, -0.006), (0.0012, -0.0055), (0.0015, 0.0), (0.0012, 0.0055), (-0.0004, 0.006)], [M.tin], + ref=tuple(hax), ang=50)) + for k in range(5): + p = resample(sp, 4)[k] + nrm = (p - (HF @ Vector((0, 0, (HF.inverted() @ p).z)))).normalized() + rivet(P, p + nrm * 0.0012, nrm, 0.0026, m=M.brass) + for a in (35, 145): + ax = DEG(a) + top = HF @ Vector((0.156 * math.cos(ax), 0.156 * math.sin(ax), 0.17)) + bot = HF @ Vector((0.094 * math.cos(ax), 0.094 * math.sin(ax), 0.06)) + bot2 = Vector((bot.x * 1.08, bot.y, Z + 0.06)) + P.append(sweep("hbrace", fillet([top, bot, bot2], 0.02, 3), lambda s, i: rrect(0.009, 0.0022, 0.0016, 1), [M.d1], ref=(0, 1, 0), ang=40)) + for p in (top, bot2): + head(P, p + Vector((0, 0, 0.003)), (0, 0, 1), 0.0028, "hex", m=M.hw) + hp = FT.sphere("heap", 0.122, (0, 0, 0), seg=16, rings=8, m=M.clip, scale=(1.0, 1.0, 0.5)) + FT.wobble(hp, 0.018, 16.0, seed=1.0) + hp.data.transform(HF @ Matrix.Translation((0, 0, 0.158))) + uv_box(hp, 3.0) + hp["uv_done"] = True + P.append(hp) + ffin(P, "Body") + fan5("Fan", (0, -0.435, Z), 0.08, 0.026, 6, M, M.br, M.red) + empty("Nozzle", (0, -0.586, Z)) + return {} + + +# ======================================================================= SM_Tool_MegaSiphon (Tornado Mower) + +def ring5(name, A, sx, M, r=0.172): + """One half of the blade drum, |x| 0.034..0.216, built about local Y: a teal core with rolled ends, a red end disc with six bolts and + a domed hub nut, a navy flange with bolts, four helical blades (a real section, thin at the tip) bolted to root strips.""" + Q = [] + y0, y1 = sx * 0.034, sx * 0.216 + FR = FT.M_axis("Y" if sx > 0 else "-Y") + ax = Vector((0, sx, 0)) + Q.append(FT.lathe("core", [(0.0, 0.034), (0.072, 0.034), (0.077, 0.037), (0.078, 0.042), (0.078, 0.194), (0.077, 0.2), (0.072, 0.204), (0.0, 0.204)], + segs=18, m=M.teal, frame=FR, smooth_ang=40)) + Q.append(FT.lathe("disc", [(0.0, 0.2), (0.108, 0.2), (0.124, 0.2025), (0.128, 0.207), (0.128, 0.214), (0.122, 0.2185), (0.108, 0.22), (0.05, 0.222), (0.0, 0.224)], + segs=22, m=M.red, frame=FR, smooth_ang=40)) + Q.append(FT.lathe("flange", [(0.074, 0.111), (0.11, 0.111), (0.1155, 0.114), (0.1165, 0.118), (0.1155, 0.122), (0.11, 0.125), (0.074, 0.125)], + segs=18, m=M.d1, frame=FR, smooth_ang=40)) + for k in range(6): + a = TAU * (k + 0.5) / 6 + head(Q, FR @ Vector((0.085 * math.cos(a), 0.085 * math.sin(a), 0.2205)), ax, 0.0042, "hex", m=M.d1, ref=(1, 0, 0)) + hexnut(Q, FR @ Vector((0, 0, 0.2235)), ax, 0.016, 0.0035, m=M.d1, ref=(1, 0, 0)) + + for k in range(4): + th0 = TAU * k / 4 + (0.0 if sx > 0 else 0.4) + tw = 1.15 * sx + rings = [] + nu, nv = 6, 4 + for i in range(nu + 1): + u = i / nu + ring = [] + for side in (1, -1): + vs = [j / nv for j in range(nv + 1)] + if side < 0: + vs = vs[::-1] + for v in vs: + rho = 0.07 + (r - 0.07) * v + t = 0.0048 * (1 - 0.8 * v ** 2.2) + 0.0004 + a = th0 + tw * u - 0.55 * v * v + side * t / rho + ring.append(FR @ Vector((rho * math.cos(a), rho * math.sin(a), 0.034 + 0.182 * u))) + rings.append(ring) + Q.append(rings_mesh("cut", rings, [M.br], ang=38)) + + def fn2(u, v, off, th0=th0, tw=tw): + rr = 0.078 + 0.03 * v + return FR @ Vector((rr * math.cos(th0 + tw * u + off / 0.09), rr * math.sin(th0 + tw * u + off / 0.09), 0.034 + 0.182 * u)) + Q.append(FT.grid_slab("root", fn2, 6, 1, 0.0095, -0.0095, M.d1, smooth_ang=35)) + for u in (0.25, 0.75): + + p = fn2(u, 0.62, 0.0) + c = FR @ Vector((0, 0, 0.034 + 0.182 * u)) + tang = (fn2(u, 0.62, 0.001) - p).normalized() + head(Q, p + tang * 0.0098, tang, 0.0032, "hex", m=M.d1) + o = FT.spinner(Q, name, A, (1, 0, 0), uv=4.0, ang=38) + weighted(o) + return o + + +def mega_siphon(): + M = FM + P = [] + A = Vector((0, -0.445, 0.158)) + # ---- the timber chassis: two side rails, three cross bearers under them, a deck of four planks; chamfered edges, end grain at + # the sawn ends, the planks' chamfers meeting in V seams; forged straps over the rails at the bearers, bolted + for sx in (-1, 1): + x0, x1 = sorted((sx * 0.172, sx * 0.226)) + timber5(P, M, (x0, -0.26, 0.09), (x1, 0.268, 0.15), 1, ch=0.006, s=1.6, off=(0.1 * sx, 0.2), seed=3 + sx) + for y, w in ((0.0, 0.04), (-0.25, 0.04), (0.235, 0.032)): + timber5(P, M, (-0.176, y - w, 0.074), (0.176, y + w, 0.13), 0, ch=0.005, s=1.6, off=(0.13 + y, 0.0), seed=int(y * 100) + 9, ends=(False, False)) + for sx in (-1, 1): + for y in (0.0, 0.235): + strap_u(P, M, [(sx * 0.18, y, 0.1514), (sx * 0.2275, y, 0.1514), (sx * 0.2275, y, 0.094)], 0.024, 0.0028, (0, 1, 0), bend=0.003) + head(P, Vector((sx * 0.2289, y, 0.112)), (sx, 0, 0), 0.0042, "hex", m=M.hw, ref=(0, 0, 1)) + for y in (0.0, -0.25, 0.235): + cbolt(P, M, Vector((sx * 0.199, y, 0.15 + (0.0028 if y > -0.1 else 0.0))), (0, 0, 1), 0.0062) + for k, x in enumerate((-0.126, -0.042, 0.042, 0.126)): + timber5(P, M, (x - 0.0398, -0.17, 0.13), (x + 0.0398, 0.21, 0.152), 1, ch=0.0032, s=1.5, off=(0.25 * k, 0.15 * k), seed=20 + k, bow=0.0007) + for y in (-0.15, 0.19): + if abs(x) > 0.1 or y > 0: + dome8(P, Vector((x, y, 0.152)), (0, 0, 1), 0.0032, M.hw) + grip5(P, M, (0, 0, 0), tilt=12, h1=0.078) + ce = trigger5(P, M, y0=-0.034, z0=0.046, drop=0.05) + grip5(P, M, (0, -0.25, 0), tilt=0, h0=-0.07, h1=0.078) + E5, carb = engine5((-0.062, 0.05, 0.205), M, s=1.06, pull=1, tank=True, stack=True) + P += E5 + cable5(P, M, [ce, (0.02, -0.05, 0.07), (0.035, -0.06, 0.12), (0.03, -0.05, 0.16), (0.0, -0.04, 0.18), (-0.03, -0.035, 0.2), carb + Vector((0.004, 0, 0))], + clips=[], n=24) + # ---- chain case: a cast cover over the chain from the engine's sprocket down to the drum's. The two halves meet at a flange + # round the edge, bolted; each side is domed over the sprockets, stiffened by two ribs along the run, an inspection cover between. + # At the drum the case runs into the round sprocket housing, bolted round its face, a breather on top. + Cr, rr0 = (-0.005, 0.196), 0.04 + Cf, rf0 = (A.y, A.z), 0.058 + circ_pts = [(Cr[0] + rr0 * math.cos(TAU * k / 20), Cr[1] + rr0 * math.sin(TAU * k / 20)) for k in range(20)] + circ_pts += [(Cf[0] + rf0 * math.cos(TAU * k / 24), Cf[1] + rf0 * math.sin(TAU * k / 24)) for k in range(24)] + base = densify2d(hull2d(circ_pts), 0.06) + Fx = Matrix(((0, 0, 1, 0), (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 0, 1))) # local (y, z) outline, x -> world + + def ring_at(out, x): + return [Vector((x, u, v)) for u, v in out] + lip, sh1, sh2 = offset2d(base, 0.006), offset2d(base, -0.005), offset2d(base, -0.009) + rings = [ring_at(sh2, -0.0165), ring_at(sh1, -0.0152), ring_at(base, -0.008), ring_at(base, -0.0055), ring_at(lip, -0.0045), ring_at(lip, 0.0045), + ring_at(base, 0.0055), ring_at(base, 0.008), ring_at(sh1, 0.0152), ring_at(sh2, 0.0165)] + P.append(rings_mesh("chaincase", rings, [M.red], ang=40)) + # bolts through the flange, heads on the near side, nuts on the far + nb_ = len(base) + for k in range(0, nb_, max(1, nb_ // 9)): + u, v = offset2d(base, 0.0032)[k] + if math.hypot(u - A.y, v - A.z) < 0.185: + continue # inside the drum, among the blades + for sx in (-1, 1): + if sx > 0: + head(P, Vector((0.0045, u, v)), (1, 0, 0), 0.0021, "hex", m=M.hw, ref=(0, 0, 1)) + else: + hexnut(P, Vector((-0.0045, u, v)), (-1, 0, 0), 0.0038, 0.0028, m=M.hw, ref=(0, 0, 1)) + # the domes over the rear sprocket, a bearing cap and its screws + for sx in (-1, 1): + c = Vector((sx * 0.0162, Cr[0], Cr[1])) + P.append(rev("sdome", [(rr0 * 0.86, -0.001), (rr0 * 0.84, 0.0022), (rr0 * 0.7, 0.0048), (rr0 * 0.45, 0.0062), (rr0 * 0.36, 0.0064)], c, (sx, 0, 0), + [M.red], segs=16, ref=(0, 0, 1), ang=45)) + P.append(rev("scap", [(rr0 * 0.36, 0.006), (rr0 * 0.34, 0.0085), (rr0 * 0.26, 0.0098), (0.0, 0.01)], c, (sx, 0, 0), [M.d1], segs=12, ref=(0, 0, 1), ang=45)) + for k in range(3): + a = TAU * k / 3 + 0.5 + dome8(P, c + Vector((sx * 0.0087, 0.0, 0.0)) + Vector((0, rr0 * 0.22 * math.cos(a), rr0 * 0.22 * math.sin(a))), (sx, 0, 0), 0.0012, M.hw) + # two stiffening ribs along the run, from the dome to the drum housing, faded in at their ends + d_ = Vector((0, Cf[0] - Cr[0], Cf[1] - Cr[1])).normalized() + nrm_ = Vector((0, -d_.z, d_.y)) + for off in (-0.017, 0.017): + p0 = Vector((sx * 0.0162, Cr[0], Cr[1])) + d_ * (rr0 * 0.95) + nrm_ * off + p1 = Vector((sx * 0.0162, Cf[0], Cf[1])) - d_ * (rf0 * 1.02) + nrm_ * off * 1.2 + C = [p0.lerp(p1, k / 4) for k in range(5)] + + def ribsec(s, i): + k = min(1.0, s * 6, (1 - s) * 6) + hh = 0.0035 * k + 0.0003 + return [(0.0042, -0.0006), (0.0026, hh * 0.8), (0.0, hh), (-0.0026, hh * 0.8), (-0.0042, -0.0006)] + P.append(sweep("crib", C, lambda s, i: [(q[1], q[0]) for q in ribsec(s, i)], [M.red], ref=(sx, 0, 0), ang=50)) + # the inspection cover between the ribs, four screws + cv = Vector((sx * 0.0162, -0.2, 0.0)) + Vector((0, 0, Cr[1] + (Cf[1] - Cr[1]) * ((-0.2 - Cr[0]) / (Cf[0] - Cr[0])))) + P.append(bprism("inspect", rounded_outline([(-0.028, -0.011), (0.028, -0.011), (0.028, 0.011), (-0.028, 0.011)], 0.007, 2), -0.0005, 0.0026, + [M.d1, M.st], bev=0.0008, segs=1, bev_slot=1, frame=fz(cv, (sx, 0, 0), d_))) + for du in (-0.021, 0.021): + for dv in (-0.0055, 0.0055): + dome8(P, cv + Vector((sx * 0.0026, 0, 0)) + d_ * du + nrm_ * dv, (sx, 0, 0), 0.0013, M.hw) + P.append(rev("filler", [(0.0, 0.0), (0.009, 0.0), (0.0095, 0.004), (0.0085, 0.008), (0.0, 0.0085)], Vector((0, -0.08, 0.2335)), (0, 0.08, 1), [M.brass], segs=10, + mod=lambda i, a: 1.0 + (0.08 * math.cos(8 * a) if i in (1, 2) else 0.0))) + # the drum's sprocket housing: a round casting about the drum axis, a rolled rim, six bolts round each face, a breather on top + P.append(rev("gearbox", [(0.0, -0.027), (0.046, -0.027), (0.054, -0.025), (0.059, -0.019), (0.061, -0.012), (0.061, 0.012), (0.059, 0.019), (0.054, 0.025), + (0.046, 0.027), (0.0, 0.027)], A, (1, 0, 0), [M.d1], segs=20, ref=(0, 0, 1), ang=40)) + for sx in (-1, 1): + for k in range(6): + a = TAU * (k + 0.5) / 6 + head(P, A + Vector((sx * 0.027, 0.047 * math.cos(a), 0.047 * math.sin(a))), (sx, 0, 0), 0.0024, "hex", m=M.hw, ref=(0, 0, 1)) + P.append(rev("breather", [(0.0, 0.0), (0.004, 0.0), (0.004, 0.008), (0.0075, 0.009), (0.0075, 0.013), (0.0, 0.014)], A + Vector((0, 0.012, 0.0595)), (0, 0, 1), + [M.brass], segs=8)) + # ---- the red side arms bolted outside the rails, bearing housings with three bolts and a grease nipple, skids on bolted hangers + arm = [(-0.08, 0.158), (-0.08, 0.082), (-0.2, 0.082), (-0.445 + 0.03, 0.1), (-0.445 + 0.052, 0.13), (-0.445 + 0.06, 0.16), (-0.445 + 0.04, 0.2), (-0.445, 0.218), + (-0.445 - 0.042, 0.2), (-0.445 - 0.06, 0.158), (-0.445 - 0.042, 0.116), (-0.445 - 0.01, 0.1), (-0.32, 0.17), (-0.2, 0.172)] + ao = rounded_outline(arm, 0.01, 2) + for sx in (-1, 1): + P.append(bprism("arm", ao, 0.226 * sx, 0.244 * sx, [M.red, M.red], bev=0.0035, segs=1, frame=Fx)) + P.append(rev("bearing", [(0.0, 0.243), (0.03, 0.243), (0.046, 0.2445), (0.05, 0.2475), (0.05, 0.25), (0.044, 0.2525), (0.028, 0.2535), (0.02, 0.2565), (0.0, 0.257)], + Vector((0, A.y, A.z)), (sx, 0, 0), [M.d1], segs=14)) + for k in range(3): + a = TAU * k / 3 + 0.5 + head(P, Vector((sx * 0.2533, A.y + 0.037 * math.cos(a), A.z + 0.037 * math.sin(a))), (sx, 0, 0), 0.003, "hex", m=M.hw, ref=(0, 0, 1)) + P.append(rev("grease", [(0.0, 0.0), (0.0035, 0.0), (0.0035, 0.004), (0.0025, 0.0055), (0.0025, 0.008), (0.003, 0.009), (0.0, 0.0105)], + Vector((sx * 0.247, A.y, A.z + 0.049)), (0, 0, 1), [M.brass], segs=6)) + for y in (-0.1, -0.16, -0.25): + hbolt(P, M, Vector((sx * 0.2445, y, 0.135 if y > -0.2 else 0.13)), (sx, 0, 0), 0.0725, 0.0042, ref=(0, 0, 1), nut=False) + sk = [Vector((sx * 0.235, -0.27, 0.09)), Vector((sx * 0.235, -0.45, -0.004)), Vector((sx * 0.235, -0.58, 0.0)), Vector((sx * 0.235, -0.655, 0.05))] + P.append(sweep("skid", resample(sk, 16, per=6), lambda s, i: circ(0.0115, 8), [M.st], ref=(1, 0, 0), ang=40)) + hk = resample(sk, 16, per=6)[7] + + P.append(sweep("hanger", [hk + Vector((0, 0, 0.004)), Vector((sx * 0.235, hk.y + 0.02, 0.085))], lambda s, i: rrect(0.003, 0.01, 0.002, 1), [M.d1], + ref=(1, 0, 0), ang=40)) + hbolt(P, M, Vector((sx * 0.2445, hk.y + 0.02, 0.09)), (sx, 0, 0), 0.0125, 0.0034, ref=(0, 0, 1), thr=0.003) + # ---- the deflector behind the drum: tin, a rolled top rim, rivets along its ends, stays bolted to the arms + D_R = 0.19 + + def defl(u, v, off): + a = DEG(-34 + 54 * u) + rr = D_R + off + return Vector((-0.216 + 0.432 * v, A.y + rr * math.cos(a), A.z + rr * math.sin(a))) + d = FT.grid_slab("deflector", defl, 8, 6, 0.0025, -0.0025, M.tin, smooth_ang=60) + FT.grain(d, (0, 0.5, 0.5), 4.0) + P.append(d) + ptop = defl(1.0, 0.0, 0.0) + P.append(tube5("deflrim", [ptop + Vector((-0.004, 0, 0)), Vector((-ptop.x + 0.004, ptop.y, ptop.z))], 0.0085, M.st, segs=10)) + for v in (0.0, 1.0): + for u in (0.15, 0.5, 0.85): + p = defl(u, v, 0.003) + nrm = (p - Vector((p.x, A.y, A.z))).normalized() + rivet(P, p + Vector((0.006 if v == 0 else -0.006, 0, 0)), nrm, 0.0026, m=M.brass) + ffin(P, "Body") + ring5("Ring1", A, 1, M) + ring5("Ring2", A, -1, M) + empty("Nozzle", (0, -0.656, 0.158)) + return {} + + +# ======================================================================= main: build + +BUILDERS = {"SM_Tool_LawnMower": lawn_mower, "SM_Tool_HandPump": hand_pump, "SM_Tool_SlurpGun": slurp_gun, "SM_Tool_HydroCannon": hydro_cannon, + "SM_Tool_MegaSiphon": mega_siphon} +BUDGET = {"SM_Tool_LawnMower": 25000, "SM_Tool_HandPump": 25000, "SM_Tool_SlurpGun": 25000, "SM_Tool_HydroCannon": 25000, "SM_Tool_MegaSiphon": 25000} + + +def build(names): + import zlib + common.MODELS = os.path.join(OUT, "fbx") + common.BLENDS = OUT + common.PREVIEWS = os.path.join(OUT, "previews") + for d in (common.MODELS, common.PREVIEWS): + os.makedirs(d, exist_ok=True) + for n in names: + common.reset() + random.seed(zlib.crc32(n.encode()) & 0xffff) + BUILDERS[n]() + bpy.context.view_layer.update() + t = tri_count() + for o in sorted(bpy.context.scene.objects, key=lambda o: o.name): + mats = sorted(set(m.name for m in o.data.materials if m)) if o.type == "MESH" else [] + print(f"[{n}] {o.type:6s} {o.name:10s} tris={tri_count([o]) if o.type == 'MESH' else '-':>6} loc={tuple(round(v, 4) for v in o.location)}" + f" rot={tuple(round(math.degrees(v), 2) for v in o.rotation_euler)} mats={mats}") + print(f"[{n}] tris={t} budget={BUDGET.get(n)} {'OVER' if t > BUDGET.get(n, 1 << 30) else 'ok'}", flush=True) + common.export(n) + common.save_blend(n) + print(f"[{n}] done", flush=True) + + +# ======================================================================= review: verify, views, compose + +# object -> bounding box tolerance (m) per side against the game model +BB_TOL = {"Body": 0.02} +BB_TOL_PART = 0.012 + + +def _K(): + for _ in range(8): + try: + import gc_up5_check as K + return K + except Exception as e: # noqa: BLE001 + print("gc_up5_machines: import gc_up5_check failed, retrying in 60 s:", repr(e), flush=True) + time.sleep(60) + raise RuntimeError("gc_up5_check would not import") + + +def snap(path): + """objects -> (type, parent, loc, rot (deg), scale, bbox min, bbox max, tris, slots, local axes)""" + bpy.ops.wm.read_factory_settings(use_empty=True) + bpy.ops.import_scene.fbx(filepath=path) + bpy.context.view_layer.update() + out = {} + for o in bpy.context.scene.objects: + mw = o.matrix_world + if o.type == "MESH": + ws = [mw @ v.co for v in o.data.vertices] + mn = Vector([min(w[i] for w in ws) for i in range(3)]) + mx = Vector([max(w[i] for w in ws) for i in range(3)]) + tris = sum(len(p.vertices) - 2 for p in o.data.polygons) + mats = sorted(set(m.name.split(".")[0] for m in o.data.materials if m)) + else: + mn = mx = mw.translation.copy() + tris, mats = 0, [] + R = mw.to_3x3().normalized() + out[o.name.split(".")[0]] = dict(type=o.type, parent=o.parent.name.split(".")[0] if o.parent else None, loc=mw.translation.copy(), + rot=Vector([math.degrees(a) for a in mw.to_euler()]), scale=mw.to_scale(), mn=mn, mx=mx, tris=tris, mats=mats, + axes=[R.col[i].copy() for i in range(3)]) + return out + + +def verify(names): + bad_total = 0 + for n in names: + old = snap(os.path.join(GAME, n + ".fbx")) + new = snap(os.path.join(OUT, "fbx", n + ".fbx")) + bad = 0 + print(f"VM|{n}") + if set(old) != set(new): + print(f"VM| FAIL objects differ: old {sorted(old)} new {sorted(new)}") + bad += 1 + allowed = set(m for o in old.values() for m in o["mats"]) + for k in sorted(set(old) & set(new)): + o, w = old[k], new[k] + dloc = (o["loc"] - w["loc"]).length + drot = max(abs(a - b) for a, b in zip(o["rot"], w["rot"])) + dsc = max(abs(a - b) for a, b in zip(o["scale"], w["scale"])) + dax = max((a - b).length for a, b in zip(o["axes"], w["axes"])) + ok = o["type"] == w["type"] and o["parent"] == w["parent"] and dloc < 1e-4 and drot < 1e-3 and dsc < 1e-4 and dax < 1e-4 + print(f"VM| {'ok ' if ok else 'FAIL'} {k:<9} {w['type']:<5} parent {w['parent']} origin {tuple(round(x, 4) for x in w['loc'])} (d {dloc:.1e}) " + f"rot {tuple(round(x, 2) for x in w['rot'])} (d {drot:.1e}) scale d {dsc:.1e} axes d {dax:.1e}") + bad += 0 if ok else 1 + if w["type"] == "MESH": + tol = BB_TOL.get(k, BB_TOL_PART) + dmn = [b - a for a, b in zip(o["mn"], w["mn"])] + dmx = [b - a for a, b in zip(o["mx"], w["mx"])] + worst = max(abs(x) for x in dmn + dmx) + okb = worst <= tol + bad += 0 if okb else 1 + f = lambda v: "(" + ", ".join(f"{x:+.3f}" for x in v) + ")" + print(f"VM| {'ok ' if okb else 'FAIL'} bbox old {tuple(round(x, 3) for x in o['mn'])}..{tuple(round(x, 3) for x in o['mx'])}") + print(f"VM| new {tuple(round(x, 3) for x in w['mn'])}..{tuple(round(x, 3) for x in w['mx'])} d min {f(dmn)} d max {f(dmx)} (tol {tol})") + extra = sorted(set(w["mats"]) - set(o["mats"])) + foreign = sorted(set(w["mats"]) - allowed) + nomat = sorted(m for m in w["mats"] if not os.path.exists(os.path.join(ROOT, "Assets", "Art", "Materials", m + ".mat"))) + print(f"VM| tris {o['tris']} -> {w['tris']} slots {w['mats']}") + print(f"VM| slots new to this object: {extra or 'none'} new to the model: {foreign or 'none'} without a .mat: {nomat or 'none'}") + if nomat or any(m.startswith("P_") for m in w["mats"]): + bad += 1 + tot_o = sum(o["tris"] for o in old.values()) + tot_n = sum(o["tris"] for o in new.values()) + over = tot_n > BUDGET.get(n, 1 << 30) + bad += 1 if over else 0 + print(f"VM| total tris {tot_o} -> {tot_n} (budget {BUDGET.get(n)}) {'OVER' if over else 'ok'}") + print(f"VM| {n}: {'OK' if bad == 0 else f'{bad} problem(s)'}") + bad_total += bad + print("VM|RESULT|" + ("OK" if bad_total == 0 else f"{bad_total} problem(s)")) + + +# (tag, target or None for the whole model, radius, elev, azim) +VIEWS = { + "SM_Tool_LawnMower": [("full", None, None, 28, -38), ("back", None, None, 30, 145), ("engine", (0.0, -0.86, -0.6), 0.2, 35, -35), + ("plug", (0.0, -1.0, -0.65), 0.08, 25, -30), ("grip", (0.18, -0.04, -0.02), 0.13, 30, 160), + ("wheel", (0.57, -1.08, -0.85), 0.12, 15, 70), ("lever", (0.54, -0.5, -0.8), 0.12, 20, 110), + ("bracket", (0.4, -0.47, -0.71), 0.09, 35, 140), ("bag", (0.05, -0.2, -0.75), 0.24, 25, 160), + ("under", (0.0, -0.8, -0.89), 0.4, -40, -20), ("deck", (0.0, -0.78, -0.72), 0.34, 42, -150), + ("deck_f", (0.1, -0.95, -0.72), 0.22, 30, -20)], + "SM_Tool_HandPump": [("full", None, None, 28, -40), ("back", None, None, 22, 150), ("gearbox", (0.0, 0.02, 0.07), 0.12, 30, 60), + ("bar", (0.0, -0.3, -0.03), 0.16, 40, -60), ("bar_under", (0.0, -0.3, -0.03), 0.16, -35, -50), ("bag", (0.0, 0.08, 0.2), 0.13, 35, 50), + ("buckle", (0.09, 0.08, 0.18), 0.07, 15, 75), ("grip", (0.0, 0.0, 0.0), 0.09, 10, -70), ("grip_b", (0.0, 0.02, 0.02), 0.08, 25, 140), + ("flange", (0.06, 0.06, 0.07), 0.09, 20, 70), ("handle", (0.0, 0.27, 0.07), 0.1, 30, 160)], + "SM_Tool_SlurpGun": [("full", None, None, 22, -40), ("back", None, None, 20, 155), ("engine", (0.0, 0.13, 0.2), 0.12, 25, 60), + ("engine_l", (0.0, 0.13, 0.19), 0.12, 20, -70), ("plug", (0.0, 0.13, 0.32), 0.06, 35, 30), ("jar", (0.0, -0.065, 0.25), 0.11, 20, -40), + ("grip", (0.0, 0.0, 0.02), 0.09, 10, -80), ("head", (0.0, -0.66, -0.12), 0.16, 30, -50), ("head_under", (0.0, -0.66, -0.15), 0.16, -40, -30), + ("loop", (0.0, -0.215, 0.14), 0.12, 25, 140)], + "SM_Tool_HydroCannon": [("full", None, None, 24, -40), ("back", None, None, 20, 155), ("engine", (0.0, 0.11, 0.38), 0.13, 25, 120), + ("engine_r", (0.0, 0.11, 0.37), 0.13, 20, -70), ("hopper", (0.0, -0.15, 0.36), 0.18, 40, 150), ("mouth", (0.0, -0.5, 0.143), 0.2, 10, -15), + ("carriage", (0.135, -0.33, 0.11), 0.09, 30, 60), ("rails", (0.0, -0.15, 0.08), 0.26, 35, 130) +, ("grip", (0.0, -0.02, 0.0), 0.09, 10, -80), ("fan", (0.0, -0.44, 0.143), 0.1, 5, -5), ("lockout", (0.0, 0.03, 0.02), 0.05, 15, -120)], + "SM_Tool_MegaSiphon": [("full", None, None, 26, -40), ("back", None, None, 22, 155), ("engine", (-0.06, 0.05, 0.3), 0.15, 25, 120), + ("stack", (-0.15, 0.05, 0.38), 0.08, 20, 140), ("drum", (0.0, -0.45, 0.16), 0.2, 20, -40), ("hub", (0.24, -0.445, 0.158), 0.09, 15, 80), + ("chain", (0.0, -0.2, 0.18), 0.17, 30, -70), ("chain_r", (0.0, -0.15, 0.19), 0.12, 25, 80), ("rail", (0.2, 0.18, 0.13), 0.1, 30, 130), ("grip", (0.0, -0.02, 0.02), 0.09, 10, -80), ("deck", (0.08, 0.05, 0.16), 0.16, 50, -30)], +} +# first-person cameras: (eye, look-at, vertical fov) in the model's own frame +FPV = {"SM_Tool_LawnMower": [("fpv", (0.0, 0.33, 0.47), (0.0, -1.1, -0.5), 60)]} +# the old ViewModel holds of the four farm machines (verify_farm_tools.RIGS): Unity position, euler, scale +HOLDS = {"SM_Tool_HandPump": ((0.19, -0.2, 0.46), (-2, -4, 0), 0.6), "SM_Tool_SlurpGun": ((0.2, -0.21, 0.48), (-2, -4, 0), 0.56), + "SM_Tool_HydroCannon": ((0.2, -0.22, 0.5), (-1, -4, 0), 0.5), "SM_Tool_MegaSiphon": ((0.21, -0.23, 0.54), (-1, -4, 0), 0.46)} + + +def studio_world(strength=0.6): + """Replace gc_up5_check's flat sky-blue world with a studio one: a dark floor below the horizon, a cool sky above. Polished steel + then reflects something other than the backdrop behind it (in the flat world the combs vanished against it).""" + w = bpy.context.scene.world + nt = w.node_tree + bg = nt.nodes.get("Background") + tc = nt.nodes.new("ShaderNodeTexCoord") + sep = nt.nodes.new("ShaderNodeSeparateXYZ") + mr = nt.nodes.new("ShaderNodeMapRange") + mr.inputs["From Min"].default_value = -1.0 + mr.inputs["From Max"].default_value = 1.0 + ramp = nt.nodes.new("ShaderNodeValToRGB") + el = ramp.color_ramp.elements + el[0].position, el[0].color = 0.46, (0.085, 0.08, 0.075, 1) + el[1].position, el[1].color = 1.0, (0.62, 0.72, 0.84, 1) + e2 = el.new(0.52) + e2.color = (0.36, 0.38, 0.4, 1) + nt.links.new(tc.outputs["Generated"], sep.inputs[0]) + nt.links.new(sep.outputs[2], mr.inputs["Value"]) + nt.links.new(mr.outputs[0], ramp.inputs[0]) + nt.links.new(ramp.outputs[0], bg.inputs[0]) + bg.inputs[1].default_value = strength + + +def views(names): + K = _K() + os.makedirs(PANELS, exist_ok=True) + tags = os.environ.get("GC5_VIEWS") + only = os.environ.get("GC5_ONLY") + for n in names: + bpy.ops.wm.read_factory_settings(use_empty=True) + objs = K.load_fbx(os.path.join(OUT, "fbx", n + ".fbx")) + mn, mx = K.bounds(objs) + full = ((mn + mx) / 2, (mx - mn).length / 2 * 0.72) + for which, path in (("old", os.path.join(GAME, n + ".fbx")), ("new", os.path.join(OUT, "fbx", n + ".fbx"))): + if only and which != only: + continue + bpy.ops.wm.read_factory_settings(use_empty=True) + K.load_fbx(path) + K.lights() + studio_world() + for tag, tgt, rad, el, az in VIEWS.get(n, []): + if tags and tag not in tags.split(","): + continue + t, r = (full if tgt is None else (Vector(tgt), rad)) + K.shoot(os.path.join(PANELS, f"{n}_{tag}_{which}.png"), t, r, el, az) + for tag, eye, look, fov in FPV.get(n, []): + if tags and tag not in tags.split(","): + continue + sc = bpy.context.scene + cd = bpy.data.cameras.new("c") + cd.sensor_fit = "VERTICAL" + cd.angle = math.radians(fov) + cd.clip_start = 0.01 + cam = common.link(bpy.data.objects.new("c", cd)) + cam.location = Vector(eye) + cam.rotation_euler = (Vector(look) - Vector(eye)).to_track_quat("-Z", "Y").to_euler() + sc.camera = cam + sc.render.resolution_x, sc.render.resolution_y = 1280, 720 + sc.render.filepath = os.path.join(PANELS, f"{n}_{tag}_{which}.png") + bpy.ops.render.render(write_still=True) + bpy.data.objects.remove(cam) + if n in HOLDS and (not tags or "fpv" in tags.split(",")): + hold_shot(n, path, os.path.join(PANELS, f"{n}_fpv_{which}.png")) + bpy.ops.wm.read_factory_settings(use_empty=True) + K.load_fbx(path) + K.lights() + studio_world() + + +def hold_shot(n, path, out): + """The tool where the old ViewModel held it: the overlay camera at the origin looking down Blender -Y (Unity +Z), 62 degrees.""" + K = _K() + pos, eu, sc_ = HOLDS[n] + Mc = Matrix(((-1, 0, 0, 0), (0, 0, -1, 0), (0, 1, 0, 0), (0, 0, 0, 1))) + rig = Matrix.Translation(Vector(pos)) @ (Matrix.Rotation(math.radians(eu[1]), 4, "Y") @ Matrix.Rotation(math.radians(eu[0]), 4, "X") + @ Matrix.Rotation(math.radians(eu[2]), 4, "Z")) @ Matrix.Scale(sc_, 4) + W = Mc @ rig @ Mc.inverted() + bpy.ops.wm.read_factory_settings(use_empty=True) + K.load_fbx(path, W) + K.lights((0.55, 0.72, 0.42), 0.7) + studio_world(0.7) + sc = bpy.context.scene + cd = bpy.data.cameras.new("c") + cd.sensor_fit = "VERTICAL" + cd.angle = math.radians(62) + cd.clip_start = 0.01 + cam = common.link(bpy.data.objects.new("c", cd)) + cam.rotation_euler = (math.radians(90), 0, math.pi) + sc.camera = cam + sc.render.resolution_x, sc.render.resolution_y = 1280, 720 + sc.render.filepath = out + bpy.ops.render.render(write_still=True) + + +def compose(names): + from PIL import Image, ImageDraw, ImageFont + try: + font = ImageFont.truetype("arial.ttf", 26) + small = ImageFont.truetype("arial.ttf", 20) + except Exception: # noqa: BLE001 + font = small = ImageFont.load_default() + made = [] + for fn in sorted(os.listdir(PANELS)): + if not fn.endswith("_new.png") or not any(fn.startswith(n + "_") for n in names): + continue + key = fn[:-len("_new.png")] + b = os.path.join(PANELS, fn) + a = os.path.join(PANELS, key + "_old.png") + B = Image.open(b).convert("RGB") + A = Image.open(a).convert("RGB") if os.path.exists(a) else Image.new("RGB", B.size, (40, 40, 40)) + w, h = B.size + bar = 44 + im = Image.new("RGB", (w * 2 + 8, h + bar), (30, 32, 36)) + im.paste(A, (0, bar)) + im.paste(B, (w + 8, bar)) + d = ImageDraw.Draw(im) + d.text((14, 9), "game", fill=(230, 230, 230), font=font) + d.text((w + 22, 9), "round 5", fill=(255, 214, 120), font=font) + d.text((w * 2 + 8 - 14 - d.textlength(key, font=small), 13), key, fill=(170, 170, 170), font=small) + out = os.path.join(OUT, "previews", key + ".png") + im.save(out) + made.append(out) + print("\n".join(made)) + + +if __name__ == "__main__": + args = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else sys.argv[1:] + mode = args[0] if args and args[0] in ("build", "verify", "views", "compose") else "build" + names = [a for a in args if a in NAMES] or ([n for n in NAMES if n in BUILDERS] if IN_BLENDER else NAMES) + if mode == "compose": + compose(names) + elif mode == "verify": + verify(names) + elif mode == "views": + views(names) + else: + build([n for n in names if n in BUILDERS]) diff --git a/ArtSource/Blender/scripts/gc_up5_props.py b/ArtSource/Blender/scripts/gc_up5_props.py new file mode 100644 index 0000000..c58b26d --- /dev/null +++ b/ArtSource/Blender/scripts/gc_up5_props.py @@ -0,0 +1,1822 @@ +"""GRASS CUTTER - round 5 detail pass on the first-person hand-held props: SM_HandCan, SM_HandCigar, SM_Phone, SM_PhoneHand. + +Same level of detail as the round 5 pilot (gc_up5_tools.py), same frames as the models they replace: + + SM_HandCan gc_vend.hand_can. Hand (right hand round the can) and Can (with child Tab, origin on its rivet at z = TOPZ). + Can: a smooth 48-sided body with the GRASS BEER label, a tapered heel and a domed bottom on a standing bead, + a die-necked shoulder, a rolled double-seam rim, a recessed lid (chuck wall, countersink, panel bead, rivet button, + the scored opening with its stiffening bead). Tab: a stay-on ring pull with curled edges, a finger hole and a domed rivet. + SM_HandCigar gc_vend.hand_cigar. Hand, Cigar (turned 90 degrees about Z, SM_Cigar's frame), Ember (child of Cigar, at the +X tip). + Cigar: a helical wrapper seam with leaf veins, a rounded cap with its cap line and a cut, a raised band with gold beads + and a red seal, an ash end with a jagged burn line; Ember: a crusty glowing coal. + Hands the same finger centre lines, radii and contact points as gc_vend; the skin is one blended surface (voxel remesh of + the palm, fingers, thumb and wrist, then decimated) with knuckle creases, knuckle wrinkles, cuticles and fingernails. + The shirt cuff has a rolled edge, a top-stitch groove, a seam where it meets the sleeve, a placket and a button with + its thread; the sleeve has pleats at the cuff, drape folds and a seam welt. + SM_Phone gc_phone. One body mesh (the game's Phone.cs takes the one non-Screen renderer as the body and finds the glow slot by + name) and the child Screen, built by gc_phone.screen() itself so its position, size, winding and UVs are untouched. + Body: a rugged bumper band with a rounded section, raised lips over the glass and the back, corner guards that stand + proud of the lips with a screw in each, a chamfered bezel with the light line round the display, the light line round + the band, side buttons with chamfers, grip ridges and guard fences, a USB-C port with its tongue, speaker and mic holes + (boolean cuts), a speaker grille on the back, a two-step camera bump with three lens stacks (metal ring, retaining + ring, black ring, domed glass), screws on the bump, cooling ribs, the company mark and a ribbed antenna. + SM_PhoneHand gc_phone_hand. The left hand round the phone, in the phone's frame (origin and axes of SM_Phone), one object. + As the brief asks it is the work glove: a blended leather glove (fingers lifted just clear of the new bumper), side + seam welts on every finger, padded knuckle guards over the knuckles and the middle joints with stitching round them, + reinforced fingertips, a thumb patch, a leather gauntlet with a rolled edge, a strap and a brass buckle, then the bare + forearm and the shirt cuff and sleeve. To clear the new bumper (verify: no intersecting triangles) the glove's thenar sits + 5 mm further behind the phone, the thumb runs 1-2 mm further out along the left edge, and the wrist/gauntlet root is + dropped 7 mm behind the bottom-left corner (gc_phone_hand's own hand already dipped into the old phone there). gc_phone_hand.py itself is bare (M_CrewSkin): GC5_PHONEHAND_BARE=1 builds a + bare version with nails and creases instead. SM_PhoneHand is not in Assets/Art/Models and no game code loads it, so its + reference is gc_phone_hand.py's own build. + +Material slots stay the ones the game FBX uses (M_ materials, all existing .mat files). No pack parts. +Blender space: metres, Z up, front -Y (Unity +Z), Unity +X = Blender -X. The hands and the phone are seen from +Y. + +Output (never Assets): ArtSource/Blender/remaster_v3_tools/.blend, fbx/.fbx, previews/_.png. +Run (absolute paths, one Blender per command): + blender -b --factory-startup --python C:/Github/Grass-Cutters/ArtSource/Blender/scripts/gc_up5_props.py -- build [names] + blender -b --factory-startup --python .../gc_up5_props.py -- verify [names] frame against Assets/Art/Models (+ Screen UVs, clipping) + blender -b --factory-startup --python .../gc_up5_props.py -- views [names] old | new panels -> previews/_panels + blender -b --factory-startup --python .../gc_up5_props.py -- fpv [names] the in-game first-person poses (TreatHand, Phone) + python C:/Github/Grass-Cutters/ArtSource/Blender/scripts/gc_up5_props.py compose [names] panels -> previews/_.png +""" +import sys, os, math, random, zlib, bisect + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.normpath(os.path.join(HERE, "..", "..", "..")) +OUT = os.path.join(ROOT, "ArtSource", "Blender", "remaster_v3_tools") +GAME = os.path.join(ROOT, "Assets", "Art", "Models") +PANELS = os.path.join(OUT, "previews", "_panels") +REF = os.path.join(OUT, "fbx", "_ref") +NAMES = ["SM_HandCan", "SM_HandCigar", "SM_Phone", "SM_PhoneHand", "SM_BeerCan", "SM_BeerCanCrushed"] +TAU = 2 * math.pi +DEG = math.radians + + +# ======================================================================= compose (outside Blender) + +def compose(names): + from PIL import Image, ImageDraw, ImageFont + try: + font, small = ImageFont.truetype("arial.ttf", 26), ImageFont.truetype("arial.ttf", 20) + except Exception: + font = small = ImageFont.load_default() + made = [] + for fn in sorted(os.listdir(PANELS)): + if not fn.endswith("_old.png") or not any(fn.startswith(n + "_") for n in names): + continue + key = fn[:-len("_old.png")] + a, b = os.path.join(PANELS, fn), os.path.join(PANELS, key + "_new.png") + if not os.path.exists(b): + continue + A, B = Image.open(a).convert("RGB"), Image.open(b).convert("RGB") + w, h = A.size + bar = 44 + im = Image.new("RGB", (w * 2 + 8, h + bar), (30, 32, 36)) + im.paste(A, (0, bar)) + im.paste(B, (w + 8, bar)) + d = ImageDraw.Draw(im) + d.text((14, 9), "before (game / gc_phone_hand)", fill=(230, 230, 230), font=font) + d.text((w + 22, 9), "round 5", fill=(255, 214, 120), font=font) + d.text((w * 2 + 8 - 14 - d.textlength(key, font=small), 13), key, fill=(170, 170, 170), font=small) + out = os.path.join(OUT, "previews", key + ".png") + im.save(out) + made.append(out) + print("\n".join(made)) + + +if __name__ == "__main__" and "compose" in sys.argv[1:2]: + compose([a for a in sys.argv[2:] if a in NAMES] or NAMES) + sys.exit(0) + +# ======================================================================= Blender side + +sys.path.insert(0, HERE) +import bpy, bmesh +from mathutils import Vector, Matrix +from mathutils.bvhtree import BVHTree +from mathutils.kdtree import KDTree +import common +from common import mat, mesh_obj, set_mats, smooth, join, set_origin, apply_xform, bake, mod, tri_count +import gc_up5_tools as T5 # round 5 helpers: sweep, fz, frames +from os_crew import catmull, sweep_circle +import gc_farm_tools as FT +import gc_vend as GV +import gc_phone as GP +import gc_phone_hand as GPH + +SKIN, SLEEVE = "M_CrewSkin", "M_PaintRed" +STEEL, GREEN, GOLD, CREAM, LEAFG, SOOT = "M_Steel", "M_PaintDarkGreen", "M_Gold", "M_PaintCream", "M_PaintGreen", "M_Soot" +ASH, WRAP, WRAP2, REDP, EMBER = "M_Concrete", "M_Leather", "M_Bark", "M_PaintRed", "M_Ember" +GLOVE, GLEATH, STITCH, BRASS = "M_GloveOrange", "M_Leather", "M_PaintCream", "M_Brass" +CR, TOPZ, CIG_R, FOOT = GV.CR, GV.TOPZ, GV.CIG_R, GV.FOOT +SLOTS = {"Hand": [SKIN, SLEEVE], "Can": [STEEL, GREEN, GOLD, CREAM, LEAFG, SOOT], "Tab": [STEEL], + "Cigar": [ASH, WRAP, GOLD, CREAM, WRAP2, REDP], "Ember": [EMBER], "SM_Phone": list(GP.MATS), "Screen": ["M_PhoneIdle"], + "SM_PhoneHand": [SKIN, SLEEVE, GLOVE, GLEATH, STITCH, BRASS], "Body": [STEEL, GREEN, GOLD, CREAM, LEAFG, SOOT]} +BUDGET = {"SM_HandCan": 20000, "SM_HandCigar": 20000, "SM_Phone": 20000, "SM_PhoneHand": 20000, "SM_BeerCan": 12000, "SM_BeerCanCrushed": 16000} + + +# ======================================================================= small helpers + +def smoothstep(a, b, x): + t = max(0.0, min(1.0, (x - a) / (b - a))) + return t * t * (3 - 2 * t) + + +def perp(v, t): + w = Vector(v) - t * Vector(v).dot(t) + return w.normalized() if w.length > 1e-9 else t.orthogonal().normalized() + + +def reorder(o, names): + """Material slots in the order of `names` (any others after them).""" + me = o.data + cur = [m.name.split(".")[0] if m else "" for m in me.materials] + order = [n for n in names if n in cur] + [n for n in cur if n not in names] + idx = [order.index(cur[p.material_index]) for p in me.polygons] + me.materials.clear() + for n in order: + me.materials.append(mat(n)) + me.polygons.foreach_set("material_index", idx) + me.update() + return o + + +def obj_from_bm(name, bm, mats, ang=40): + idx = [f.material_index for f in bm.faces] + o = mesh_obj(name, bm) + set_mats(o, *mats) + o.data.polygons.foreach_set("material_index", idx) + o.data.update() + smooth(o, ang) + return o + + +def finish(P, name, uv=6.0, ang=45, slots=None): + """Box UVs on parts without their own, one UVMap layer, joined, ngons triangulated, slots ordered.""" + o = FT.done([q for q in P if q is not None], name, uv=uv, ang=ang) + GV.tri_all(o) + smooth(o, ang) + if slots: + reorder(o, slots) + return o + + +def lathe5(name, prof, mats, colfn=None, segs=32, rfn=None, frame=None, ang=40, ph=0.0): + """Surface of revolution about local Z. prof [(r, z)] (r == 0: a pole). colfn(k, j) -> slot of the face from profile point k to k + 1, + segment j round. rfn(r, z, theta, k) -> the radius actually used (noise, a spiral seam...). Faces point to the right of the profile.""" + bm = bmesh.new() + R = [] + for k, (r, z) in enumerate(prof): + if r <= 1e-7: + R.append([bm.verts.new((0.0, 0.0, z))]) + continue + ring = [] + for j in range(segs): + th = TAU * j / segs + ph + rr = rfn(r, z, th, k) if rfn else r + ring.append(bm.verts.new((rr * math.cos(th), rr * math.sin(th), z))) + R.append(ring) + for k in range(len(R) - 1): + a, b = R[k], R[k + 1] + for j in range(segs): + jj = (j + 1) % segs + if len(a) == 1 and len(b) == 1: + continue + if len(a) == 1: + f = bm.faces.new((a[0], b[jj], b[j])) + elif len(b) == 1: + f = bm.faces.new((a[j], a[jj], b[0])) + else: + f = bm.faces.new((a[j], a[jj], b[jj], b[j])) + f.material_index = colfn(k, j) if colfn else 0 + if frame is not None: + bmesh.ops.transform(bm, matrix=frame, verts=bm.verts) + return obj_from_bm(name, bm, mats, ang) + + +def closed_catmull(pts, per=4): + P = [Vector(p) for p in pts] + n = len(P) + out = [] + for i in range(n): + p0, p1, p2, p3 = P[i - 1], P[i], P[(i + 1) % n], P[(i + 2) % n] + for k in range(per): + t = k / per + t2, t3 = t * t, t * t * t + out.append(0.5 * ((2 * p1) + (-p0 + p2) * t + (2 * p0 - 5 * p1 + 4 * p2 - p3) * t2 + (-p0 + 3 * p1 - 3 * p2 + p3) * t3)) + return out + + +def loop_sweep(name, C, up, sec, m, ang=50): + """A closed tube along the closed polyline C; sec -> [(a, b)]: a across (in the plane, outward of the loop's left side), b along `up`.""" + C = [Vector(p) for p in C] + n = len(C) + up = Vector(up).normalized() + bm = bmesh.new() + R = [] + for i in range(n): + t = (C[(i + 1) % n] - C[i - 1]).normalized() + a = t.cross(up).normalized() + R.append([bm.verts.new(C[i] + a * x + up * y) for x, y in sec]) + k = len(sec) + for i in range(n): + A, B = R[i], R[(i + 1) % n] + for j in range(k): + jj = (j + 1) % k + bm.faces.new((A[j], A[jj], B[jj], B[j])) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + return obj_from_bm(name, bm, [m], ang) + + +def ellipse_sec(a, b, n=8): + return [(a * math.cos(TAU * q / n), b * math.sin(TAU * q / n)) for q in range(n)] + + +def surface_patch(name, P, H, nu, nv, base, m, bvh=None, ang=45, use_nrm=False): + """A thin slab lying on a surface: P(u, v) -> (point near the surface, outward direction); snapped to the nearest point of bvh when given. + Top at H(u, v) above the surface, bottom `base` below it, closed round the sides.""" + bm = bmesh.new() + top, bot = [], [] + for i in range(nu + 1): + rt, rb = [], [] + for j in range(nv + 1): + u, v = i / nu, j / nv + q, d = P(u, v) + q, d = Vector(q), Vector(d).normalized() + if bvh is not None: + loc, nrm, _, _ = bvh.find_nearest(q) + if loc is not None: + q = loc + if use_nrm: + d = nrm if nrm.dot(d) > 0 else -nrm + rt.append(bm.verts.new(q + d * H(u, v))) + rb.append(bm.verts.new(q - d * base)) + top.append(rt) + bot.append(rb) + for i in range(nu): + for j in range(nv): + bm.faces.new((top[i][j], top[i + 1][j], top[i + 1][j + 1], top[i][j + 1])) + bm.faces.new((bot[i][j + 1], bot[i + 1][j + 1], bot[i + 1][j], bot[i][j])) + ring_t = [top[i][0] for i in range(nu + 1)] + [top[nu][j] for j in range(1, nv + 1)] + [top[i][nv] for i in range(nu - 1, -1, -1)] + \ + [top[0][j] for j in range(nv - 1, 0, -1)] + ring_b = [bot[i][0] for i in range(nu + 1)] + [bot[nu][j] for j in range(1, nv + 1)] + [bot[i][nv] for i in range(nu - 1, -1, -1)] + \ + [bot[0][j] for j in range(nv - 1, 0, -1)] + L = len(ring_t) + for k in range(L): + kk = (k + 1) % L + bm.faces.new((ring_t[k], ring_b[k], ring_b[kk], ring_t[kk])) + # orient: the top faces go along the outward direction + bm.normal_update() + bm.faces.ensure_lookup_table() + f0 = bm.faces[(nu // 2) * nv * 2] + q, d = P((nu // 2 + 0.5) / nu, 0.5 / nv) + if f0.normal.dot(Vector(d)) < 0: + bmesh.ops.reverse_faces(bm, faces=bm.faces) + return obj_from_bm(name, bm, [m], ang) + + +# ======================================================================= digits and the organic skin + +def digit_rf(r, joints): + """gc_farm_tools.digit's radius: soft swellings at the joints, a squared-off padded tip.""" + tip0 = 0.84 + + def rf(s): + k = (0.93 + 0.1 * sum(math.exp(-((s - j) / 0.06) ** 2) for j in joints)) * (1.04 - 0.14 * s) + if s > tip0: + t = (s - tip0) / (1 - tip0) + k *= math.sqrt(max(0.0, 1 - t ** 4)) * 0.94 + 0.06 + return r * k + return rf + + +class Digit: + """A finger or thumb: the centre line through pts (Catmull-Rom, as FT.digit), the radius of FT.digit, and a palm-side direction D + (perpendicular to the line, towards what the finger closes on). Angles round it: 0 on the back (nail side), +90 towards B = T x D.""" + + def __init__(self, pts, r, joints, inside, per=10, grow=0.0, kind="finger"): + self.pts = [Vector(p) for p in pts] + self.per, self.r, self.joints, self.grow, self.kind = per, r, joints, grow, kind + base = digit_rf(r, joints) + self.rf = lambda s: base(s) + grow * (1.0 if s < 0.84 else max(0.3, 1 - (s - 0.84) / 0.16)) + C = catmull(self.pts, per) + L = [0.0] + for a, b in zip(C, C[1:]): + L.append(L[-1] + (b - a).length) + self.C, self.L, self.tot = C, L, L[-1] + n = len(C) + self.T = [(C[min(i + 1, n - 1)] - C[max(i - 1, 0)]).normalized() for i in range(n)] + D = [perp(Vector(inside(C[i], self.T[i])), self.T[i]) for i in range(n)] + for _ in range(4): + D = [perp(D[max(i - 1, 0)] + D[i] * 2 + D[min(i + 1, n - 1)], self.T[i]) for i in range(n)] + self.D = D + + def frame(self, s): + x = max(0.0, min(1.0, s)) * self.tot + i = max(0, min(len(self.L) - 2, bisect.bisect_right(self.L, x) - 1)) + f = (x - self.L[i]) / max(1e-9, self.L[i + 1] - self.L[i]) + c = self.C[i].lerp(self.C[i + 1], f) + T = self.T[i].lerp(self.T[i + 1], f).normalized() + D = perp(self.D[i].lerp(self.D[i + 1], f), T) + return c, T, D, T.cross(D) + + def surf(self, s, th, h=0.0): + c, T, D, B = self.frame(s) + d = -D * math.cos(th) + B * math.sin(th) + return c + d * (self.rf(s) + h), d + + def tube(self, name, m, segs=16): + return sweep_circle(name, self.pts, lambda s, l: self.rf(s), segs=segs, per=self.per, m=m, cap=True, smooth_ang=70) + + +SKIN_CREASES = dict(palm=[[(-0.0012, 0.0006, 0.0006), (0.0013, 0.00055, 0.0006)], [(-0.0009, 0.00065, 0.00055), (0.001, 0.0005, 0.0005)], + [(0.0, 0.00055, 0.0005)]], + dorsal=(0.00026, 0.00034, (-0.0021, -0.0007, 0.0007, 0.0021)), bulge=(0.0006, 0.0035), cuticle=0.745) +GLOVE_CREASES = dict(palm=[[(0.0, 0.0006, 0.0009)], [(-0.0012, 0.00055, 0.0008), (0.0014, 0.0005, 0.0008)], [(0.0, 0.0005, 0.0008)]], + dorsal=(0.00028, 0.0006, (-0.0032, 0.0, 0.0032)), bulge=(0.0, 0.003), cuticle=None) + + +def crease_pass(o, digits, spec): + """Knuckle creases on the palm side, wrinkles and the knuckle swell on the back, a cuticle groove: the dense skin moved along its normal.""" + kd = KDTree(sum(len(d.C) for d in digits)) + idx = [] + for di, d in enumerate(digits): + for i, c in enumerate(d.C): + kd.insert(c, len(idx)) + idx.append((di, i)) + kd.balance() + me = o.data + co = [v.co.copy() for v in me.vertices] + for vi, p in enumerate(co): + best = None + for (q, k, dist) in kd.find_n(p, 6): + di, i = idx[k] + d = digits[di] + s = d.L[i] / d.tot + (p - q).dot(d.T[i]) / d.tot + if s < -0.02 or s > 1.0: + continue + c, T, D, B = d.frame(s) + rv = p - c - T * (p - c).dot(T) + err = abs(rv.length - d.rf(s)) + if best is None or err < best[0]: + best = (err, d, s, rv, D) + if best is None: + continue + err, d, s, rv, D = best + if err > 0.0022 or rv.length < 1e-6: + continue + n = rv.normalized() + cp = n.dot(D) + pw, bw = smoothstep(0.1, 0.6, cp), smoothstep(0.15, 0.6, -cp) + disp = 0.0 + for jn, j in enumerate(d.joints): + x = (s - j) * d.tot + if abs(x) > 0.009: + continue + for off, dep, w in spec["palm"][min(jn, len(spec["palm"]) - 1)]: + disp -= dep * math.exp(-((x - off) / w) ** 2) * pw + if jn > 0 or d.kind == "thumb": + dep, w, offs = spec["dorsal"] + for off in offs: + disp -= dep * math.exp(-((x - off) / w) ** 2) * bw * math.exp(-(off / 0.004) ** 2) + hb, wb = spec["bulge"] + disp += hb * math.exp(-(x / wb) ** 2) * bw + if spec.get("cuticle"): + # the nail folds: a groove under the cuticle and down both sides of the nail + c_, T_, D_, B_ = d.frame(s) + th = math.atan2(n.dot(B_), -n.dot(D_)) + x = (s - spec["cuticle"]) * d.tot + fold = abs(abs(th) - DEG(43) * (0.78 + 0.22 * smoothstep(0.0, 0.4, (s - spec["cuticle"]) / 0.2))) + along = smoothstep(-0.0005, 0.0005, x) * (1 - smoothstep(0.9, 0.97, s)) + disp -= 0.00042 * math.exp(-(x / 0.0006) ** 2) * smoothstep(0.4, 0.8, -cp) + disp -= 0.0004 * math.exp(-(fold / DEG(4)) ** 2) * along + if disp: + me.vertices[vi].co = p + n * disp + me.update() + + +def soften(o, spots, iters=300): + """Extra smoothing where separate parts were blended (the wrist into the heel of the hand): weights fall off from each spot.""" + vg = o.vertex_groups.new(name="soft") + for v in o.data.vertices: + w = max(math.exp(-((v.co - Vector(c)).length / r) ** 2) for c, r in spots) + if w > 0.02: + vg.add([v.index], min(1.0, w * 1.3), "REPLACE") + md = o.modifiers.new("soft", "SMOOTH") + md.factor, md.iterations, md.vertex_group = 1.0, iters, "soft" + bake(o) + o.vertex_groups.clear() + + +def organic(parts, name, m, digits, voxel=0.0006, tris=10000, spec=SKIN_CREASES, smooth_it=6, soft=None): + """Join closed parts and remesh them into one blended surface; creases on the dense mesh; then decimated to `tris`.""" + o = join(parts, name) + mod(o, "REMESH", mode="VOXEL", voxel_size=voxel, adaptivity=0.0) + bake(o) + mod(o, "SMOOTH", factor=0.6, iterations=smooth_it) + bake(o) + if soft: + soften(o, soft) + if spec: + crease_pass(o, digits, spec) + dense = common.link(bpy.data.objects.new(name + "_dense", o.data.copy())) + for p in dense.data.polygons: + p.use_smooth = True + n = sum(len(p.vertices) - 2 for p in o.data.polygons) + if n > tris: + mod(o, "DECIMATE", decimate_type="COLLAPSE", ratio=tris / n, use_collapse_triangulate=True) + bake(o) + o.data.materials.clear() + o.data.materials.append(mat(m)) + for p in o.data.polygons: + p.material_index = 0 + smooth(o, 80) + o["dense"] = dense.name + return o + + +def transfer_normals(o, dense_name, nv): + """The shading of the dense remesh (creases and all) on the decimated skin: custom normals on the first nv vertices of o.""" + dense = bpy.data.objects[dense_name] + vg = o.vertex_groups.new(name="skin") + vg.add(list(range(nv)), 1.0, "REPLACE") + md = o.modifiers.new("nrm", "DATA_TRANSFER") + md.object = dense + md.use_loop_data = True + md.data_types_loops = {"CUSTOM_NORMAL"} + md.loop_mapping = "POLYINTERP_NEAREST" + md.vertex_group = "skin" + bake(o) + o.vertex_groups.clear() + me = dense.data + bpy.data.objects.remove(dense) + bpy.data.meshes.remove(me) + return o + + +def nail(bvh, d, m=SKIN, s0=0.75, s1=0.955, half=DEG(44)): + """A fingernail on the back of the tip: sunk into its folds at the sides and under the cuticle, a free edge at the end.""" + def P(u, v): + return d.surf(s0 + (s1 - s0) * u, (-half + 2 * half * v) * (0.78 + 0.22 * smoothstep(0.0, 0.4, u))) + + def H(u, v): + e = 1 - abs(2 * v - 1) ** 3 + return 0.0008 * e * (0.35 + 0.65 * smoothstep(0.0, 0.3, u)) + 0.0002 * smoothstep(0.8, 1.0, u) + 0.0001 + return surface_patch("nail", P, H, 6, 6, 0.0007, m, bvh=bvh, ang=28) + + +# ======================================================================= shirt cuff and sleeve + +def shirt_arm(P, root, way, r0, look, skin=True, fore=(-0.03, 0.26), seam_side=None): + """gc_vend.arm with the detail: the bare forearm (returned, to blend with the hand), a shirt cuff (rolled edge, top-stitch groove, + seam into the sleeve, a placket with a button and its thread) and the sleeve (pleats into the cuff, drape folds, a seam welt). + look: the side the button faces (towards the viewer).""" + root, way = Vector(root), Vector(way).normalized() + p = lambda s: root + way * s + # bare: the wrist end tapers inside the heel of the hand, so the blend has no ring where the tube's end came out + taper = (lambda t: 0.8 + 0.2 * smoothstep(0.0, 0.2, t)) if skin else (lambda t: 1.0) + fa = sweep_circle("forearm", [p(fore[0]), p((fore[0] + fore[1]) / 2), p(fore[1])], + lambda t, l: (r0 * 0.9 + (0.042 - r0 * 0.9) * t) * taper(t) if skin else r0 + (0.042 - r0) * t, segs=16, per=4, m=SKIN, cap=True, + smooth_ang=60) + X = perp(Vector(look), way) + Y = way.cross(X) + F = Matrix((X, Y, way)).transposed().to_4x4() + F.translation = root + # the cuff: a band with a thick rolled front edge, the stitch groove, the back edge sewn to the sleeve + prof = [(0.0452, 0.2565), (0.0460, 0.2512), (0.0474, 0.2494), (0.0492, 0.2491), (0.0502, 0.2499), (0.0505, 0.2513), (0.0505, 0.2527), + (0.0500, 0.2532), (0.0505, 0.2537), (0.0505, 0.2668), (0.0501, 0.2673), (0.0505, 0.2678), (0.0505, 0.2702), (0.0500, 0.2716), + (0.0490, 0.2722), (0.0478, 0.2723)] + P.append(lathe5("cuff", prof, [SLEEVE], segs=34, frame=F, ang=50)) + # the placket: the end of the cuff lapping over itself, with a button + R = 0.0505 + + def cyl(s, a): + d = X * math.cos(a) + Y * math.sin(a) + return p(s) + d * R, d + w = 0.026 / R + P.append(surface_patch("placket", lambda u, v: cyl(0.2500 + 0.0212 * u, -w * 0.5 + w * v), + lambda u, v: 0.0011 * smoothstep(0.0, 0.12, v) * smoothstep(0.0, 0.06, u) * smoothstep(0.0, 0.06, 1 - u), 6, 8, 0.0006, SLEEVE)) + c, dn = cyl(0.2606, w * 0.32) + c = c + dn * 0.0011 + Fb = T5.fz(c, dn, ref=way) + P.append(lathe5("button", [(0.0, 0.0011), (0.0024, 0.0010), (0.0034, 0.0015), (0.0047, 0.0017), (0.0054, 0.0013), (0.0055, 0.0003), (0.0052, 0.0)][::-1], + [SLEEVE], segs=20, frame=Fb, ang=40)) + for a in (45, 135): # the thread crossing the four holes + q0 = Fb @ Vector((0.0016 * math.cos(DEG(a)), 0.0016 * math.sin(DEG(a)), 0.00105)) + q1 = Fb @ Vector((-0.0016 * math.cos(DEG(a)), -0.0016 * math.sin(DEG(a)), 0.00105)) + P.append(GV.cyl_between("thread", q0, q1, 0.00042, SLEEVE, v=6)) + # the sleeve: pleats gathered into the cuff, drape folds further up + s0, s1 = 0.2655, 0.5 + C = [p(s0 + (s1 - s0) * i / 24) for i in range(25)] + rng = random.Random(11) + ph = [rng.uniform(0, TAU) for _ in range(3)] + + def sec(sf, i): + s = s0 + (s1 - s0) * sf + base = 0.047 + (0.058 - 0.047) * smoothstep(0.268, 0.5, s) + 0.0012 * smoothstep(0.266, 0.275, s) + pleat = 0.0022 * smoothstep(0.268, 0.276, s) * (1 - smoothstep(0.29, 0.35, s)) + drape = 0.0019 * smoothstep(0.29, 0.36, s) + out = [] + for q in range(32): + a = TAU * q / 32 + r = base + pleat * math.cos(7 * a + ph[0]) + drape * (0.6 * math.sin(3 * a + 18 * s + ph[1]) + 0.4 * math.sin(5 * a - 11 * s + ph[2])) + out.append((r * math.cos(a), r * math.sin(a))) + return out + frm = ([way] * len(C), [X] * len(C), [Y] * len(C)) + sl = T5.sweep("sleeve", C, sec, [SLEEVE], ang=55, frm=frm) + P.append(sl) + # the seam welt down the underside of the sleeve, lying on the folds + bvh = BVHTree.FromObject(sl, bpy.context.evaluated_depsgraph_get()) + aw = DEG(180 + 25) if seam_side is None else seam_side + P.append(surface_patch("seam", lambda u, v: ((p(0.276 + 0.218 * u) + (X * math.cos(aw + (v - 0.5) * 0.05) + Y * math.sin(aw + (v - 0.5) * 0.05)) * 0.05), + X * math.cos(aw + (v - 0.5) * 0.05) + Y * math.sin(aw + (v - 0.5) * 0.05)), + lambda u, v: 0.0009 * math.sin(math.pi * v) + 0.0001, 16, 2, 0.0008, SLEEVE, bvh=bvh)) + return fa + + +# ======================================================================= SM_HandCan + +def can_profile(): + """(r, z, slot) bottom pole to top pole; slot of the band from this point to the next.""" + S, G, Au, Cm = 0, 1, 2, 3 + pts = [(0.0, -0.0507, S), (0.006, -0.0512, S), (0.0115, -0.0528, S), (0.0160, -0.0553, S), (0.0192, -0.0578, S), (0.0208, -0.0592, S), + (0.0218, -0.0599, S), (0.0228, -0.0600, S), (0.0238, -0.0598, S), (0.0250, -0.0592, S), (0.0268, -0.0580, S), (0.0290, -0.0560, S), + (0.0308, -0.0538, S), (0.0320, -0.0518, S), (0.0327, -0.0503, S), (CR, -0.0490, G), (CR, -0.046, G), (CR, -0.034, G), + (CR, -0.022, Au), (CR, -0.020, Cm), (CR, -0.010, Cm), (CR, 0.0, Cm), (CR, 0.010, Cm), (CR, 0.022, Au), (CR, 0.024, G), + (CR, 0.033, G), (CR, 0.040, G), (0.0329, 0.0425, G), (0.0325, 0.0450, G), (0.0318, 0.0474, G), (0.0309, 0.0494, G), + (0.0299, 0.0511, G), (0.0291, 0.0524, G), (0.0286, 0.0531, G), (0.0287, 0.0535, G), (0.0282, 0.0540, G), (0.0283, 0.0544, G), + (0.0279, 0.0549, S), (0.0278, 0.0555, S), (0.0280, 0.0560, S), (0.0286, 0.0567, S), (0.0288, 0.0577, S), (0.0287, 0.0590, S), + (0.0283, 0.0598, S), (0.0276, 0.0602, S), (0.0268, 0.0602, S), (0.0263, 0.0597, S), (0.0260, 0.0585, S), (0.0256, 0.0570, S), + (0.0251, 0.0556, S), (0.0247, 0.0549, S), (0.0242, 0.0547, S), (0.0238, 0.0550, S), (0.0235, 0.0557, S), (0.0231, 0.0563, S), + (0.0225, 0.0565, S), (0.0212, 0.0565, S), (0.0206, 0.05672, S), (0.0198, 0.05672, S), (0.0192, 0.0565, S), (0.0120, 0.0565, S), + (0.0060, 0.0565, S), (0.0044, 0.0565, S), (0.0039, 0.05668, S), (0.0032, 0.0568, S), (0.0, 0.0568, S)] + return pts + + +def opening_outline(n=40, grow=0.0): + """The scored opening, a rounded tear towards -Y (towards the rim), under the nose of the tab.""" + cy, rx, ry = -0.0139, 0.0066, 0.0056 + out = [] + for i in range(n): + a = TAU * i / n + k = 1.25 if math.sin(a) < 0 else 1.0 + out.append(Vector(((rx + grow) * math.cos(a) * (1 - 0.12 * max(0.0, -math.sin(a))), cy + (ry * k + grow) * math.sin(a), 0.0))) + return out + + +def densify(prof, step): + """More rings up the soft wall (the heel to the neck), for the crumple.""" + out = [] + for (r0, z0, s0), (r1, z1, s1) in zip(prof, prof[1:]): + out.append((r0, z0, s0)) + if -0.051 < z0 < 0.055 and -0.051 < z1 < 0.055 and z1 - z0 > step * 1.4: + k = int((z1 - z0) / step) + for i in range(1, k): + f = i / k + out.append((r0 + (r1 - r0) * f, z0 + (z1 - z0) * f, s0)) + out.append(prof[-1]) + return out + + +def can5(dense=False): + """The Can (as SM_BeerCan, much finer) and its Tab. Origin of the can at its centre, the Tab's on its rivet. + dense: more rings and segments, for SM_BeerCanCrushed's crumple.""" + prof = densify(can_profile(), 0.0022) if dense else can_profile() + mats = SLOTS["Can"] + B = [lathe5("can", [(r, z) for r, z, s in prof], mats, colfn=lambda k, j: prof[k][2], segs=56 if dense else 40, ang=32)] + # the leaf logo on the cream band, front (-Y) and back (+Y), and the gold dots, as gc_vend + for a0 in (-math.pi / 2, math.pi / 2): + for (base, L, W, ang, m, bend) in (((-0.004, -0.012), 0.032, 0.0075, DEG(70), GREEN, 0.12), ((-0.002, -0.011), 0.022, 0.006, DEG(118), LEAFG, -0.14)): + pr = GV.leaf_pairs(base, L, W, ang, 18 if dense else 10, bend) + o = GV.strip_obj("logo", [((a[0], -CR, a[1]), (b[0], -CR, b[1])) for a, b in pr], m, (0, -1, 0)) + if dense: # across the leaf too, so it can follow the crumple + bm_ = bmesh.new() + bm_.from_mesh(o.data) + bmesh.ops.subdivide_edges(bm_, edges=bm_.edges[:], cuts=3, use_grid_fill=True) + bmesh.ops.triangulate(bm_, faces=bm_.faces[:]) + bm_.to_mesh(o.data) + bm_.free() + rr = CR + (0.0005 if m == GREEN else 0.0008) + for v in o.data.vertices: + x, z = v.co.x, v.co.z + phi = a0 + x / CR + v.co = (rr * math.cos(phi), rr * math.sin(phi), z) + o.data.update() + for pg in o.data.polygons: + c = Vector(pg.center) + if Vector(pg.normal).dot(Vector((c.x, c.y, 0))) < 0: + pg.flip() + B.append(o) + # the midrib + pr2 = GV.leaf_pairs(base, L * 0.85, W * 0.1, ang, 8, bend * 0.8) + o2 = GV.strip_obj("rib", [((a[0], -CR, a[1]), (b[0], -CR, b[1])) for a, b in pr2], CREAM if m == GREEN else GREEN, (0, -1, 0)) + for v in o2.data.vertices: + x, z = v.co.x, v.co.z + phi = a0 + x / CR + v.co = ((rr + 0.0001) * math.cos(phi), (rr + 0.0001) * math.sin(phi), z) + o2.data.update() + for pg in o2.data.polygons: + c = Vector(pg.center) + if Vector(pg.normal).dot(Vector((c.x, c.y, 0))) < 0: + pg.flip() + B.append(o2) + for dx in (-0.016, 0.016): + ph = a0 + dx / CR + q = Vector((CR * math.cos(ph), CR * math.sin(ph), 0.002)) + B.append(GV.cyl_between("dot", q * 0.9995, q + Vector((math.cos(ph), math.sin(ph), 0)) * 0.0008, 0.0022, GOLD, v=16)) + # the lid: the score of the opening (a dark line) and its stiffening bead just inside + sc_out, sc_in = opening_outline(48, 0.00045), opening_outline(48, -0.00015) + bm = bmesh.new() + vo = [bm.verts.new(p + Vector((0, 0, TOPZ + 0.0001))) for p in sc_out] + vi = [bm.verts.new(p + Vector((0, 0, TOPZ + 0.0001))) for p in sc_in] + for i in range(48): + f = bm.faces.new((vi[i], vi[(i + 1) % 48], vo[(i + 1) % 48], vo[i])) + bm.normal_update() + for f in bm.faces: + if f.normal.z < 0: + f.normal_flip() + B.append(obj_from_bm("score", bm, [SOOT])) + B.append(loop_sweep("bead", [p + Vector((0, 0, TOPZ)) for p in opening_outline(40, -0.0012)], (0, 0, 1), + [(0.00045 * math.cos(PI_ * q / 6), 0.00028 * math.sin(PI_ * q / 6)) for q in range(7)] + [(0.0, -0.0002)], + STEEL, ang=60)) + can = finish(B, "Can", uv=6.0, ang=32, slots=mats) + # the lid on a darker band of T_Metal, the tab (below) on a bright one: same M_Steel, but the tab reads as its own piece + me = can.data + uvl = me.uv_layers.active + for pg in me.polygons: + c = pg.center + if pg.material_index == 0 and c.z > 0.0540 and math.hypot(c.x, c.y) < 0.0266: + for li in pg.loop_indices: + co = me.vertices[me.loops[li].vertex_index].co + uvl.data[li].uv = (0.405 + co.x * 0.55, 0.5 + co.y * 0.9) + # ---- Tab + half = [(0.0, -0.0090), (0.0022, -0.0087), (0.0036, -0.0079), (0.0043, -0.0066), (0.0046, -0.0048), (0.0050, -0.0028), (0.0058, -0.0010), + (0.0068, 0.0012), (0.0075, 0.0040), (0.0078, 0.0075), (0.0077, 0.0110), (0.0072, 0.0145), (0.0060, 0.0175), (0.0040, 0.0193), + (0.0020, 0.0199), (0.0, 0.0200)] + ol = half + [(-x, y) for x, y in reversed(half[1:-1])] + ol = closed_catmull([Vector((x, y, 0)) for x, y in ol], 2) + hole = [Vector((0.0050 * math.cos(TAU * i / 28), 0.0112 + 0.0058 * math.sin(TAU * i / 28), 0)) for i in range(28)] + # flat on the lid at the nose, bent up past the rivet so the ring end stands a little off the lid (a finger gets under it) + zt = lambda y: TOPZ + 0.00105 + 0.0003 * smoothstep(-0.003, 0.004, y) + 0.0013 * smoothstep(0.003, 0.02, y) ** 1.4 + + def inset_loop(C, d): + n = len(C) + out = [] + for i in range(n): + t = (C[(i + 1) % n] - C[i - 1]).normalized() + a = t.cross(Vector((0, 0, 1))).normalized() # outward for a counter-clockwise loop + out.append(C[i] - a * d) + return out + T = [] + bm = bmesh.new() + for dz, flip in ((0.0, False), (-0.00048, True)): + oo = inset_loop(ol, 0.00035) + hh = inset_loop(hole, -0.00035) + vo = [bm.verts.new((p.x, p.y, zt(p.y) + dz)) for p in oo] + vh = [bm.verts.new((p.x, p.y, zt(p.y) + dz)) for p in hh] + es = [bm.edges.new((vo[i], vo[(i + 1) % len(vo)])) for i in range(len(vo))] + [bm.edges.new((vh[i], vh[(i + 1) % len(vh)])) for i in range(len(vh))] + r = bmesh.ops.triangle_fill(bm, use_beauty=True, use_dissolve=False, edges=es, normal=Vector((0, 0, 1))) + fs = [g for g in r["geom"] if isinstance(g, bmesh.types.BMFace)] + for f in fs: + f.normal_update() + if (f.normal.z < 0) != flip: + f.normal_flip() + T.append(obj_from_bm("plate", bm, [STEEL], 30)) + curl = [(0.0005 * math.cos(TAU * q / 8), 0.0004 * math.sin(TAU * q / 8)) for q in range(8)] + for C, d in ((ol, 0.00032), (hole, -0.00032)): + L = inset_loop(C, d) + T.append(loop_sweep("curl", [Vector((p.x, p.y, zt(p.y) - 0.00024)) for p in L], (0, 0, 1), curl, STEEL, ang=70)) + T.append(lathe5("rivet", [(0.0026, TOPZ - 0.0002), (0.0024, TOPZ + 0.0009), (0.0020, TOPZ + 0.00135), (0.0013, TOPZ + 0.0016), (0.0, TOPZ + 0.00166)], + [STEEL], segs=20, ang=50)) + # a stiffening rib pressed into the nose + T.append(surface_patch("rib", lambda u, v: (Vector((-0.0011 + 0.0022 * v, -0.0078 + 0.0046 * u, zt(-0.0078 + 0.0046 * u))), Vector((0, 0, 1))), + lambda u, v: 0.00018 * math.sin(math.pi * v) * smoothstep(0, 0.2, u) * smoothstep(0, 0.2, 1 - u), 4, 4, 0.0001, STEEL)) + tab = finish(T, "Tab", uv=15.0, ang=40, slots=["M_Steel"]) + me = tab.data + uvl = me.uv_layers.active + for li, lp in enumerate(me.loops): + co = me.vertices[lp.vertex_index].co + uvl.data[li].uv = (0.155 + co.x * 1.4, 0.3 + co.y * 2.5) + set_origin(tab, (0, 0, TOPZ)) + tab.parent = can + tab.matrix_parent_inverse = Matrix.Identity(4) + return can, tab + + +PI_ = math.pi + + +def hand_can5(): + at = lambda u, v, w: Vector((-u, w, v)) + + def pol(a_deg, rho, v): + a = DEG(a_deg) + return at(rho * math.cos(a), v, rho * math.sin(a)) + rad = lambda a: Vector((-math.cos(DEG(a)), math.sin(DEG(a)), 0)) + tan = lambda a: Vector((-math.sin(DEG(a)), -math.cos(DEG(a)), 0)) * -1 + Z = Vector((0, 0, 1)) + S = [] + S.append(GV.ell("palm", pol(-12, CR + 0.026, -0.006), (0.021, 0.042, 0.054), (rad(-12), tan(-12), Z), seg=28, rings=18)) + S.append(GV.ell("heel", pol(8, CR + 0.025, -0.058), (0.02, 0.034, 0.03), (rad(8), tan(8), Z), seg=24, rings=14)) + S.append(GV.ell("thenar", pol(30, CR + 0.017, -0.04), (0.017, 0.022, 0.034), (rad(30), tan(30), Z), seg=24, rings=14)) + inside = lambda c, T: Vector((-c.x, -c.y, 0.0)) + digits = [] + for v, r, a_tip, ln in ((0.034, 0.0118, -186, 1.0), (0.0105, 0.0124, -192, 1.0), (-0.0135, 0.0118, -182, 0.95), (-0.0365, 0.0104, -166, 0.85)): + rho = CR + r * 1.02 + pts = [pol(-22, CR + 0.03, v - 0.003), pol(-42, CR + 0.022, v - 0.002), pol(-62, rho + 0.002, v - 0.001), pol(-92, rho, v), + pol(-122, rho, v + 0.001), pol(-150, rho, v + 0.002), pol(a_tip + 12, rho, v + 0.002), pol(a_tip, rho - 0.002, v + 0.002)] + digits.append(Digit(pts, r, (0.04, 0.4, 0.7), inside)) + rt = 0.0128 + digits.append(Digit([pol(24, CR + 0.03, -0.062), pol(30, CR + 0.022, -0.042), pol(40, CR + rt, -0.018), pol(48, CR + rt * 0.95, 0.004), + pol(53, CR + rt * 0.9, 0.018)], rt, (0.34, 0.68), inside, kind="thumb")) + for d in digits: + S.append(d.tube("digit", SKIN)) + P = [] + S.append(shirt_arm(P, pol(6, CR + 0.03, -0.082), at(0.34, -0.8, 0.5), 0.031, look=(-0.55, 1.0, 0.1))) + wrist = pol(6, CR + 0.03, -0.082) + heel = pol(8, CR + 0.025, -0.058) + skin = organic(S, "skin", SKIN, digits, tris=7500, soft=[(wrist + at(0.34, -0.8, 0.5).normalized() * 0.022, 0.034), (wrist.lerp(heel, 0.5), 0.024)]) + clear_of_can(skin) + clear_of_can(bpy.data.objects[skin["dense"]]) + dn, nv = skin["dense"], len(skin.data.vertices) + bvh = BVHTree.FromObject(skin, bpy.context.evaluated_depsgraph_get()) + for d in digits: + P.append(nail(bvh, d)) + transfer_normals(finish([skin] + P, "Hand", ang=60, slots=SLOTS["Hand"]), dn, nv) + return digits + + +def clear_of_can(o, gap=0.00015): + """The remesh and the decimation can sink a fingertip a fraction of a millimetre into the can: lift the skin back onto it.""" + side = [(r, z) for r, z, _ in can_profile() if r > 0.022 and -0.0601 < z < 0.0578] + side = side[:next(i for i, (r, z) in enumerate(side) if z > 0.0577) + 1] if any(z > 0.0577 for r, z in side) else side + side.sort(key=lambda p: p[1]) + + def env(z): + if z <= side[0][1] or z >= side[-1][1]: + return None + i = next(k for k in range(len(side) - 1) if side[k + 1][1] >= z) + (r0, z0), (r1, z1) = side[i], side[i + 1] + return r0 + (r1 - r0) * (z - z0) / max(1e-9, z1 - z0) + n = 0 + for v in o.data.vertices: + r = math.hypot(v.co.x, v.co.y) + e = env(v.co.z) + g = gap + if -0.017 < v.co.z < 0.024 and abs(abs(math.atan2(v.co.y, v.co.x)) - math.pi / 2) < 0.75: + g = gap + 0.0009 # the leaf logos stand 0.8 mm off the label + if e is None or r < 1e-6 or r < e - 0.008 or r >= e + g: + continue + k = (e + g) / r + v.co.x *= k + v.co.y *= k + n += 1 + o.data.update() + return n + + +CRUMPLE = dict(keep=0.40, tilt=6.0, shift=0.002, dent=0.4) # tuned so the tab lands where gc_vend's crushed can had it +CRUSHED_TAB = (0.004299134, 0.000498753, 0.028109681) # SM_BeerCanCrushed's Tab origin in the game FBX (gc_vend.crush_fn) + + +def crumple(keep=None, tilt=None, shift=None, dent=None): + """Stood on: the wall between the heel and the shoulder folds up like a concertina, the folds buckling into diamonds + (five lobes, half a lobe round from one fold to the next), with a dent from the heel of the boot and the top pushed over. + Heel, bottom, shoulder, rim and lid stay as made.""" + rng = random.Random(77) + ph = [rng.uniform(0, TAU) for _ in range(4)] + zb0, zb1 = -0.0478, 0.0418 + L = zb1 - zb0 + keep = CRUMPLE["keep"] if keep is None else keep + tilt = DEG(CRUMPLE["tilt"] if tilt is None else tilt) + shift = CRUMPLE["shift"] if shift is None else shift + dent = CRUMPLE["dent"] if dent is None else dent + m, n = 4, 5 + zp = zb0 + L * keep + + def rot(x, z, a, px): + c, s_ = math.cos(a), math.sin(a) + dx, dz = x - px, z - zp + return px + dx * c + dz * s_, zp - dx * s_ + dz * c + + def f(p): + x, y, z = p + if z <= zb0: + return Vector((x, y, z)) + if z >= zb1: + x2, z2 = rot(x + shift, z - L * (1 - keep), tilt, shift) + return Vector((x2, y, z2)) + r = math.hypot(x, y) + th = math.atan2(y, x) + t = (z - zb0) / L + band = t * m + 0.3 # phased so the two gold lines ride on crests, not in the folds + k = int(band) + fr = band - k + env = smoothstep(0.0, 0.07, t) * smoothstep(0.0, 0.07, 1 - t) + lobe = 0.5 + 0.5 * math.cos(n * th + k * math.pi + ph[0]) # the lobes swap over from one fold to the next + mid = 0.5 - 0.5 * math.cos(TAU * fr) # 0 on the fold lines, 1 between them + dr = (0.0050 * mid * (0.3 + 0.7 * lobe) - 0.0032 * (1 - mid)) * env + dr += 0.0035 * math.sin(math.pi * t) + dth = math.atan2(math.sin(th - dent), math.cos(th - dent)) + dr -= 0.0075 * math.exp(-(dth / 0.65) ** 2 - ((t - 0.55) / 0.22) ** 2) + rr = r + dr if r > 0.01 else r + zn = zb0 + L * keep * t + 0.0016 * math.sin(TAU * fr) * (lobe - 0.5) * 2 * env + x2, z2 = rot(rr * math.cos(th) + shift * t, zn, tilt * t, shift * t) + return Vector((x2, rr * math.sin(th), z2)) + return f + + +def beer_can5(crushed=False): + """SM_BeerCan / SM_BeerCanCrushed: the hand's can, Body and Tab (both roots, as gc_vend). Crushed: crumpled, centred on its bounds.""" + can, tab = can5(dense=crushed) + tab.parent = None + tab.matrix_parent_inverse = Matrix.Identity(4) + can.name = can.data.name = "Body" + if crushed: + f = crumple() + for o in (can, tab): + apply_xform(o) + for v in o.data.vertices: + v.co = f(v.co) + o.data.update() + pts = [v.co for v in can.data.vertices] + c = Vector([(max(p[i] for p in pts) + min(p[i] for p in pts)) / 2 for i in range(3)]) + for o in (can, tab): + o.data.transform(Matrix.Translation(-c)) + set_origin(can, (0, 0, 0)) + smooth(can, 50) + smooth(tab, 40) + # the rivet lands within 0.7 mm of the old pivot; the pivot itself is kept exactly (nothing turns the crushed tab) + set_origin(tab, CRUSHED_TAB) + return can, tab + + +def hand_can_build(): + hand_can5() + can5() + + +# ======================================================================= SM_HandCigar + +def cigar_noise(seed): + rng = random.Random(seed) + terms = [(rng.randint(2, 7), rng.uniform(150, 900), rng.uniform(0, TAU), rng.uniform(0.4, 1.0)) for _ in range(5)] + + def f(th, z): + return sum(a * math.sin(k * th + w * z + p) for k, w, p, a in terms) / sum(a for *_, a in terms) + return f + + +def cigar5(): + """Body and Ember in SM_Cigar's frame (axis Y, the lit foot at -Y), built about Z and turned at the end like gc_vend.""" + r = CIG_R + burn = cigar_noise(5) + ashn = cigar_noise(9) + PITCH = 0.034 + zs = [FOOT, FOOT + 0.0004, FOOT + 0.0012, FOOT + 0.0022, FOOT + 0.0033, FOOT + 0.0044, FOOT + 0.0055, FOOT + 0.0063, FOOT + 0.0071, + FOOT + 0.0080, FOOT + 0.0092] + prof = [(0.0, FOOT), (0.0062, FOOT), (0.0078, FOOT + 0.00005)] + prof += [(0.0083 if z < FOOT + 0.0068 else r, z) for z in zs[1:]] + z = FOOT + 0.0092 + while z < 0.0280: + z += 0.0019 + prof.append((r, min(z, 0.0280))) + band = [(r, 0.0291), (0.0088, 0.02935), (0.0091, 0.0298), (0.0091, 0.0306), (0.00895, 0.0310), (0.00895, 0.0314), (0.0091, 0.0318), + (0.0090, 0.0322), (0.0090, 0.0400), (0.0090, 0.0458), (0.0091, 0.0462), (0.00895, 0.0466), (0.00895, 0.0470), (0.0091, 0.0474), + (0.0091, 0.0482), (0.0088, 0.04865), (r, 0.0489)] + prof += band + z = 0.0489 + while z < 0.0548: + z += 0.002 + prof.append((r, min(z, 0.0548))) + prof += [(r, 0.0551), (0.00838, 0.05535), (0.0083, 0.0575), (0.0080, 0.0600), (0.0075, 0.0625), (0.0067, 0.0648), (0.0056, 0.0668), + (0.0043, 0.0685), (0.0034, 0.0696), (0.0031, 0.0701), (0.0, 0.0703)] + zb = [p[1] for p in band] + + def rfn(rr, z, th, k): + if z < FOOT + 0.0072: # ash: flaky, layered, a little narrower + return rr * (1 + 0.035 * ashn(th, z)) - 0.00012 * abs(math.sin(z * 2600)) + if zb[0] - 1e-6 <= z <= zb[-1] + 1e-6 or z > 0.0551: + if z > 0.0551: # the cap: its own leaf, a faint line where it overlaps + return rr + (0.00005 if abs(z - 0.0575) < 0.0003 else 0.0) + return rr + ph = th / TAU + z / PITCH + frac = ph - math.floor(ph) + vein = math.exp(-(((th / TAU * 3 - z / 0.011) % 1.0 - 0.5) / 0.035) ** 2) + return rr + 0.00011 * frac + 0.00005 * vein + + M = {m: i for i, m in enumerate(SLOTS["Cigar"])} + + def col(k, j): + za, zb_ = prof[k][1], prof[k + 1][1] + zc = (za + zb_) / 2 + th = TAU * (j + 0.5) / 32 + if prof[k][0] < 1e-7 or zc < FOOT + 0.0001: + return M[ASH] + line = FOOT + 0.0066 + 0.0011 * burn(th, 0.0) + if zc < line: + return M[ASH] + if zc < line + 0.0011: + return M[WRAP2] # scorched just behind the burn line + if zb[0] <= zc <= zb[-1]: + if 0.0294 < zc < 0.0320 or 0.0460 < zc < 0.0486: + return M[GOLD] + return M[CREAM] + if zc > 0.0699: + return M[WRAP2] # the cut + ph = th / TAU + zc / PITCH + return M[WRAP2] if (ph - math.floor(ph)) > 0.86 else M[WRAP] + body = lathe5("cigar", prof, SLOTS["Cigar"], colfn=col, segs=32, rfn=rfn, ang=50) + P = [body] + # the seal on the band: a red medallion with a gold rim and a gold crest dot, facing -Y here (up once turned) + Fs = T5.fz(Vector((0, -(0.0090 - 0.0002), 0.039)), (0, -1, 0), ref=(1, 0, 0)) + P.append(lathe5("seal", [(0.0, 0.00105), (0.0016, 0.00102), (0.0026, 0.00092), (0.0036, 0.00082), (0.0043, 0.00068), (0.0045, 0.0003), (0.0045, 0.0)][::-1], + [REDP], segs=20, frame=Fs, ang=40)) + P.append(lathe5("sealrim", [(0.0037, 0.00083), (0.0041, 0.00098), (0.0044, 0.00086), (0.0045, 0.0006)][::-1], [GOLD], segs=20, frame=Fs, ang=60)) + P.append(lathe5("sealdot", [(0.0, 0.00122), (0.0010, 0.00118), (0.0016, 0.00108), (0.0018, 0.00095)][::-1], [GOLD], segs=12, frame=Fs, ang=60)) + for q in range(7): # small gold beads round the middle of the band, the seal between the first and the last + a = -PI_ / 2 + DEG(45) * (q + 1) + c = Vector((0.0090 * math.cos(a), 0.0090 * math.sin(a), 0.039)) + P.append(lathe5("bandbead", [(0.0007, 0.0), (0.0005, 0.00022), (0.0, 0.00028)], [GOLD], segs=8, frame=T5.fz(c, Vector((math.cos(a), math.sin(a), 0))), ang=70)) + for o in P: + GV.xf(o, rx=-PI_ / 2) + # the ember: a crusty glowing coal on the lit end + en = cigar_noise(21) + # the glowing core (from the tip up, so the faces look out), inside a crust of ash + eprof = [(0.0, FOOT + 0.0006), (0.0064, FOOT + 0.0006), (0.0065, FOOT - 0.0012), (0.0064, FOOT - 0.0026), (0.0060, FOOT - 0.0038), + (0.0052, FOOT - 0.0049), (0.0041, FOOT - 0.0058), (0.0027, FOOT - 0.0064), (0.0012, FOOT - 0.0067), (0.0, FOOT - 0.0067)][::-1] + em = lathe5("ember", eprof, [EMBER], segs=28, rfn=lambda rr, z, th, k: rr * (1 + 0.06 * en(th, z) * (0.3 if k > 7 else 1.0)), ang=70) + GV.xf(em, rx=-PI_ / 2) + # the crust: a ragged rim of grey ash round the coal, part of the Body (M_Concrete, the ash slot it already has) + an = cigar_noise(33) + cprof = [(0.0063, FOOT + 0.0008), (0.0066, FOOT - 0.0010), (0.0068, FOOT - 0.0026), (0.0072, FOOT - 0.0035), (0.0078, FOOT - 0.0034), + (0.0083, FOOT - 0.0024), (0.00855, FOOT - 0.0010), (0.0085, FOOT + 0.0010)] + crust = lathe5("crust", cprof, [ASH], segs=36, rfn=lambda rr, z, th, k: rr * (1 + 0.06 * an(th, z * 3) * (1.0 if 2 <= k <= 5 else 0.4)), ang=55) + for v in crust.data.vertices: + if v.co.z < FOOT - 0.0005: # the burnt edge is ragged: it reaches further out in places + th = math.atan2(v.co.y, v.co.x) + v.co.z -= 0.0016 * (0.5 + 0.5 * an(th * 2.0, 0.0)) * smoothstep(FOOT - 0.0005, FOOT - 0.0033, v.co.z) + crust.data.update() + GV.xf(crust, rx=-PI_ / 2) + P.append(crust) + return P, em + + +def hand_cigar5(): + F = Vector((0, -0.42, 0.9)).normalized() + N = Vector((1, 0, 0)) + A = N.cross(F) + Kc = Vector((-0.024, 0, 0)) - F * 0.03 + H = lambda f, a, n: Kc + F * f + A * a + N * n + S = [] + S.append(GV.ell("palm", H(-0.046, 0.021, -0.002), (0.046, 0.052, 0.0185), (A, F, N), seg=28, rings=18)) + S.append(GV.ell("heel", H(-0.088, 0.024, 0.0), (0.034, 0.026, 0.019), (A, F, N), seg=24, rings=14)) + S.append(GV.ell("thenar", H(-0.062, -0.024, 0.01), (0.019, 0.034, 0.016), (A, F, N), seg=24, rings=14)) + for a in (-0.012, 0.012, 0.035, 0.056): + S.append(GV.ell("knuckle", H(0.0, a, -0.006), (0.011, 0.012, 0.011), (A, F, N), seg=16, rings=10)) + rc = CIG_R + ri, rm = 0.0112, 0.0118 + idx = [H(-0.012, -0.011, -0.001), H(0.004, -0.013, 0.0), H(0.03, -(rc + ri) - 0.001, 0.0), H(0.048, -0.023, 0.004), H(0.062, -0.023, 0.013), + H(0.071, -0.022, 0.022), H(0.077, -0.021, 0.033)] + mid = [H(-0.012, 0.011, -0.001), H(0.004, 0.013, 0.0), H(0.03, rc + rm + 0.001, 0.0), H(0.05, 0.022, 0.005), H(0.065, 0.022, 0.016), + H(0.074, 0.021, 0.027), H(0.079, 0.02, 0.039)] + rng_ = [H(-0.014, 0.035, -0.001), H(0.002, 0.037, 0.0), H(0.03, 0.041, 0.007), H(0.045, 0.042, 0.02), H(0.05, 0.041, 0.034), H(0.047, 0.039, 0.046), + H(0.04, 0.037, 0.052)] + pnk = [H(-0.02, 0.056, -0.001), H(-0.006, 0.058, 0.002), H(0.017, 0.061, 0.01), H(0.029, 0.061, 0.022), H(0.032, 0.059, 0.034), H(0.028, 0.057, 0.043), + H(0.021, 0.055, 0.047)] + digits = [] + for pts, r in ((idx, ri), (mid, rm), (rng_, 0.0112), (pnk, 0.0098)): + digits.append(Digit(pts, r, (0.05, 0.42, 0.72), lambda c, T: N)) + rt = 0.0125 + digits.append(Digit([H(-0.078, -0.028, 0.006), H(-0.058, -0.04, 0.018), H(-0.036, -0.046, 0.026), H(-0.014, -0.044, 0.032), + H(0.004, -0.04, 0.034), H(0.016, -0.035, 0.034)], rt, (0.3, 0.64), lambda c, T: A + N * 0.35, kind="thumb")) + for d in digits: + S.append(d.tube("digit", SKIN)) + P = [] + S.append(shirt_arm(P, H(-0.1, 0.018, 0.0), Vector((-0.35, 0.5, -0.8)), 0.03, look=(-0.6, 1.0, 0.2))) + wrist, heel = H(-0.1, 0.018, 0.0), H(-0.088, 0.024, 0.0) + skin = organic(S, "skin", SKIN, digits, tris=7500, soft=[(wrist + Vector((-0.35, 0.5, -0.8)).normalized() * 0.022, 0.034), (wrist.lerp(heel, 0.5), 0.024)]) + dn, nv = skin["dense"], len(skin.data.vertices) + bvh = BVHTree.FromObject(skin, bpy.context.evaluated_depsgraph_get()) + for d in digits: + P.append(nail(bvh, d)) + transfer_normals(finish([skin] + P, "Hand", ang=60, slots=SLOTS["Hand"]), dn, nv) + Q, em = cigar5() + cig = finish(Q, "Cigar", uv=6.0, ang=50, slots=SLOTS["Cigar"]) + emb = finish([em], "Ember", uv=6.0, ang=70, slots=[EMBER]) + set_origin(emb, (0, FOOT - 0.0067, 0)) + emb.parent = cig + emb.matrix_parent_inverse = Matrix.Identity(4) + cig.rotation_euler = (0, 0, math.pi / 2) + + +# ======================================================================= SM_Phone + +W, Hh, D = GP.W, GP.H, GP.D +BACK, FRONT, EDGE = -D / 2, D / 2, W / 2 +GUARD_E, GUARD_D = 0.0062, 0.0006 # how far the corner guards run along the edges from the corner, and their soft end +SHELL, BAND, BLACK, GLOW, LENS = range(5) +# the band, back to front: (inset from the outline, height on the edges, extra height on the corner guards, slot to the next ring) +BAND_PROF = [(0.0030, -0.0044, 0.0, BAND), (0.0027, -0.0048, -0.0006, BAND), (0.0018, -0.0050, -0.0008, BAND), (0.0009, -0.0048, -0.0007, BAND), + (0.0003, -0.0041, -0.0004, BAND), (0.0, -0.0029, 0.0, BAND), (0.0, -0.0004, 0.0, GLOW), (0.0, 0.0004, 0.0, BAND), + (0.0, 0.0029, 0.0, BAND), (0.0003, 0.0041, 0.0006, BAND), (0.0008, 0.0048, 0.0009, BAND), (0.0012, 0.0050, 0.0010, BAND), + (0.0015, 0.0049, 0.0009, BAND), (0.0018, 0.00452, 0.0004, BAND), (0.0019, 0.0044, 0.0, GLOW), (0.0024, 0.0044, 0.0, None)] + + +def phone_sharp(): + """gc_phone's outline corners, with points added on the long edges where the corner guards end. -> (points, kind, guard weight)""" + S = GP.sharp(W, Hh, GP.CUT, GP.NICK) + pts, kind, wt = [], [], [] + for i in range(8): + a, b = S[i], S[(i + 1) % 8] + pts.append(a) + kind.append("v") + wt.append(1.0) + L = (b - a).length + if L > 0.03: + for t, w in ((GUARD_E - GUARD_D, 1.0), (GUARD_E + GUARD_D, 0.0), (L - GUARD_E - GUARD_D, 0.0), (L - GUARD_E + GUARD_D, 1.0)): + pts.append(a + (b - a) * (t / L)) + kind.append("c") + wt.append(w) + return pts, kind, wt + + +def phone_ring(d, seg=6): + """The outline inset by d, every true corner rounded as gc_phone.outline does (radius ROUND - d / 2), with more points.""" + pts, kind, wt = phone_sharp() + Pp = GP.inset(pts, d) + rr = max(GP.ROUND - d * 0.5, 0.0007) + out, ws = [], [] + n = len(Pp) + for i, p in enumerate(Pp): + if kind[i] == "c": + out.append(p) + ws.append(wt[i]) + continue + a, b = Pp[i - 1], Pp[(i + 1) % n] + q0, q1 = p + (a - p).normalized() * rr, p + (b - p).normalized() * rr + for s in range(seg + 1): + t = s / seg + out.append(q0 * (1 - t) ** 2 + p * 2 * t * (1 - t) + q1 * t ** 2) + ws.append(1.0) + return out, ws + + +def at2(p, y): + return Vector((-p.x, y, p.y)) + + +def slab(bm, pts, F, levels, mats, cap): + """A raised feature: rings of pts inset by levels[k] = (inset, height) mapped by F(u, v, h); the face from ring k to k + 1 takes mats[k], + the top `cap` (None: open). pts counter-clockwise in (u, v), F's h along the outward normal; faces are turned to face outward.""" + rings = [] + dd = [] + for p in pts: # gc_phone.pill repeats a point where two arcs meet + p = Vector(p) + if not dd or (p - dd[-1]).length > 1e-7: + dd.append(p) + if (dd[0] - dd[-1]).length < 1e-7: + dd.pop() + pts = dd + for d, h in levels: + q = GP.inset([Vector(p) for p in pts], d) if d else [Vector(p) for p in pts] + rings.append([bm.verts.new(F(p.x, p.y, h)) for p in q]) + made = [] + n = len(pts) + for k in range(len(rings) - 1): + a, b = rings[k], rings[k + 1] + for i in range(n): + f = bm.faces.new((a[i], a[(i + 1) % n], b[(i + 1) % n], b[i])) + f.material_index = mats[k] + made.append(f) + if cap is not None: + f = bm.faces.new(rings[-1]) + f.material_index = cap + made.append(f) + f.normal_update() + c = sum((Vector(p) for p in pts), Vector((0.0, 0.0))) / n + out = F(c.x, c.y, 1.0) - F(c.x, c.y, 0.0) + if f.normal.dot(out) < 0: + bmesh.ops.reverse_faces(bm, faces=made) + r = bmesh.ops.triangulate(bm, faces=[f], quad_method="BEAUTY", ngon_method="EAR_CLIP") + else: + f = made[0] + f.normal_update() + return made + + +def back_F(shift, base=0.0): + sx, sy = shift + return lambda u, v, h: at2(Vector((u + sx, v + sy)), BACK - base - h) + + +def phone_core(): + """The band (bumper), the back shell and the front glass as one closed mesh, ready for the boolean cuts.""" + bm = bmesh.new() + rings = [] + for d, y, ex, m in BAND_PROF: + pts, ws = phone_ring(d) + rings.append([bm.verts.new(at2(p, y + ex * w)) for p, w in zip(pts, ws)]) + n = len(rings[0]) + for k in range(len(rings) - 1): + a, b = rings[k], rings[k + 1] + for i in range(n): + f = bm.faces.new((a[i], a[(i + 1) % n], b[(i + 1) % n], b[i])) + f.material_index = BAND_PROF[k][3] + f = bm.faces.new(rings[0]) + f.material_index = SHELL + g = bm.faces.new(rings[-1]) + g.material_index = BLACK + bmesh.ops.triangulate(bm, faces=[f, g], quad_method="BEAUTY", ngon_method="EAR_CLIP") + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + return obj_from_bm("core", bm, GP.MATS, ang=34) + + +def phone_cuts(core): + """USB-C port in the bottom edge, speaker holes either side of it, a mic hole in the top edge.""" + bm = bmesh.new() + zb = -Hh / 2 + + def pill_cut(cx, w, h, z0, z1, n=6): + pts = GP.pill(w, h, n) + lo = [bm.verts.new((-(cx + p.x), p.y, z0)) for p in pts] + hi = [bm.verts.new((-(cx + p.x), p.y, z1)) for p in pts] + m = len(pts) + bm.faces.new(list(reversed(lo))) + bm.faces.new(hi) + for i in range(m): + bm.faces.new((lo[i], lo[(i + 1) % m], hi[(i + 1) % m], hi[i])) + pill_cut(0.0, 0.0086, 0.0028, zb - 0.002, zb + 0.0062) + for sx in (-1, 1): + for k in range(4): + pill_cut(sx * (0.0085 + 0.0022 * k), 0.0011, 0.0011, zb - 0.002, zb + 0.0035, n=2) + pill_cut(0.012, 0.0009, 0.0009, Hh / 2 - 0.003, Hh / 2 + 0.002, n=2) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + cutter = obj_from_bm("cutter", bm, [GP.MATS[BLACK]]) + md = core.modifiers.new("cut", "BOOLEAN") + md.operation = "DIFFERENCE" + md.object = cutter + md.solver = "EXACT" + try: + md.material_mode = "TRANSFER" + except Exception: + pass + bake(core) + bpy.data.objects.remove(cutter) + # the walls and floors of the holes are dark + names = [m.name for m in core.data.materials] + kb = names.index(GP.MATS[BLACK]) + for p in core.data.polygons: + c = p.center + inside_bot = c.z > zb + 0.00015 and c.z < zb + 0.0063 and abs(c.y) < 0.0016 and abs(c.x) < 0.0165 + inside_top = c.z < Hh / 2 - 0.00015 and c.z > Hh / 2 - 0.0031 and abs(c.y) < 0.0006 and abs(c.x + 0.012) < 0.0006 + if inside_bot or inside_top: + p.material_index = kb + core.data.update() + return core + + +def guard_plate(bm, mid, d_out=0.0024, d_in=0.0074, h=0.0013, ch=0.0004): + """The back half of a corner guard: a raised plate following the corner, from the band's lip inwards, chamfered on top.""" + rings = {d: phone_ring(d) for d in (d_out, d_out + ch * 0.6, d_in - ch, d_in)} + pts, ws = rings[d_out] + n = len(pts) + run = [i for i in range(n) if ws[i] > 0.5 and (pts[i] - mid).length < 0.03] + # the run in ring order, even when it wraps past index 0 + run.sort() + for k in range(len(run) - 1): + if run[k + 1] - run[k] > 1: + run = run[k + 1:] + run[:k + 1] + break + loop = lambda da, di: [rings[da][0][i] for i in run] + [rings[di][0][i] for i in reversed(run)] + levels = [(loop(d_out, d_in), -0.0002), (loop(d_out, d_in), h - ch), (loop(d_out + ch * 0.6, d_in - ch), h)] + R = [[bm.verts.new(at2(p, BACK - hh)) for p in L] for L, hh in levels] + m = len(R[0]) + made = [] + for a, b in zip(R, R[1:]): + for k in range(m): + f = bm.faces.new((a[k], a[(k + 1) % m], b[(k + 1) % m], b[k])) + f.material_index = BAND + made.append(f) + cap = bm.faces.new(R[-1]) + cap.material_index = BAND + made.append(cap) + cap.normal_update() + if cap.normal.y > 0: + bmesh.ops.reverse_faces(bm, faces=made) + bmesh.ops.triangulate(bm, faces=[cap], quad_method="BEAUTY", ngon_method="EAR_CLIP") + + +def phone_details(): + bm = bmesh.new() + pod = (0.0, Hh / 2 - 0.03) + # the camera bump: a wall, a chamfer, a flat rim and a field a step down + slab(bm, GP.pill(0.079, 0.025, 8), back_F(pod), [(0, -0.0003), (0, 0.0011), (0.0005, 0.0016), (0.0013, 0.0016), (0.0016, 0.00135)], + [BAND, BAND, BAND, BAND], SHELL) + base_f = 0.00135 + for x, R in ((-0.024, 0.0072), (0.0, 0.0072), (0.024, 0.0054)): + c = (pod[0] + x, pod[1]) + g = R - 0.0028 + slab(bm, GP.circle(R, 36), back_F(c, base_f), + [(0, -0.0001), (0, 0.0008), (0.0004, 0.00125), (0.0011, 0.00125), (0.0013, 0.0006), (0.0019, 0.0006), (0.00205, 0.00068), (0.0023, 0.00068), + (0.00245, 0.0006), (0.0028, 0.0006), (0.0028 + g * 0.3, 0.00082), (0.0028 + g * 0.65, 0.00094)], + [BAND, BAND, BAND, BLACK, BLACK, BAND, BAND, BLACK, BLACK, LENS, LENS], LENS) + # the flash window and the light strip under the bump + slab(bm, GP.pill(0.0072, 0.0042, 4), back_F((pod[0] + 0.0345 - 0.0005, pod[1] + 0.0065), base_f), [(0, -0.0001), (0, 0.0003), (0.0004, 0.00045)], + [BAND, BAND], GLOW) + slab(bm, GP.pill(0.05, 0.0014, 3), back_F((0.0, pod[1] - 0.0165)), [(0, -0.0001), (0, 0.00012)], [GLOW], GLOW) + # screws on the ends of the bump and on the corner guards + def screw(c, base): + slab(bm, GP.circle(0.0011, 14), back_F(c, base), [(0, -0.0002), (0, 0.00012), (0.00035, 0.00028), (0.0006, 0.00031)], [BAND, BAND, BAND], BAND) + hexs = [Vector((0.00042 * math.cos(TAU * q / 6 + 0.3), 0.00042 * math.sin(TAU * q / 6 + 0.3))) for q in range(6)] + slab(bm, hexs, back_F(c, base + 0.00031), [(0, 0.00002)], [], BLACK) + for sx in (-1, 1): + screw((sx * 0.0352, pod[1]), base_f) + S = GP.sharp(W, Hh, GP.CUT, GP.NICK) + for i, j in ((7, 0), (1, 2), (3, 4), (5, 6)): + mid = (S[i] + S[j]) / 2 + nrm = Vector(((S[j] - S[i]).y, -(S[j] - S[i]).x)).normalized() + guard_plate(bm, mid) + c = mid - nrm * 0.0047 + screw((c.x, c.y), 0.0013) + # cooling ribs and the company mark, as gc_phone + for i in range(8): + slab(bm, GP.pill(0.056 - abs(i - 3.5) * 0.004, 0.0018, 4), back_F((0.0, -Hh / 2 + 0.024 + i * 0.0048)), + [(0, -0.0001), (0, 0.0004), (0.0002, 0.0006)], [BAND, BAND], BAND) + y = BACK - 0.00012 + GP.blade(bm, (0.0, -0.022), (0.002, 0.03), 0.004, 0.0034, y, GLOW) + GP.blade(bm, (-0.004, -0.022), (-0.024, 0.012), 0.012, 0.0028, y, GLOW) + GP.blade(bm, (0.004, -0.022), (0.024, 0.01), -0.012, 0.0028, y, GLOW) + # the speaker grille low on the back: a raised frame, a perforated plate + gc = (0.0, -Hh / 2 + 0.0132) + slab(bm, GP.pill(0.036, 0.0078, 6), back_F(gc), [(0, -0.0001), (0, 0.00032), (0.0005, 0.00036), (0.0008, 0.00018)], [BAND, BAND, BAND], SHELL) + for row in range(3): + for k in range(13 - (row % 2)): + x = (k - (12 - (row % 2)) / 2) * 0.0022 + slab(bm, GP.circle(0.00045, 8), back_F((gc[0] + x, gc[1] + (row - 1) * 0.0019), 0.00018), [(0, 0.00002)], [], BLACK) + + # the side buttons: chamfered, the long one ridged, with guard fences either side + def side_F(side, v): + x = side * EDGE + return lambda u, w, h: Vector((-(x + side * h), u, v + w)) + + def button(side, v, length, ridges): + F = side_F(side, v) + slab(bm, GP.pill(0.0032, length, 5), F, [(0, -0.0003), (0, 0.0004), (0.0003, 0.0006)], [BAND, BAND], BAND) + for k in range(ridges): + w = (k - (ridges - 1) / 2) * 0.0026 + slab(bm, [Vector((p.x, p.y + w)) for p in GP.pill(0.0021, 0.0006, 2)], F, [(0, 0.00045), (0, 0.0006)], [BAND], BAND) + for u in (-0.00275, 0.00275): + slab(bm, [Vector((p.x + u, p.y)) for p in GP.pill(0.0007, length + 0.004, 3)], F, [(0, -0.0002), (0, 0.00035)], [BAND], BAND) + button(1, 0.03, 0.024, 7) + button(-1, 0.05, 0.017, 0) + button(-1, 0.03, 0.017, 0) + # the USB-C tongue in the port + F = lambda u, v, h: Vector((-u, v, -Hh / 2 + 0.0058 - h)) + slab(bm, GP.pill(0.0066, 0.0007, 2), F, [(0, -0.0006), (0, 0.0028)], [BAND], BAND) + o = obj_from_bm("details", bm, GP.MATS, ang=34) + # the antenna for the relay, ribbed rubber over a collar, the light ring, a domed tip + ax = -(-W / 2 + 0.016) + prof = [(0.0033, -0.0006), (0.0033, 0.0005), (0.0029, 0.0011), (0.0026, 0.0026), (0.0019, 0.0031), (0.0016, 0.0035)] + mats = [BAND] * 5 + for k in range(5): + z0 = 0.0042 + k * 0.0024 + prof += [(0.0015, z0), (0.00172, z0 + 0.0004), (0.00172, z0 + 0.0008), (0.0015, z0 + 0.0012)] + mats += [BAND] * 4 + prof += [(0.0015, 0.0162), (0.0024, 0.0168), (0.0024, 0.0172), (0.0024, 0.0203), (0.0024, 0.0206), (0.0019, 0.0213), (0.0011, 0.0218), (0.0, 0.0220)] + mats += [BAND, BAND, GLOW, BAND, BAND, BAND, BAND, BAND] + ant = lathe5("antenna", prof, GP.MATS, colfn=lambda k, j: mats[min(k, len(mats) - 1)], segs=16, + frame=Matrix.Translation((ax, 0.0, Hh / 2 - 0.0002)), ang=40) + return [o, ant] + + +def phone5(): + core = phone_cuts(phone_core()) + parts = [core] + phone_details() + for q in parts: + q["uv_done"] = True + body = finish(parts, "SM_Phone", ang=34, slots=GP.MATS) + if body.data.uv_layers: + body.data.uv_layers.remove(body.data.uv_layers[0]) # the game's SM_Phone body has no UVs; keep it that way + GP.screen(body) + return body + + +# ======================================================================= SM_PhoneHand + +def phone_hand5(bare=False): + """gc_phone_hand's left hand round the phone, in its frame, as the work glove (or bare). The fingers' lines are gc_phone_hand's, + lifted off the back, the edge and the front just enough to clear the new bumper and the glove's leather.""" + at = GPH.at + g = 0.0 if bare else 0.0011 # leather over the hand + clear = 0.0010 # the bumper's lips and the ribs stand this far off the back and the front + m_main = SKIN if bare else GLOVE + S = [] + S.append(common.sphere("palm", 1.0, tuple(at(-0.025, -0.05, BACK - 0.024)), seg=28, rings=18, m=m_main, scale=(0.045 + g, 0.021 + g, 0.058 + g))) + S.append(common.sphere("heel", 1.0, tuple(at(-0.044, -0.098, BACK - 0.026)), seg=24, rings=14, m=m_main, scale=(0.033 + g, 0.022 + g, 0.036 + g))) + # gc_phone_hand's thenar already dips into the phone's edge; the glove's sits just behind it + th_c = at(-0.06, -0.082, BACK - 0.0195 + (0.0011 - g)) + S.append(common.sphere("thenar", 1.0, tuple(th_c), seg=24, rings=14, m=m_main, scale=(0.02 + g, 0.016 + g, 0.036 + g))) + + def ctr_dir(c, T): + """Towards the nearest point of the phone's box: what the hand closes on.""" + q = Vector((max(-EDGE, min(EDGE, c.x)), max(BACK, min(FRONT, c.y)), max(-Hh / 2, min(Hh / 2, c.z)))) + return q - c + digits = [] + for v, r, ln in ((-0.012, 0.0122, 0.9), (-0.0365, 0.0126, 1.0), (-0.0615, 0.0122, 0.95), (-0.0845, 0.0108, 0.8)): + rg = r + g + behind = BACK - clear - rg * 1.05 + ahead = FRONT + clear + rg * 0.95 + out = EDGE + rg * 1.02 + pts = [(-0.014, v - 0.005, behind - 0.009), (0.016, v - 0.003, behind - 0.003), (0.04, v - 0.001, behind), (out - 0.004, v, behind + 0.004), + (out + 0.001, v + 0.001, -0.002), (out - 0.003, v + 0.002, ahead - 0.005), (out - 0.004 - 0.008 * ln, v + 0.003, ahead)] + digits.append(Digit([at(*p) for p in pts], r, (0.04, 0.44, 0.74), ctr_dir, grow=g)) + r = 0.0128 + rg = r + g + if True: # up the left edge, the thumb just clear of the band, the corner guard and the front lip + tp = [(-0.05, -0.098, BACK - 0.021), (-0.066, -0.078, BACK - 0.009), (-EDGE - rg * 1.05, -0.056, -0.002), (-EDGE - rg * 0.78, -0.036, FRONT + clear + rg * 0.55), + (-EDGE - 0.002, -0.02, FRONT + clear + rg * 0.92)] + digits.append(Digit([at(*p) for p in tp], r, (0.34, 0.68), ctr_dir, grow=g, kind="thumb")) + for d in digits: + S.append(d.tube("digit", m_main)) + # the glove's wrist and gauntlet are thicker than the bare wrist: dropped a little further behind the phone's bottom corner + root = Vector((-0.051, -0.128, BACK - 0.028)) if bare else Vector((-0.052, -0.13, BACK - 0.031)) + way_uvw = Vector((-0.34, -0.8, 0.5)).normalized() + root_b, way_b = at(*root), at(*way_uvw) + P = [] + look = (0.25, 1.0, 0.2) + if bare: + S.append(shirt_arm(P, root_b, way_b, 0.031, look=look, fore=(-0.012, 0.26))) + heel = at(-0.044, -0.098, BACK - 0.026) + skin = organic(S, "skin", SKIN, digits, tris=9000, soft=[(root_b + way_b * 0.022, 0.034), (root_b.lerp(heel, 0.5), 0.024)]) + dn, nv = skin["dense"], len(skin.data.vertices) + bvh = BVHTree.FromObject(skin, bpy.context.evaluated_depsgraph_get()) + for d in digits: + P.append(nail(bvh, d)) + return transfer_normals(finish([skin] + P, "SM_PhoneHand", ang=60, slots=SLOTS["SM_PhoneHand"]), dn, nv) + # the glove's wrist, blended with the palm + pw = lambda s: root_b + way_b * s + S.append(sweep_circle("gwrist", [pw(-0.03), pw(0.0), pw(0.03)], lambda t, l: 0.0335 + 0.002 * t, segs=20, per=4, m=GLOVE, cap=True)) + glove = organic(S, "glove", GLOVE, digits, voxel=0.0007, tris=7000, spec=GLOVE_CREASES, smooth_it=4, + soft=[(root_b + way_b * 0.012, 0.03)]) + bvh = BVHTree.FromObject(bpy.data.objects[glove["dense"]], bpy.context.evaluated_depsgraph_get()) + # seam welts down both sides of every finger, padded knuckle guards, reinforced tips, stitching + for di, d in enumerate(digits): + thumb = d.kind == "thumb" + for side in (-1, 1): + th = side * DEG(86) + s0, s1 = (0.12, 0.765) if not thumb else (0.36, 0.765) + P.append(surface_patch("welt", lambda u, v, th=th, s0=s0, s1=s1, d=d: d.surf(s0 + (s1 - s0) * u, th + (v - 0.5) * 0.11), + lambda u, v: 0.00055 * math.sin(math.pi * v) + 0.00025, 12, 2, 0.0005, GLOVE, bvh=bvh, use_nrm=True)) + if not thumb: + for (s0, s1, half, h, nu) in ((0.0, 0.17, DEG(70), 0.0019, 6), (0.36, 0.5, DEG(58), 0.0013, 5)): + P.append(surface_patch("kpad", lambda u, v, s0=s0, s1=s1, half=half, d=d: d.surf(s0 + (s1 - s0) * u, -half + 2 * half * v), + lambda u, v, h=h: h * smoothstep(0.0, 0.28, u) * smoothstep(0.0, 0.28, 1 - u) * smoothstep(0.0, 0.25, v) * + smoothstep(0.0, 0.25, 1 - v) + 0.0004, nu, 6, 0.0008, GLEATH, bvh=bvh, use_nrm=True)) + # stitches round the pad + L = (s1 - s0) * d.tot + for k in range(int(L / 0.0028)): + for vv in (0.12, 0.88): + ss = s0 + (s1 - s0) * (0.1 + 0.8 * (k + 0.5) / int(L / 0.0028)) + P.append(stitch(bvh, d, ss, -half + 2 * half * vv, along=True, lift=0.0004 + h * 0.55)) + # the reinforced tip + s0, s1, half = 0.78, 0.985, DEG(78) if not thumb else DEG(70) + P.append(surface_patch("tipcap", lambda u, v, d=d, s0=s0, s1=s1, half=half: d.surf(s0 + (s1 - s0) * u, -half + 2 * half * v), + lambda u, v: 0.0006 * smoothstep(0.0, 0.15, u) * smoothstep(0.0, 0.12, v) * smoothstep(0.0, 0.12, 1 - v) + 0.0004, + 6, 8, 0.0008, GLEATH, bvh=bvh, use_nrm=True)) + for k in range(7): + P.append(stitch(bvh, d, s0 + 0.025, -half * 0.85 + 2 * half * 0.85 * k / 6, along=False, lift=0.0009)) + # a patch over the ball of the thumb, stitched + dt = digits[-1] + P.append(surface_patch("tpatch", lambda u, v: dt.surf(0.22 + 0.26 * u, DEG(-50) + DEG(100) * v), + lambda u, v: 0.0008 * smoothstep(0.0, 0.2, u) * smoothstep(0.0, 0.2, 1 - u) * smoothstep(0.0, 0.2, v) * smoothstep(0.0, 0.2, 1 - v) + 0.0004, + 7, 6, 0.0008, GLEATH, bvh=bvh, use_nrm=True)) + # the gauntlet: a leather cuff flaring from the wrist, a rolled edge, a strap and a brass buckle + X = perp(Vector(look), way_b) + Y = way_b.cross(X) + Fw = Matrix((X, Y, way_b)).transposed().to_4x4() + Fw.translation = root_b + gr = lambda s: 0.0352 + 0.0115 * smoothstep(0.0, 0.08, s) + prof = [(gr(s), s) for s in (-0.022, -0.012, 0.0, 0.012, 0.024, 0.036, 0.048, 0.058, 0.066, 0.072)] + prof += [(gr(0.072) + 0.0009, 0.0745), (gr(0.072) + 0.0012, 0.0775), (gr(0.072) + 0.0006, 0.0793), (gr(0.072) - 0.0006, 0.0796), + (gr(0.072) - 0.0014, 0.0785), (gr(0.072) - 0.0016, 0.0740)] + prof = [(0.0336, -0.026)] + prof + P.append(lathe5("gauntlet", prof, [GLEATH], segs=40, frame=Fw, ang=45)) + for k in range(26): # stitches round the gauntlet under the roll + a = TAU * k / 26 + dvec = X * math.cos(a) + Y * math.sin(a) + c = root_b + way_b * 0.0705 + dvec * (gr(0.0705) + 0.0001) + tng = (X * -math.sin(a) + Y * math.cos(a)) + P.append(dash(c, dvec, tng)) + sa, sb = 0.006, 0.019 + P.append(lathe5("strap", [(gr(sa) - 0.0003, sa), (gr(sa) + 0.0013, sa + 0.0006), (gr(sa) + 0.0017, sa + 0.0018), (gr(sb) + 0.0017, sb - 0.0018), + (gr(sb) + 0.0013, sb - 0.0006), (gr(sb) - 0.0003, sb)], [GLEATH], segs=40, frame=Fw, ang=45)) + # the buckle on the strap, facing the viewer + sc = (sa + sb) / 2 + Rb = gr(sc) + 0.0019 + a0 = 0.0 + + def cylp(s, a, rr): + dvec = X * math.cos(a) + Y * math.sin(a) + return root_b + way_b * s + dvec * rr + frame_pts = [] + hw, hl = 0.0105, 0.0085 # half extents round the wrist and along it + for q in range(28): + t = TAU * q / 28 + cx, cy = math.cos(t), math.sin(t) + e = 4.0 + rx = hw * math.copysign(abs(cx) ** (2 / e), cx) + ry = hl * math.copysign(abs(cy) ** (2 / e), cy) + frame_pts.append(cylp(sc + ry, a0 + rx / Rb, Rb + 0.0006)) + bm = bmesh.new() + n = len(frame_pts) + R = [] + for i, c in enumerate(frame_pts): + t = (frame_pts[(i + 1) % n] - frame_pts[i - 1]).normalized() + nrm = (c - (root_b + way_b * (c - root_b).dot(way_b))).normalized() + b_ = t.cross(nrm).normalized() + R.append([bm.verts.new(c + (nrm * math.cos(TAU * k / 8) * 0.00075 + b_ * math.sin(TAU * k / 8) * 0.0009)) for k in range(8)]) + for i in range(n): + A_, B_ = R[i], R[(i + 1) % n] + for k in range(8): + bm.faces.new((A_[k], A_[(k + 1) % 8], B_[(k + 1) % 8], B_[k])) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + P.append(obj_from_bm("buckle", bm, [BRASS], 60)) + P.append(GV.cyl_between("bar", cylp(sc, a0 - hw / Rb, Rb + 0.0006), cylp(sc, a0 + hw / Rb, Rb + 0.0006), 0.0008, BRASS, v=8)) + P.append(GV.cyl_between("prong", cylp(sc, a0, Rb + 0.0011), cylp(sc + hl * 1.05, a0, Rb + 0.0009), 0.00055, BRASS, v=6)) + # the strap's free end through the buckle + P.append(surface_patch("tongue", lambda u, v: (cylp(sc + (v - 0.5) * (sb - sa - 0.004), a0 - hw * 0.8 / Rb + u * 0.034 / Rb, Rb - 0.0001), + (cylp(sc, a0 - hw * 0.8 / Rb + u * 0.034 / Rb, 1.0) - (root_b + way_b * sc))), + lambda u, v: 0.0012 * smoothstep(0, 0.2, v) * smoothstep(0, 0.2, 1 - v) * (1 - smoothstep(0.85, 1.0, u)) + 0.0002, 10, 4, 0.0006, GLEATH)) + # the bare forearm out of the gauntlet, the shirt cuff and the sleeve + fa = shirt_arm(P, root_b, way_b, 0.034, look=look, fore=(0.05, 0.26), skin=False) + P.append(fa) + dn, nv = glove["dense"], len(glove.data.vertices) + return transfer_normals(finish([glove] + P, "SM_PhoneHand", ang=60, slots=SLOTS["SM_PhoneHand"]), dn, nv) + + +def stitch(bvh, d, s, th, along=True, lift=0.0): + """One stitch on a digit: a short raised dash, along the finger or across it.""" + c, dirn = d.surf(s, th) + loc, nrm, _, _ = bvh.find_nearest(c) if bvh else (None, None, None, None) + if loc is not None: + c = loc + dirn = nrm if nrm.dot(dirn) > 0 else -nrm + _, T, D_, B = d.frame(s) + tng = T if along else (D_ * math.sin(th) + B * math.cos(th)) + return dash(c + Vector(dirn).normalized() * lift, dirn, tng) + + +def dash(c, nrm, tng, L=0.0016, w=0.00045, h=0.0003): + nrm = Vector(nrm).normalized() + tng = perp(Vector(tng), nrm) + side = nrm.cross(tng) + M = Matrix((tng, side, nrm)).transposed().to_4x4() + M.translation = Vector(c) + pts = [(L / 2, 0.0), (0.0, w / 2), (-L / 2, 0.0), (0.0, -w / 2)] + bm = bmesh.new() + lo = [bm.verts.new(M @ Vector((x, y, -0.0003))) for x, y in pts] + hi = [bm.verts.new(M @ Vector((x * 0.9, y * 0.7, h))) for x, y in pts] + bm.faces.new(list(reversed(lo))) + bm.faces.new(hi) + for i in range(4): + bm.faces.new((lo[i], lo[(i + 1) % 4], hi[(i + 1) % 4], hi[i])) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + return obj_from_bm("stitch", bm, [STITCH], 80) + + +def phone_hand_build(): + phone_hand5(bare=os.environ.get("GC5_PHONEHAND_GLOVE") != "1") + + +# ======================================================================= build + +BUILDERS = {"SM_HandCan": hand_can_build, "SM_HandCigar": hand_cigar5, "SM_Phone": phone5, "SM_PhoneHand": phone_hand_build, + "SM_BeerCan": lambda: beer_can5(False), "SM_BeerCanCrushed": lambda: beer_can5(True)} + + +def build(names): + common.MODELS = os.path.join(OUT, "fbx") + common.BLENDS = OUT + os.makedirs(common.MODELS, exist_ok=True) + for n in names: + common.reset() + random.seed(zlib.crc32(n.encode()) & 0xffff) + BUILDERS[n]() + bpy.context.view_layer.update() + objs = [o for o in bpy.context.scene.objects if o.type == "MESH"] + for o in sorted(objs, key=lambda o: o.name): + print(f"B5|{n}| {o.name:14s} parent {o.parent.name if o.parent else '-':8s} tris {tri_count([o]):6d} loc {tuple(round(v, 4) for v in o.location)}" + f" mats {[m.name for m in o.data.materials]}") + t = tri_count(objs) + print(f"B5|{n}| tris {t} budget {BUDGET[n]} {'OVER' if t > BUDGET[n] else 'ok'}") + common.export(n) + for m in bpy.data.materials: + m.use_backface_culling = True + common.save_blend(n) + + +def ref_phone_hand(): + """gc_phone_hand.py's own hand (it is not in Assets), exported once as the reference for verify and the before panels.""" + os.makedirs(REF, exist_ok=True) + p = os.path.join(REF, "SM_PhoneHand.fbx") + if not os.path.exists(p): + common.reset() + GPH.hand() + old = common.MODELS + common.MODELS = REF + common.export("SM_PhoneHand") + common.MODELS = old + return p + + +def old_path(n): + return ref_phone_hand() if n == "SM_PhoneHand" else os.path.join(GAME, n + ".fbx") + + +# ======================================================================= verify + +def snapshot(path): + import gc_up5_check as C5 + return C5.snapshot(path) + + +def load_only(path): + bpy.ops.wm.read_factory_settings(use_empty=True) + bpy.ops.import_scene.fbx(filepath=path) + bpy.context.view_layer.update() + return {o.name: o for o in bpy.context.scene.objects} + + +def screen_data(path): + objs = load_only(path) + s = objs["Screen"] + me = s.data + uvl = me.uv_layers.active + loops = [] + for p in me.polygons: + for li in p.loop_indices: + v = me.vertices[me.loops[li].vertex_index].co + w = s.matrix_world @ v + uv = uvl.data[li].uv + loops.append((round(w.x, 6), round(w.y, 6), round(w.z, 6), round(uv.x, 5), round(uv.y, 5))) + # winding: the screen's triangles face +Y (the viewer) and their UVs turn the same way + faces = [] + for p in me.polygons: + ls = list(p.loop_indices) + a, b, c = [uvl.data[i].uv for i in ls[:3]] + uv_area = (b - a).cross(c - a) if hasattr(b - a, "cross") else (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x) + nrm = (s.matrix_world.to_3x3() @ p.normal) + faces.append((round(nrm.y, 3), 1 if uv_area > 0 else -1)) + # where the display's corners land in UV + return dict(loops=sorted(loops), faces=sorted(faces), mw=[tuple(round(x, 6) for x in r) for r in s.matrix_world], parent=s.parent.name if s.parent else None, + name_uv=uvl.name, mats=[m.name.split(".")[0] for m in me.materials]) + + +def overlap_count(path_body, path_hand, body_name="SM_Phone", hand_name="SM_PhoneHand"): + bpy.ops.wm.read_factory_settings(use_empty=True) + bpy.ops.import_scene.fbx(filepath=path_body) + bpy.ops.import_scene.fbx(filepath=path_hand) + bpy.context.view_layer.update() + dg = bpy.context.evaluated_depsgraph_get() + objs = {o.name.split(".")[0]: o for o in bpy.context.scene.objects if o.type == "MESH"} + b = objs[body_name] + h = [o for n, o in objs.items() if n.startswith(hand_name)][0] + + def tree(o): + me = o.data + vs = [o.matrix_world @ v.co for v in me.vertices] + return BVHTree.FromPolygons(vs, [tuple(p.vertices) for p in me.polygons]), vs + tb, vb = tree(b) + th, vh = tree(h) + pairs = tb.overlap(th) + # how deep: hand vertices inside the phone body (ray parity along +X) + inside = 0 + for v in vh: + if not (-EDGE - 0.002 < v.x < EDGE + 0.002 and BACK - 0.004 < v.y < FRONT + 0.003 and -Hh / 2 - 0.002 < v.z < Hh / 2 + 0.03): + continue + cnt, o_ = 0, v.copy() + dvec = Vector((1, 0.0137, 0.0071)).normalized() + while cnt < 50: + hit = tb.ray_cast(o_, dvec) + if hit[0] is None: + break + cnt += 1 + o_ = hit[0] + dvec * 1e-6 + if cnt % 2 == 1: + inside += 1 + return len(pairs), inside + + +def verify(names): + import gc_up5_check as C5 + bad = 0 + for n in names: + old = snapshot(old_path(n)) + new = snapshot(os.path.join(OUT, "fbx", n + ".fbx")) + print(f"V5P|{n} (reference: {'gc_phone_hand.py build' if n == 'SM_PhoneHand' else 'Assets/Art/Models'})") + if set(old) != set(new): + print(f"V5P| FAIL objects differ: old {sorted(old)} new {sorted(new)}") + bad += 1 + for k in sorted(set(old) & set(new)): + o, w = old[k], new[k] + dloc = max(abs(a - b) for a, b in zip(o[2], w[2])) + drot = max(abs(a - b) for a, b in zip(o[3], w[3])) + dsc = max(abs(a - b) for a, b in zip(o[4], w[4])) + ok = o[0] == w[0] and o[1] == w[1] and dloc < 1e-4 and drot < 1e-4 and dsc < 1e-4 + bad += 0 if ok else 1 + ext = lambda s: tuple(round(b - a, 4) for a, b in zip(s[5], s[6])) + dmin = max(abs(a - b) for a, b in zip(o[5], w[5])) + dmax = max(abs(a - b) for a, b in zip(o[6], w[6])) + print(f"V5P| {'ok ' if ok else 'FAIL'} {k:<12} type {w[0]} parent {w[1]} origin {tuple(round(x, 4) for x in w[2])} (d {dloc:.1e}) rot " + f"{tuple(round(math.degrees(x), 2) for x in w[3])} (d {drot:.1e}) scale d {dsc:.1e}") + print(f"V5P| bbox old {tuple(round(x, 4) for x in o[5])}..{tuple(round(x, 4) for x in o[6])} size {ext(o)}") + print(f"V5P| bbox new {tuple(round(x, 4) for x in w[5])}..{tuple(round(x, 4) for x in w[6])} size {ext(w)} (max corner shift {max(dmin, dmax) * 1000:.2f} mm)") + print(f"V5P| tris {o[7]} -> {w[7]}") + extra = sorted(set(w[8]) - set(o[8])) + gone = sorted(set(o[8]) - set(w[8])) + nomat = sorted(m for m in set(w[8]) if not os.path.exists(os.path.join(ROOT, "Assets", "Art", "Materials", m + ".mat"))) + print(f"V5P| slots old {o[8]}") + print(f"V5P| slots new {w[8]} added: {extra or 'none'} dropped: {gone or 'none'} without a .mat: {nomat or 'none'}") + if nomat or (gone and n != "SM_PhoneHand"): + bad += 1 + if n == "SM_Phone": + a = screen_data(old_path(n)) + b = screen_data(os.path.join(OUT, "fbx", n + ".fbx")) + same_loops = len(a["loops"]) == len(b["loops"]) and all(max(abs(p - q) for p, q in zip(x, y)) < 2e-6 for x, y in zip(a["loops"], b["loops"])) + same_faces = a["faces"] == b["faces"] + same_mw = a["mw"] == b["mw"] and a["parent"] == b["parent"] + uvs = [l[3:] for l in b["loops"]] + u0, u1 = min(u for u, v in uvs), max(u for u, v in uvs) + v0, v1 = min(v for u, v in uvs), max(v for u, v in uvs) + ok = same_loops and same_faces and same_mw and a["mats"] == b["mats"] + bad += 0 if ok else 1 + print(f"V5P| {'ok ' if ok else 'FAIL'} Screen: {len(b['loops'])} loops, positions + UVs identical to the game FBX: {same_loops}; " + f"winding (normal y, UV turn) identical: {same_faces} {sorted(set(b['faces']))}; transform + parent identical: {same_mw}; " + f"UV layer {b['name_uv']} mats {b['mats']}") + print(f"V5P| Screen UV range u {u0:.4f}..{u1:.4f} v {v0:.4f}..{v1:.4f} (bounding box of the cut-corner display = 0..1)") + # nothing of the body in front of the display + objs = load_only(os.path.join(OUT, "fbx", n + ".fbx")) + body = objs["SM_Phone"] + poly = [Vector((-p.x, p.y)) for p in GP.outline(GP.BEZEL)] + yscr = 0.0046 + worst = -1.0 + vs = [body.matrix_world @ v.co for v in body.data.vertices] + tb = BVHTree.FromPolygons(vs, [tuple(q.vertices) for q in body.data.polygons]) + pl = [(p.x, p.y) for p in poly] + nray = 0 + for i in range(41): # rays straight down onto the display, edge to edge + for j in range(81): + x, z = -0.0475 + 0.095 * i / 40, -0.1035 + 0.207 * j / 80 + if not GV.inside2((x, z), pl): + continue + hit = tb.ray_cast(Vector((x, 0.05, z)), Vector((0, -1, 0))) + nray += 1 + if hit[0] is not None: + worst = max(worst, hit[0].y) + ok = worst < yscr + bad += 0 if ok else 1 + print(f"V5P| {'ok ' if ok else 'FAIL'} nothing of the body over the display: highest body surface under {nray} rays inside the Screen outline y = {worst:.5f} " + f"(Screen at {yscr})") + slots = [m.name.split(".")[0] for m in body.data.materials] + gs = [i for i, m in enumerate(slots) if m.startswith("M_PhoneGlow")] + print(f"V5P| {'ok ' if gs else 'FAIL'} Phone.cs: one body renderer + Screen, glow slot found by name at index {gs}") + bad += 0 if gs else 1 + if n == "SM_PhoneHand": + for tag, ph, hd in (("old hand on old phone", os.path.join(GAME, "SM_Phone.fbx"), ref_phone_hand()), + ("old hand on new phone", os.path.join(OUT, "fbx", "SM_Phone.fbx"), ref_phone_hand()), + ("new glove on new phone", os.path.join(OUT, "fbx", "SM_Phone.fbx"), os.path.join(OUT, "fbx", "SM_PhoneHand.fbx"))): + if not os.path.exists(ph) or not os.path.exists(hd): + continue + pairs, inside = overlap_count(ph, hd) + okc = pairs == 0 and inside == 0 + if tag.startswith("new"): + bad += 0 if okc else 1 + print(f"V5P| {'ok ' if okc else 'note' if not tag.startswith('new') else 'FAIL'} clipping, {tag}: intersecting triangle pairs {pairs}, " + f"hand vertices inside the phone {inside}") + if n in ("SM_HandCan", "SM_HandCigar"): + # TreatHand needs: the item, its tab / ember by name, the Hand to switch off + need = {"SM_HandCan": ["Hand", "Can", "Tab"], "SM_HandCigar": ["Hand", "Cigar", "Ember"]}[n] + miss = [x for x in need if x not in new] + print(f"V5P| {'ok ' if not miss else 'FAIL'} TreatHand names {need} present") + bad += 1 if miss else 0 + # contact: how close the fingers come to the item, before and after + for tag, p in (("old", old_path(n)), ("new", os.path.join(OUT, "fbx", n + ".fbx"))): + objs = load_only(p) + h = objs["Hand"] + item = objs["Can" if n == "SM_HandCan" else "Cigar"] + dg = bpy.context.evaluated_depsgraph_get() + vs = [item.matrix_world @ v.co for v in item.data.vertices] + ti = BVHTree.FromPolygons(vs, [tuple(q.vertices) for q in item.data.polygons]) + hv = [h.matrix_world @ v.co for v in h.data.vertices] + th_ = BVHTree.FromPolygons(hv, [tuple(q.vertices) for q in h.data.polygons]) + ds = [ti.find_nearest(v)[3] for v in hv if (v - Vector((0, 0, 0))).length < 0.12] + near = sorted(ds)[:200] + npairs = len(ti.overlap(th_)) + if tag == "new" and npairs: + bad += 1 + print(f"V5P| {'FAIL' if tag == 'new' and npairs else ' '} {tag}: hand to {item.name}: closest {min(ds) * 1000:.2f} mm, " + f"200th closest {near[-1] * 1000:.2f} mm, intersecting triangle pairs {npairs}") + print("V5P|RESULT|" + ("OK" if bad == 0 else f"{bad} problem(s)")) + + +# ======================================================================= review renders + +# (tag, target or None for the whole model, radius, elev, azim) +VIEWS = { + "SM_HandCan": [("full", (-0.03, 0.03, -0.03), 0.16, 8, 160), ("back", (-0.02, 0.0, -0.02), 0.13, 12, -25), ("lid", (0.0, 0.0, 0.056), 0.034, 58, 165), + ("tab", (0.0, 0.004, 0.058), 0.017, 40, 200), ("fingers", (0.03, 0.012, 0.0), 0.05, 10, 140), ("nails", (0.04, 0.006, 0.034), 0.016, 20, 75), ("cuff", (-0.15, 0.137, -0.29), 0.075, 25, 150), + ("bottom", (0.0, 0.0, -0.055), 0.05, -45, 170)], + "SM_HandCigar": [("full", (-0.02, 0.02, -0.02), 0.16, 10, 150), ("back", (-0.03, 0.0, -0.02), 0.13, 15, -60), ("ember", (0.064, 0.0, 0.0), 0.022, 15, 120), + ("band", (-0.035, 0.0, 0.0), 0.03, 30, 170), ("fingers", (0.0, 0.0, 0.0), 0.06, 20, 110), ("cuff", (-0.18, 0.15, -0.3), 0.075, 25, 160)], + "SM_Phone": [("front", (0.0, 0.0, 0.01), 0.125, 8, 162), ("back", (0.0, 0.0, 0.01), 0.125, 12, -24), ("corner", (-0.044, 0.002, 0.098), 0.022, 28, 150), + ("bump", (0.0, -0.006, 0.076), 0.045, 22, -15), ("port", (0.0, 0.0, -0.106), 0.026, -40, 165), ("buttons", (-0.05, 0.0, 0.035), 0.036, 22, -60), ("guard", (0.04, -0.004, -0.1), 0.022, 35, 20), + ("antenna", (-0.034, 0.0, 0.112), 0.022, 15, -150)], + "SM_BeerCan": [("full", (0.0, 0.0, 0.0), 0.075, 22, -30), ("back", (0.0, 0.0, 0.0), 0.075, 22, 150), ("lid", (0.0, 0.0, 0.056), 0.034, 58, -15), + ("bottom", (0.0, 0.0, -0.055), 0.045, -50, 20)], + "SM_BeerCanCrushed": [("full", (0.0, 0.0, 0.0), 0.07, 22, -30), ("back", (0.0, 0.0, 0.0), 0.07, 30, 140), ("side", (0.0, 0.0, 0.0), 0.07, 4, -90), + ("top", (0.0, 0.0, 0.02), 0.06, 65, 10)], + "SM_PhoneHand": [("front", (0.0, 0.01, -0.05), 0.17, 6, 168), ("back", (0.0, -0.01, -0.05), 0.17, 10, -20), ("fingertips", (-0.05, 0.01, -0.048), 0.05, 20, 160), + ("knuckles", (-0.02, -0.03, -0.05), 0.075, 12, -40), ("thumb", (0.055, 0.005, -0.06), 0.05, 15, 140), ("wrist", (0.065, 0.06, -0.15), 0.07, 20, 150)], +} + + +def _with_phone(n, which): + if n != "SM_PhoneHand": + return None + return os.path.join(GAME, "SM_Phone.fbx") if which == "old" else os.path.join(OUT, "fbx", "SM_Phone.fbx") + + +def views(names): + import gc_up5_check as C5 + os.makedirs(PANELS, exist_ok=True) + tags = os.environ.get("GC5_VIEWS") + only = os.environ.get("GC5_ONLY") + for n in names: + for which, path in (("old", old_path(n)), ("new", os.path.join(OUT, "fbx", n + ".fbx"))): + if only and which != only: + continue + bpy.ops.wm.read_factory_settings(use_empty=True) + C5.load_fbx(path) + ph = _with_phone(n, which) + if ph: + C5.load_fbx(ph) + C5.lights() + for tag, tgt, rad, el, az in VIEWS[n]: + if tags and tag not in tags.split(","): + continue + C5.shoot(os.path.join(PANELS, f"{n}_{tag}_{which}.png"), Vector(tgt), rad, el, az) + + +# TreatHand / Phone poses: (tag, pivot position, pivot euler (Unity), flip the model 180 about Y, show the Hand) +FPV = { + "SM_HandCan": [("fpv", (0.17, -0.15, 0.33), (-6, -12, 6), True, False), ("fpv_hand", (0.17, -0.15, 0.33), (-6, -12, 6), True, True), + ("fpv_drink", (0.075, -0.085, 0.25), (-45, -18, 22), True, False)], + "SM_HandCigar": [("fpv", (0.16, -0.14, 0.33), (-4, -8, -4), True, False), ("fpv_hand", (0.16, -0.14, 0.33), (-4, -8, -4), True, True)], + "SM_Phone": [("fpv", (-0.215, -0.012, 0.31), (4, -27, 4), False, True), ("fpv_up", (0.0, 0.0, 0.207), (0, 0, 0), False, True)], + "SM_PhoneHand": [("fpv", (-0.215, -0.012, 0.31), (4, -27, 4), False, True)], +} + + +def fpv(names): + import gc_up5_check as C5 + M = Matrix(((-1, 0, 0, 0), (0, 0, -1, 0), (0, 1, 0, 0), (0, 0, 0, 1))) + os.makedirs(PANELS, exist_ok=True) + for n in names: + for tag, pos, eu, flip, show_hand in FPV.get(n, []): + for which, path in (("old", old_path(n)), ("new", os.path.join(OUT, "fbx", n + ".fbx"))): + bpy.ops.wm.read_factory_settings(use_empty=True) + rig = Matrix.Translation(Vector(pos)) @ C5.euler(*eu) + if flip: + rig = rig @ Matrix.Rotation(math.pi, 4, "Y") + W_ = M @ rig @ M.inverted() + objs = C5.load_fbx(path) + ph = _with_phone(n, which) + if ph: + objs += C5.load_fbx(ph) + for o in objs: + if o.name.startswith("Hand") and not show_hand: + o.hide_render = True + if o.parent is None: + o.matrix_world = W_ @ o.matrix_world + sc = bpy.context.scene + cam_d = bpy.data.cameras.new("c") + cam_d.sensor_fit = "VERTICAL" + cam_d.angle = math.radians(62) + cam_d.clip_start = 0.01 + cam = common.link(bpy.data.objects.new("c", cam_d)) + cam.rotation_euler = (math.radians(90), 0, math.pi) + sc.camera = cam + C5.lights((0.55, 0.72, 0.42), 0.7) + sc.render.resolution_x, sc.render.resolution_y = 1280, 720 + sc.render.filepath = os.path.join(PANELS, f"{n}_{tag}_{which}.png") + bpy.ops.render.render(write_still=True) + + +if __name__ == "__main__": + args = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [] + mode = args[0] if args and args[0] in ("build", "verify", "views", "fpv") else "build" + names = [a for a in args if a in NAMES] or NAMES + {"build": build, "verify": verify, "views": views, "fpv": fpv}[mode](names) diff --git a/ArtSource/Blender/scripts/gc_up5_tools.py b/ArtSource/Blender/scripts/gc_up5_tools.py new file mode 100644 index 0000000..a446e62 --- /dev/null +++ b/ArtSource/Blender/scripts/gc_up5_tools.py @@ -0,0 +1,2164 @@ +"""GRASS CUTTER - fifth round of the hand tools: a detail pass. Pilot: SM_Tool_WideScythe, SM_Tool_Scythe, SM_Tool_GardenShears; then the +other blade tools: SM_Tool_NailScissors, SM_Tool_Sickle, SM_Tool_Hammer, SM_Tool_LongScythe, and SM_Tool_Shears (the old file name of the +garden shears: the game's SM_Tool_Shears.fbx is still round 2's copy of them on the same frame and no tool uses it, so it is the round 5 +garden shears again under that name). + +Round 4 (gc_up4_tools) gave the tools their real shapes, but up close in first person the parts still read as placeholders: rods for braces, +a hex tube for a turnbuckle, a box with two bolts for the blade mount, plain bands for clamps. This round keeps round 4's frame exactly +(pivots, axes, lengths, grip points, object names and origins, material slot names) and models the parts properly: + + blades a real section: a fine edge, a bright ground bevel, a flat hammered cheek (mottled pack greys plus a little dimpling), + a rounded spine, a beard where the heel curves up into the mount, the heel thickening where it is forged into the tang + backs the WideScythe's riveted back is a channel clasping the spine, domed rivet heads on top, peened tails under it + mounts a forged shoe round the snath end: rounded edges, a lip round the entry, jaw plates riveted over the blade where it leaves, + through-bolts with washers, hex heads, nuts and threads poking out, a driven timber wedge with a mushroomed head + braces flat bars forged flat into bolt eyes, bolted into clevis lugs welded (with a bead) to a saddle strap and to the blade back; + the turnbuckle is an open brass frame with two threaded rods and lock nuts + clamps straps with rolled edges and pinch ears, a bolt through the ears + wood turned nibs: brass ferrule, collars and grooves, a spiral leather wrap, a knob held by a nut; grain runs along every part + shears a pivot bolt with a dished washer, a nut with the thread through it, riveted ferrules, rubber bumpers in steel cups, + ridged rubber grips, a sharper branch notch + +Hammered steel: the cheek faces are triangulated and each takes one of five close greys (P_HMD 88, P_HM1 92, P_G1, P_HM2 99, P_HML 107, +all from the pack atlas) from a smooth noise field, so a hammer mark shades through next-door steps instead of a face jumping a whole +step. The ground bevel is the brightest grey (P_WHITE) behind a dark grind line (P_DGREY), the edge a honed line (P_G5). Every P_ slot +becomes M_Pack, so the game sees no new material. +Shoes (scythe mounts) are swept forged pillows that draw in towards the blade, with a swelled socket collar round the snath; the wedge +is a tapered timber block with a mushroomed end-grain head; strap ears are half as big again as the pilot's. + +Output never goes to Assets: .blend, fbx/.fbx in ArtSource/Blender/remaster_v3_tools (export settings of common.py). +Run (absolute paths): + blender -b --factory-startup --python C:/Github/Grass-Cutters/ArtSource/Blender/scripts/gc_up5_tools.py -- [SM_Tool_WideScythe ...] +Review renders and the review scene: gc_up5_check.py. +""" +import sys, os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import common +import gc_up4_tools as U4 +from gc_up4_tools import * # noqa: F401,F403 (round 4 helpers, gc_up3_base, kit, materials) +import gc_up_kit as KIT +import gc_up_tools as UT +import gc_up_machines as UM +import gc_farm_tools as FT +from os_crew import lathe, catmull + +TAU = 2 * math.pi +DEG = math.radians +OUT = os.path.join(common.ROOT, "ArtSource", "Blender", "remaster_v3_tools") + +# hammered steel: two neutral greys either side of P_G1, from the grey ramp along the bottom of the pack atlas +UM.SW["HMD"] = (.2021, .0107, "#585858") +UM.SW["HML"] = (.2334, .0107, "#6B6B6B") +for _k in ("HMD", "HML"): + common.MATDEFS["P_" + _k] = {"name": "P_" + _k, "color": UM.SW[_k][2]} +HMD, HML = "P_HMD", "P_HML" +# two more steps between them, from the cool grey column of the atlas (u .1236): 88, 92, (G1 95-99), 99, 107. Five close greys let the +# hammered mottle shade from one into the next instead of jumping a whole step face by face. +UM.SW["HM1"] = (.1236, .2534, "#5C5D5E") +UM.SW["HM2"] = (.1236, .278, "#636466") +for _k in ("HM1", "HM2"): + common.MATDEFS["P_" + _k] = {"name": "P_" + _k, "color": UM.SW[_k][2]} +HM1, HM2 = "P_HM1", "P_HM2" +# blade finish: the bright ground bevel, the honed edge line, the dark line where the grind meets the flat +BEV, EDGE, GLINE = WHT, G5, DGY + + +def _hash3(i, j, k, seed): + n = (i * 73856093) ^ (j * 19349663) ^ (k * 83492791) ^ (seed * 2654435761) + n &= 0xffffffff + n = ((n ^ (n >> 13)) * 1274126177) & 0xffffffff + n ^= n >> 16 + return (n & 0xffff) / 32767.5 - 1.0 + + +def vnoise(p, seed=0): + """Smooth value noise in [-1, 1] at point p (lattice spacing 1).""" + x, y, z = p + i, j, k = math.floor(x), math.floor(y), math.floor(z) + fx, fy, fz_ = x - i, y - j, z - k + sx, sy, sz = (fx * fx * (3 - 2 * fx), fy * fy * (3 - 2 * fy), fz_ * fz_ * (3 - 2 * fz_)) + acc = 0.0 + for di in (0, 1): + for dj in (0, 1): + for dk in (0, 1): + w = (sx if di else 1 - sx) * (sy if dj else 1 - sy) * (sz if dk else 1 - sz) + acc += w * _hash3(i + di, j + dj, k + dk, seed) + return acc + + +def hammer_field(p, scale=0.02, seed=1): + """Hammer marks: soft blotches about `scale` across, a finer layer over them. Roughly -1..1.""" + p = Vector(p) / scale + return (0.62 * vnoise(p, seed) + 0.28 * vnoise(p * 2.3 + Vector((7.1, 3.3, 1.7)), seed + 1) + + 0.1 * vnoise(p * 5.1 + Vector((1.3, 9.2, 4.4)), seed + 2)) * 1.45 + + +def hammer_mottle(o, slot, levels=None, scale=0.02, seed=1, bias=0.0, cuts=(-0.78, -0.26, 0.26, 0.78), frame=None, tri=True): + """Hammered steel on the faces of material `slot` of o: those faces are triangulated (so a blotch's outline runs on diagonals, not + in squares) and each takes one of five close greys (dark .. light; the middle one defaults to the slot's own material) from a smooth + noise field at its centre. The five greys are next-door steps, so a blotch shades through them like a soft stain. + frame: a matrix taking the mesh's coordinates to the space the noise lives in (the blade's own frame keeps the marks fixed to it).""" + me = o.data + names = [m.name if m else "" for m in me.materials] + if levels is None: + levels = (HMD, HM1, names[slot], HM2, HML) + idx = [] + for nm in levels: + if nm not in names: + me.materials.append(mat(nm)) + names.append(nm) + idx.append(names.index(nm)) + bm = bmesh.new() + bm.from_mesh(me) + fs = [f for f in bm.faces if f.material_index == slot] + if tri and fs: + r = bmesh.ops.triangulate(bm, faces=fs, quad_method="BEAUTY", ngon_method="BEAUTY") + fs = [f for f in r["faces"]] + Fi = frame if frame is not None else Matrix.Identity(4) + for f in fs: + v = hammer_field(Fi @ f.calc_center_median(), scale, seed) + bias + k = sum(1 for c in cuts if v > c) + f.material_index = idx[k] + bm.to_mesh(me) + bm.free() + me.update() + return o + + +# natural jute twine, from the atlas' rope column +UM.SW["JUTE"] = (.0484, .3276, "#9B835A") +common.MATDEFS["P_JUTE"] = {"name": "P_JUTE", "color": UM.SW["JUTE"][2]} +JUTE = "P_JUTE" + +# Mottle by UV: the faces keep M_Pack and each vertex gets a UV along a ramp of the atlas, from a smooth noise field. The ramp is stepped, +# but the steps now fall on smooth contour lines across the faces instead of on the faces' edges, so a hammer mark has a soft outline +# however close the camera gets. (u, v) centre, (du, dv) per unit of the field, clamp on the moving axis. +STEEL_RAMP = ((0.1236, 0.2656), (0.0, 0.028), (0.2215, 0.3110)) # the cool grey column: 87 | 92 | 99 | 109 +FORGE_RAMP = ((0.1709, 0.0107), (0.017, 0.0), (0.1275, 0.2140)) # the bottom grey ramp: 52 | 69 | 88 (forge scale on dark iron) + + +def hammer_uv(o, slot, ramp=STEEL_RAMP, scale=0.02, seed=1, frame=None, bias=0.0): + """Hammered or forged steel on the faces of material `slot`: the slot becomes M_Pack and every vertex of those faces takes a UV on + `ramp` from hammer_field at the vertex (in `frame`'s space). The other P_ slots get their swatches from pack_uv as usual; the object is + marked uv_done so nothing box-maps over it.""" + me = o.data + me.materials[slot] = mat("M_Pack") + (u0, v0), (du, dv), (lo, hi) = ramp + Fi = frame if frame is not None else Matrix.Identity(4) + bm = bmesh.new() + bm.from_mesh(me) + uvl = bm.loops.layers.uv.verify() + vals = {} + for f in bm.faces: + if f.material_index != slot: + continue + for lp in f.loops: + k = vals.get(lp.vert.index) + if k is None: + k = vals[lp.vert.index] = hammer_field(Fi @ lp.vert.co, scale, seed) + bias + u, w = u0 + du * k, v0 + dv * k + if du: + u = max(lo, min(hi, u)) + else: + w = max(lo, min(hi, w)) + lp[uvl].uv = (u, w) + bm.to_mesh(me) + bm.free() + me.update() + o["uv_done"] = True + return o + + +# Hardware level of detail: inside a builder wrapped by _lod, the small fixings (the hidden nut side of bolts, washers, threads, rivet +# tails, weld beads, strap ears) are built with fewer segments. Builders not wrapped (the other scripts') get the full counts. +HW_LOD = [0] + + +def _lod(fn): + def run(*a, **k): + HW_LOD[0] = 1 + try: + return fn(*a, **k) + finally: + HW_LOD[0] = 0 + run.__name__, run.__doc__ = fn.__name__, fn.__doc__ + return run + + +# ======================================================================= frames and sections + +def fz(c, n, ref=None): + """Local +Z -> n at c, local +X towards ref (projected), so a hex can be turned on purpose.""" + n = Vector(n).normalized() + r = Vector(ref) if ref is not None else (Vector((1, 0, 0)) if abs(n.x) < 0.9 else Vector((0, 1, 0))) + x = (r - n * r.dot(n)) + if x.length < 1e-6: + x = n.orthogonal() + x.normalize() + y = n.cross(x) + M = Matrix((x, y, n)).transposed().to_4x4() + M.translation = Vector(c) + return M + + +def circ(r, n=12, ph=None): + ph = PI / n if ph is None else ph + ra, rb = r if isinstance(r, tuple) else (r, r) + return [(ra * math.cos(ph + TAU * k / n), rb * math.sin(ph + TAU * k / n)) for k in range(n)] + + +def rrect(hw, hh, rc, nc=3): + """Rounded rectangle, counter-clockwise from the +a +b corner; 4 * (nc + 1) points. Face j: j % (nc + 1) == nc is a flat.""" + rc = min(rc, hw * 0.98, hh * 0.98) + pts = [] + for cx, cy, a0 in ((hw - rc, hh - rc, 0), (-(hw - rc), hh - rc, 90), (-(hw - rc), -(hh - rc), 180), (hw - rc, -(hh - rc), 270)): + for j in range(nc + 1): + a = DEG(a0 + 90 * j / nc) + pts.append((cx + rc * math.cos(a), cy + rc * math.sin(a))) + return pts + + +def frames(C, ref=None): + """Parallel-transport frames along a polyline: tangents, N (across, starts towards ref), B = T x N.""" + n = len(C) + T = [(C[min(i + 1, n - 1)] - C[max(i - 1, 0)]).normalized() for i in range(n)] + r = Vector(ref) if ref is not None else (Vector((1, 0, 0)) if abs(T[0].x) < 0.9 else Vector((0, 0, 1))) + N = (r - T[0] * r.dot(T[0])).normalized() + Ns, Bs = [], [] + for i in range(n): + N = (N - T[i] * N.dot(T[i])).normalized() + Ns.append(N) + Bs.append(T[i].cross(N)) + return T, Ns, Bs + + +def arclen(C): + L = [0.0] + for a, b in zip(C, C[1:]): + L.append(L[-1] + (b - a).length) + return L + + +def sweep(name, C, sec, mats, colfn=None, uv=None, cap0=True, cap1=True, ang=30, ref=None, frm=None): + """A solid along polyline C. sec(s, i) -> [(a, b)] across N and along B (same count every ring). + colfn(i, j) -> slot of the face from ring i to i + 1, point j to j + 1 (caps: colfn(-1, -1), colfn(n, -1)). + uv = (u0, uw, scale): timber UVs, U round the section inside one board of the texture, V along the arc (grain along the part).""" + C = [Vector(p) for p in C] + T, N, B = frm or frames(C, ref) + L = arclen(C) + bm = bmesh.new() + uvl = bm.loops.layers.uv.verify() + R = [] + for i, c in enumerate(C): + s = L[i] / max(L[-1], 1e-9) + R.append([bm.verts.new(tuple(c + N[i] * a + B[i] * b)) for a, b in sec(s, i)]) + m = len(R[0]) + for i in range(len(R) - 1): + for j in range(m): + k = (j + 1) % m + f = bm.faces.new((R[i][j], R[i][k], R[i + 1][k], R[i + 1][j])) + f.material_index = colfn(i, j) if colfn else 0 + if uv: + u0, uw, sc = uv + ua, ub = u0 - uw + 2 * uw * j / m, u0 - uw + 2 * uw * (j + 1) / m + for lp, (uu, vv) in zip(f.loops, ((ua, L[i]), (ub, L[i]), (ub, L[i + 1]), (ua, L[i + 1]))): + lp[uvl].uv = (uu, vv * sc) + caps = [] + if cap0: + caps.append(bm.faces.new(list(reversed(R[0])))) + caps[-1].material_index = colfn(-1, -1) if colfn else 0 + if cap1: + caps.append(bm.faces.new(R[-1])) + caps[-1].material_index = colfn(len(R), -1) if colfn else 0 + if uv: + for f in caps: + for lp in f.loops: + lp[uvl].uv = (uv[0] + (lp.vert.co.x - lp.vert.co.y) * 2.0, lp.vert.co.z * 2.0) + if caps: + bmesh.ops.triangulate(bm, faces=[f for f in caps if len(f.verts) > 4], ngon_method="EAR_CLIP") + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + idx = [f.material_index for f in bm.faces] + o = mesh_obj(name, bm) + set_mats(o, *mats) + o.data.polygons.foreach_set("material_index", idx) + o.data.update() + smooth(o, ang) + if uv: + o["uv_done"] = True + return o + + +def bprism(name, outline, z0, z1, mats, bev=0.0, segs=2, frame=None, min_ang=25, bev_slot=None, ang=30): + """An outline (x, y) extruded z0..z1 with every sharp edge bevelled (bmesh bevel, `segs` segments). bev_slot: slot of the bevel faces.""" + bm = bmesh.new() + lo = [bm.verts.new((x, y, z0)) for x, y in outline] + hi = [bm.verts.new((x, y, z1)) for x, y in outline] + n = len(outline) + bm.faces.new(list(reversed(lo))) + bm.faces.new(hi) + for j in range(n): + k = (j + 1) % n + bm.faces.new((lo[j], lo[k], hi[k], hi[j])) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + if bev > 0: + es = [e for e in bm.edges if e.is_manifold and e.calc_face_angle(0) > DEG(min_ang)] + r = bmesh.ops.bevel(bm, geom=es, offset=bev, offset_type="OFFSET", segments=segs, profile=0.5, affect="EDGES", clamp_overlap=True) + if bev_slot is not None: + for f in r["faces"]: + f.material_index = bev_slot + bmesh.ops.triangulate(bm, faces=[f for f in bm.faces if len(f.verts) > 4], quad_method="BEAUTY", ngon_method="EAR_CLIP") + if frame is not None: + bmesh.ops.transform(bm, matrix=frame, verts=bm.verts) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + idx = [f.material_index for f in bm.faces] + o = mesh_obj(name, bm) + set_mats(o, *mats) + o.data.polygons.foreach_set("material_index", idx) + o.data.update() + smooth(o, ang) + return o + + +def sellipse(a, b, p=4.0, n=24, ph=0.0): + """A superellipse |x/a|^p + |y/b|^p = 1, n points counter-clockwise: p = 2 an ellipse, p ~ 4 a forged pillow (flats that swell, + corners that round).""" + out = [] + for k in range(n): + t = ph + TAU * k / n + c, s = math.cos(t), math.sin(t) + out.append((a * math.copysign(abs(c) ** (2 / p), c), b * math.copysign(abs(s) ** (2 / p), s))) + return out + + +def rounded_outline(pts, r, n=3): + """Round every corner of a closed outline by r (n points per corner).""" + out = [] + m = len(pts) + for i in range(m): + p, a, b = Vector(pts[i]), Vector(pts[i - 1]), Vector(pts[(i + 1) % m]) + da, db = (a - p).normalized(), (b - p).normalized() + k = min(r, (a - p).length * 0.45, (b - p).length * 0.45) + p0, p1 = p + da * k, p + db * k + for j in range(n + 1): + t = j / n + q = (1 - t) ** 2 * p0 + 2 * (1 - t) * t * p + t ** 2 * p1 # quadratic Bezier through the corner + out.append((q.x, q.y)) + return out + + +def lug_outline(w, h, r_end, n=5): + """A lug: a base w wide at y = 0 rising to a round end of radius r_end centred at (0, h).""" + r_ = max(r_end, 0.0) + return [(-w / 2, 0.0), (w / 2, 0.0)] + [(r_ * math.cos(PI * k / n), h + r_ * math.sin(PI * k / n)) for k in range(n + 1)] + + +# ======================================================================= hardware + +def washer(P, c, n, r, t, m=G4, segs=None, ref=None): + segs = segs or (8 if r < 0.016 else 10) + if HW_LOD[0]: + segs = min(segs, 8 if r >= 0.012 else 6) + ch = t * 0.4 + P.append(lathe("washer", [(0.0, 0.0), (r, 0.0), (r, t - ch), (r - ch, t), (0.0, t)], segs=segs, m=m, frame=fz(c, n, ref), smooth_ang=30)) + return Vector(c) + Vector(n).normalized() * t + + +def hexnut(P, c, n, R, h, m=G4, ref=None, name="nut"): + """Across corners 2R, h high on +n from c, both faces chamfered.""" + ch = min(h * 0.22, R * 0.2) + P.append(lathe(name, [(0.0, 0.0), (R - ch, 0.0), (R, ch), (R, h - ch), (R - ch, h), (0.0, h)], segs=6, m=m, frame=fz(c, n, ref), smooth_ang=20)) + return Vector(c) + Vector(n).normalized() * h + + +def thread(P, c, n, r, L, m=G3, pitch=None, segs=8, inside=0.004): + """A threaded end poking out L past c along n: sawtooth grooves, a chamfered tip.""" + pitch = pitch or max(r * 0.7, 0.0018) + if HW_LOD[0]: + pitch = max(pitch, (L - r * 0.25) / 3.2) + segs = 6 + prof = [(0.0, -inside), (r * 0.86, -inside)] + z = 0.0 + while z + pitch < L - r * 0.25: + prof += [(r, z + pitch * 0.25), (r * 0.84, z + pitch * 0.75)] + z += pitch + prof += [(r * 0.92, L - r * 0.25), (r * 0.62, L), (0.0, L)] + P.append(lathe("thread", prof, segs=segs if r > 0.0045 else 6, m=m, frame=fz(c, n), smooth_ang=25)) + + +def head(P, c, n, r, kind="hex", m=G4, ref=None): + """A bolt head sitting on c, facing n. r: shank radius.""" + if kind == "hex": + R, h = r * 1.85, r * 1.25 + P.append(lathe("bolthead", [(0.0, 0.0), (R * 0.93, 0.0), (R, h * 0.12), (R, h * 0.7), (R * 0.84, h), (0.0, h * 1.04)], segs=6, m=m, frame=fz(c, n, ref), smooth_ang=20)) + elif kind == "square": + R, h = r * 1.9, r * 1.3 + P.append(lathe("bolthead", [(0.0, 0.0), (R, 0.0), (R, h * 0.72), (R * 0.82, h), (0.0, h * 1.03)], segs=4, m=m, frame=fz(c, n, ref), smooth_ang=20)) + else: # dome: a carriage bolt or a rivet + R, h = r * 1.75, r * 1.05 + P.append(lathe("bolthead", [(0.0, 0.0), (R, 0.0), (R * 0.97, h * 0.28), (R * 0.82, h * 0.66), (R * 0.5, h * 0.93), (0.0, h)], segs=8 if HW_LOD[0] else 10, + m=m, frame=fz(c, n, ref), smooth_ang=40)) + + +def bolt5(P, a, n, L, r, kind="hex", m=G4, m_nut=None, m_thr=G3, w_head=True, nut=True, thr=None, ref=None): + """A through-bolt: the head side face at a (outward normal n), the far face at a - n L. Washers both sides, a nut, the thread poking out.""" + a, n = Vector(a), Vector(n).normalized() + p = washer(P, a - n * 0.0004, n, r * 2.2, r * 0.32, m=m, ref=ref) if w_head else a + head(P, p, n, r, kind, m=m, ref=ref) + if nut: + b = a - n * L + q = washer(P, b + n * 0.0004, -n, r * 2.2, r * 0.32, m=m, segs=6 if HW_LOD[0] else None) + q = hexnut(P, q, -n, r * 1.85, r * 1.5, m=m_nut or m, ref=ref) + thread(P, q - (-n) * 0.002, -n, r * 0.92, (thr if thr is not None else r * 1.4) + 0.002, m=m_thr) + + +def rivet(P, c, n, r, m=BRASS, tail=None, L=0.0): + """A domed rivet head at c facing n; tail: a peened tail on the far face c - n L.""" + head(P, c, n, r, "dome", m=m) + if tail: + n = Vector(n).normalized() + b = Vector(c) - n * L + P.append(lathe("peen", [(0.0, 0.0), (r * 1.45, 0.0), (r * 1.25, r * 0.4), (r * 0.7, r * 0.62), (0.0, r * 0.66)], segs=6 if HW_LOD[0] else 8, m=tail, + frame=fz(b, -n), smooth_ang=40)) + + +def bead(P, pts, r, m=G3, segs=5): + """A weld bead along pts: a rippled, slightly flattened bar.""" + C = resample([Vector(p) for p in pts], max(4, int(arclen([Vector(p) for p in pts])[-1] / (r * 1.5))), per=4) + nn = len(C) + + def rf(s): + k = 0.82 + 0.18 * abs(math.sin(s * nn * 1.4)) + tip = min(1.0, s * 6, (1 - s) * 6) + return (r * k * (0.5 + 0.5 * tip), r * 0.75 * k * (0.5 + 0.5 * tip)) + P.append(UT.tube("bead", C, rf, m, segs=4 if HW_LOD[0] else segs, per=1, ang=60)) + + +def spiral_wrap(name, C, L0, L1, R, pitch, depth, m, segs=16, rows=5, ref=None, start=0.0): + """Bands wound in a helix round polyline C between arc lengths L0 and L1: each turn a rounded band, a groove between turns. + R(Lpos) -> radius of what is wrapped. The start and the end of the strip run on a slant, like a real wrap's cut ends.""" + C = [Vector(p) for p in C] + T, N, B = frames(C, ref) + L = arclen(C) + + def at(x): + x = max(0.0, min(L[-1], x)) + i = next((q for q in range(len(L) - 1) if L[q + 1] >= x), len(L) - 2) + f = (x - L[i]) / max(1e-9, L[i + 1] - L[i]) + return C[i].lerp(C[i + 1], f), (N[i].lerp(N[i + 1], f)).normalized(), (B[i].lerp(B[i + 1], f)).normalized() + turns = (L1 - L0) / pitch + nph = int(math.ceil((turns + 1) * segs)) + # a shingled strip: it rises from under the last turn to a thick edge lapped over by the next one + prof = [0.1 + 0.9 * (q / rows) ** 0.8 for q in range(rows + 1)] + nr = len(prof) + bm = bmesh.new() + G = [] + for k in range(nph + 1): + ph = TAU * k / segs + start + base = L0 + pitch * (k / segs - 1.0) + row = [] + for q in range(nr): + x = base + pitch * q / (nr - 1) + c, n_, b_ = at(x) + fade = 1.0 if L0 - 1e-6 <= x <= L1 + 1e-6 else 0.15 + rr = R(x) + depth * prof[q] * fade + row.append(bm.verts.new(tuple(c + (n_ * math.cos(ph) + b_ * math.sin(ph)) * rr))) + G.append(row) + for k in range(nph): + for q in range(nr - 1): + bm.faces.new((G[k][q], G[k + 1][q], G[k + 1][q + 1], G[k][q + 1])) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + # the strip is open: make sure it faces outwards (its first face against the radial direction) + f0 = bm.faces[len(bm.faces) // 2] + c0 = f0.calc_center_median() + cc, _, _ = at(L0 + (L1 - L0) / 2) + f0.normal_update() + if f0.normal.dot(c0 - cc) < 0: + bmesh.ops.reverse_faces(bm, faces=bm.faces) + o = mesh_obj(name, bm) + set_mats(o, m) + smooth(o, 50) + return o + + +def rope_coil(name, C, Lc, R, r, turns, m=ROPE, segs=16, lobes=3, ref=None): + """A rope lashed round a part: `turns` turns round polyline C centred at arc length Lc, R(angle) the radius it lies at, a three strand twist.""" + C = [Vector(p) for p in C] + T, N, B = frames(C, ref) + L = arclen(C) + + def at(x): + x = max(0.0, min(L[-1], x)) + i = next((q for q in range(len(L) - 1) if L[q + 1] >= x), len(L) - 2) + f = (x - L[i]) / max(1e-9, L[i + 1] - L[i]) + return C[i].lerp(C[i + 1], f), (N[i].lerp(N[i + 1], f)).normalized(), (B[i].lerp(B[i + 1], f)).normalized() + adv = r * 2.15 + n = int(turns * segs) + path = [] + for k in range(n + 1): + ph = TAU * k / segs + x = Lc + adv * (k / segs - turns / 2) + c, n_, b_ = at(x) + path.append(c + (n_ * math.cos(ph) + b_ * math.sin(ph)) * R(ph)) + tw = 7.0 + + def sec(s, i): + return [(r * (1 + 0.16 * math.cos(lobes * (q * TAU / 7) - tw * s * turns * TAU / lobes)) * math.cos(q * TAU / 7), + r * (1 + 0.16 * math.cos(lobes * (q * TAU / 7) - tw * s * turns * TAU / lobes)) * math.sin(q * TAU / 7)) for q in range(7)] + return sweep(name, path, sec, [m], ang=50) + + +# ======================================================================= blades + +def blade_section(g, tt, f_hammer=None, nc=None): + """(fraction across from the edge to the spine, height) round the section, and the slot of each face. + Slots: 0 cheek, 1 edge, 2 bevel, 3 shoulder, 4 spine, 5 / 6 hammered cheek (chosen later). + nc: points across each cheek between the shoulder and the spine (None: round 5's first three), for a finer hammered mottle.""" + if nc is None: + ch = [0.46, 0.63, 0.8] + else: + a = g + 0.08 + ch = [a + (0.8 - a) * k / (nc - 1) for k in range(nc)] + top = [(0.0, 0.0), (0.035, 0.12), (g, 0.40), (g + 0.035, 0.47)] + [(f, 0.5) for f in ch] + [(0.93, 0.48), (0.985, 0.36), (1.0, 0.15)] + bot = [(1.0, -0.15), (0.985, -0.36), (0.93, -0.48)] + [(f, -0.5) for f in reversed(ch)] + [(g + 0.035, -0.465), (g, -0.40), (0.035, -0.12)] + pts = [(f, h * tt) for f, h in top + bot] + m = len(ch) + slots = [1, 2, 3] + [0] * (m + 1) + [4] * 5 + [0] * (m + 1) + [3, 2, 1] + return pts, slots + + +def heel_twist(v, x, twist): + """Turn an offset v (from the spine, blade-local) about the spine's line by the heel twist at x: (degrees at the heel, length). + F tilts the scythe blades by TILT; turning the heel back by the same angle lets it run level into the mount.""" + if not twist or x >= twist[1]: + return v + a = DEG(twist[0]) * (1 - max(0.0, x) / twist[1]) ** 1.5 + c, s_ = math.cos(a), math.sin(a) + return Vector((v.x, v.y * c - v.z * s_, v.y * s_ + v.z * c)) + + +def blade5(name, S, E, z, t, frame=None, ground=0.3, seed=5, rust=(), P=None, dimple=0.0005, twist=None, mottle=(0.07, 0.07), + sub=1, nc=None, mscale=None): + """A blade from spine and edge outlines (x, y) in the plane z: a fine edge, a bright ground bevel behind a dark grind line, flat + hammered cheeks (dimpled a little, mottled along the atlas' grey ramp by hammer_uv), a rounded spine. The last station closes to a point. + twist: see heel_twist. sub: stations per outline step (finer mesh for the mottle), nc: points across each cheek (blade_section). + mottle: falsy for a plain cheek; mscale: blotch size (default from the blade's width).""" + rng = random.Random(seed) + F = frame if frame is not None else Matrix.Identity(4) + S0, E0 = S, E + if sub > 1: + S2, E2 = [], [] + for i in range(len(S) - 1): + for k in range(sub): + f = k / sub + S2.append(tuple(Vector(S[i]).lerp(Vector(S[i + 1]), f))) + E2.append(tuple(Vector(E[i]).lerp(Vector(E[i + 1]), f))) + S2.append(S[-1]) + E2.append(E[-1]) + S, E = S2, E2 + n = len(S) + rings = [] + slots = None + for i in range(n): + s, e = Vector((S[i][0], S[i][1])), Vector((E[i][0], E[i][1])) + u = i / (n - 1) + tt = t * (1.0 - 0.6 * u ** 3) + if i % sub == 0: + g = ground + rng.uniform(-0.03, 0.03) + pts, slots = blade_section(g, tt, nc=nc) + ring = [] + for q, (f, h) in enumerate(pts): + p = e.lerp(s, f) + if 0 < i < n - 2 and g + 0.06 < f < 0.85: + h += rng.uniform(-dimple, dimple) * (1 if h > 0 else -1) + v = heel_twist(Vector((0.0, p.y - s.y, h)), s.x, twist) + ring.append(F @ Vector((p.x, s.y + v.y, z + v.z))) + rings.append(ring) + tip = sum(rings[-1], Vector()) / len(rings[-1]) + rings[-1] = [tip] + + def col(i, j): + if j < 0: + return 4 + return slots[j] + o = rings_mesh(name, rings, [G1, EDGE, BEV, GLINE, DGY, HMD, HML], colfn=col, ang=26) + if mottle: + W = max((Vector(a) - Vector(b)).length for a, b in zip(S, E)) + hammer_uv(o, 0, STEEL_RAMP, scale=mscale or max(0.025, min(0.06, W * 0.26)), seed=seed, frame=F.inverted()) + S, E = S0, E0 + n = len(S) + if P is not None: + for (i, j) in rust: + i = min(i, n - 2) + sm = (Vector(S[i]) + Vector(S[i + 1])) / 2 + em = (Vector(E[i]) + Vector(E[i + 1])) / 2 + c = em.lerp(sm, .7) + Ls = (Vector(S[i + 1]) - Vector(S[i])).length + W = (sm - em).length + a = math.atan2(S[i + 1][1] - S[i][1], S[i + 1][0] - S[i][0]) + up = 1 if j == 2 else -1 + tt = t * (1.0 - 0.6 * (i / (n - 1)) ** 3) + Fl = F @ Matrix.Translation((c.x, c.y, z)) @ Matrix.Rotation(a, 4, "Z") + blot(P, Fl, (0, 0, up * (tt * .5 + .0012)), Ls * 1.8, W * .2, rng, flip=up < 0, key=RB) + return o + + +def scythe_outline(y0, L, w0, bow, curl, n, neck=None): + """Round 4's scythe outline (spine S, edge E) at n + 1 stations. neck = (x_end, w_max, x_full): inside the mount (x < x_end) the + blade is no wider than w_max, then the edge sweeps down in a curve (the beard) to its full width at x_full.""" + S, E = [], [] + for i in range(n + 1): + u = i / n + x = L * u + y = y0 - bow * math.sin(u * 2.35) + curl * u ** 3 + w = w0 * (1 - u) ** 0.62 * (0.8 + 0.2 * math.sin(min(1.0, u * 4) * 1.57)) + 0.007 + if neck and x < neck[2]: + f = max(0.0, (x - neck[0]) / (neck[2] - neck[0])) + f = f * f * (3 - 2 * f) + w = min(w, neck[1] + (w - neck[1]) * f) + S.append((x, y)) + E.append((x, y + w)) + S[-1] = (S[-1][0] + 0.02, S[-1][1] + 0.01) + E[-1] = (S[-1][0], S[-1][1] + 0.003) + return S, E + + +def tilt_frame(y0, hz): + return Matrix.Translation((0, y0, hz)) @ Matrix.Rotation(DEG(-UT.TILT), 4, "X") @ Matrix.Translation((0, -y0, -hz)) + + +def back_channel(P, S, E, z, t, F, i0, i1, wf=0.034, th=0.0055, m=G2, n_sub=1, rivets=(), r_riv=0.0085, nose=0.009, taper=0.7, twist=None): + """A strip folded over the blade's spine and clasping it: a top flange on the cheek, a round nose past the spine, a shorter flange under. + Built over stations i0..i1 of (S, E). rivets: station indices that get a domed head on top and a peened tail under.""" + nS = len(S) + ss = [] + for i in range(i0, i1): + for k in range(n_sub): + ss.append(i + k / n_sub) + ss.append(float(i1)) + + def st(x): + i = min(int(x), nS - 2) + f = x - i + s = Vector(S[i]).lerp(Vector(S[i + 1]), f) + e = Vector(E[i]).lerp(Vector(E[i + 1]), f) + return s, e, (e - s).normalized(), i + f + C, A, H = [], [], [] + for x in ss: + s, e, a, xf = st(x) + C.append(Vector((s.x, s.y, z))) + A.append(Vector((a.x, a.y, 0.0))) + H.append(t * (1.0 - 0.6 * (xf / (nS - 1)) ** 3)) + Lc = arclen(C) + + def sec(sf, i): + tt = H[i] * 0.5 + k = 1 - (1 - taper) * sf + w1, w2, tk = wf * k, wf * 0.62 * k, th * (0.75 + 0.25 * k) + nz = nose * k + end = min(1.0, sf * 30, (1 - sf) * 30) # the strip's ends are hammered thin + tk *= 0.35 + 0.65 * end + pts = [(w1, tt + 0.0003), (w1 - 0.004, tt + tk * 0.85), (w1 * 0.5, tt + tk), (0.0, tt + tk)] + for q in range(1, 6): + an = PI / 2 + PI * q / 6 + pts.append((nz * 0.9 * math.cos(an) - 0.0, (tt + tk) * math.sin(an))) + pts += [(0.0, -tt - tk), (w2 * 0.6, -tt - tk), (w2 - 0.003, -tt - tk * 0.8), (w2, -tt - 0.0003)] + return pts + # N across towards the edge, B up: build rings by hand + rings = [] + for i, c in enumerate(C): + sf = Lc[i] / Lc[-1] + rings.append([c + heel_twist(A[i] * a + Vector((0, 0, b)), c.x, twist) for a, b in sec(sf, i)]) + rings = [[F @ p for p in r] for r in rings] + o = rings_mesh("back", rings, [m, G3, DGY], colfn=lambda i, j: 2 if j < 0 else (1 if j in (0, 11) else 2 if 3 <= j <= 8 else 0), ang=34) + P.append(o) + up = (F.to_3x3() @ Vector((0, 0, 1))).normalized() + for i in rivets: + s, e, a, xf = st(float(i)) + tt = t * (1.0 - 0.6 * (xf / (nS - 1)) ** 3) * 0.5 + k = 1 - (1 - taper) * (i - i0) / max(1, i1 - i0) + c = Vector((s.x, s.y, z)) + Vector((a.x, a.y, 0)) * wf * k * 0.5 + tk = th * (0.75 + 0.25 * k) + rivet(P, F @ (c + Vector((0, 0, tt + tk - 0.0003))), up, r_riv, m=BRASS, tail=G3, L=2 * (tt + tk - 0.0003)) + return o + + +# ======================================================================= wood + +def turned(name, C, rf, m=TIM, segs=16, s=1.6, u0=0.125, ang=34, ref=None, cap0=True, cap1=True): + """A turned part along a path: rf(s) -> radius.""" + return sweep(name, C, lambda sf, i: circ(rf(sf), segs), [m], uv=(u0, 0.09, s), ang=ang, ref=ref, cap0=cap0, cap1=cap1) + + +def nib5(P, x, y, z_top, m_knob=PRED, r=0.036, z_low=-0.105, wrap=LEAT, bolt_below=True, ferrule=BRASS, nut_drop=0.0): + """A turned nib along Z where the fist closes: a ferrule where it meets the snath, a collar and grooves, a spiral leather wrap + with a brass welt at each end, a painted knob held on by a nut on the through-bolt (nut_drop lower, past a strap eye).""" + fr = Matrix.Translation((x, y, 0)) + zt = z_top + z0, z1 = -0.063, 0.02 + # the timber: a bead and a groove under the wrap, a groove, a bead and a neck above it + prof = [(r * 0.78, z_low + 0.012), (r * 0.86, z_low + 0.02), (r * 0.95, z_low + 0.026), (r * 0.9, z_low + 0.031), (r * 0.97, z_low + 0.035), + (r * 0.98, z0 - 0.004), (r * 0.98, z1 + 0.005), (r * 0.93, z1 + 0.009), (r * 0.98, z1 + 0.014), (r * 0.96, z1 + 0.019), + (r * 0.86, z1 + 0.025), (r * 0.84, z1 + 0.034), (r * 0.82, zt - 0.03)] + # swept, not lathed, so the grain runs up the nib inside one board of the timber texture + P.append(sweep("nib", [Vector((x, y, z_)) for r_, z_ in prof], lambda sf, i: circ(prof[i][0], 16), [TIM], uv=(0.125, 0.08, 1.6), ref=(1, 0, 0), ang=34)) + # a brass ferrule with rolled rims where the nib goes into the snath + P.append(lathe("ferrule", [(r * 0.8, zt - 0.031), (r * 0.86, zt - 0.03), (r * 0.88, zt - 0.026), (r * 0.84, zt - 0.022), (r * 0.84, zt - 0.006), + (r * 0.88, zt - 0.003), (r * 0.86, zt + 0.002), (r * 0.7, zt + 0.004)], segs=16, m=ferrule, frame=fr, smooth_ang=40)) + # the knob: a painted turned knob, a groove round it, a dished end + P.append(lathe("knob", [(r * 0.8, z_low + 0.014), (r * 0.98, z_low + 0.01), (r * 1.2, z_low + 0.002), (r * 1.3, z_low - 0.006), + (r * 1.24, z_low - 0.009), (r * 1.24, z_low - 0.013), (r * 1.3, z_low - 0.016), (r * 1.18, z_low - 0.022), + (r * 0.6, z_low - 0.025), (0.0, z_low - 0.0235)], segs=14, m=m_knob, frame=fr, smooth_ang=40)) + if bolt_below: + b = Vector((x, y, z_low - 0.0242 - nut_drop)) + q = washer(P, b, (0, 0, -1), r * 0.45, 0.0025, m=BRASS, segs=12) + q = hexnut(P, q, (0, 0, -1), r * 0.34, 0.009, m=G4) + thread(P, q + Vector((0, 0, 0.002)), (0, 0, -1), r * 0.2, 0.008, m=G3) + if wrap: + C = [Vector((x, y, z0 - 0.02)), Vector((x, y, z1 + 0.02))] + P.append(spiral_wrap("wrap", C, 0.02, 0.02 + (z1 - z0), lambda q: r * 0.985, 0.0165, 0.0034, wrap, segs=13 if HW_LOD[0] else 16, rows=3, + ref=(1, 0, 0))) + for zz in (z0 - 0.002, z1 + 0.002): + P.append(lathe("welt", [(r * 1.0, zz - 0.0045), (r * 1.1, zz - 0.003), (r * 1.13, zz), (r * 1.1, zz + 0.003), (r * 1.0, zz + 0.0045)], segs=12 if HW_LOD[0] else 16, + m=BRASS if wrap == LEAT else IRON, frame=fr, smooth_ang=50)) + + +# ======================================================================= clamps, lugs, braces + +def strap5(P, pth, t, hw, hh, rc, w=0.024, th=0.0045, m=IRON, ears=1, ear_len=0.034, bolt_m=G4, nc=3, phase_up=True, ear_scale=1.5): + """A forged strap round a rounded-rect bar at path fraction t: rolled edges, the ends chamfered down onto the bar, two pinch ears + on the +X (ears=1) or -X (ears=-1) side with a bolt down through them. hw, hh, rc: the bar's half section there. + ear_scale: the ears' size over round 5's first pilot (they were too small to read in first person).""" + Ltot = pth.L[-1] + ss = [-0.5, -0.47, -0.4, -0.3, 0.3, 0.4, 0.47, 0.5] + tk = [0.0006, th * 0.9, th * 1.25, th, th, th * 1.25, th * 0.9, 0.0006] + C = [pth.at(t + q * w / Ltot) for q in ss] + T, N, B = frames(C, ref=(1, 0, 0)) + + def sec(sf, i): + d = tk[i] + return rrect(hw + d, hh + d, rc + d, nc) + P.append(sweep("strap", C, sec, [m], cap0=False, cap1=False, ang=40, frm=(T, N, B))) + if ears: + c = pth.at(t) + i = len(C) // 2 + Nx, Bz, Tt = N[i] * (1 if N[i].x >= 0 else -1), B[i], T[i] + side = Nx * ears + es = ear_scale + gap = 0.007 * es ** 0.5 + el, ew, et = ear_len * es, w * min(0.5, 0.42 * es), th * min(1.35, es) + for sz in (-1, 1): + zc = sz * (gap / 2 + et / 2) + org = c + side * (hw - 0.004) + Bz * zc + Fm = Matrix((side, Tt, Bz)).transposed().to_4x4() + Fm.translation = org + # the ear widens a little where it leaves the strap (a forged fillet), a round end + out = rounded_outline([(0.0, -ew), (el * 0.35, -ew * 0.97), (el, -ew * 0.84), (el, ew * 0.84), (el * 0.35, ew * 0.97), (0.0, ew)], 0.009 * es, + n=2 if HW_LOD[0] else 3) + P.append(bprism("ear", out, -et / 2, et / 2, [m, G3], bev=0.0012 * es, segs=1, frame=Fm, bev_slot=1)) + bc = c + side * (hw - 0.004 + el * 0.62) + bolt5(P, bc + Bz * (gap / 2 + et), Bz, gap + 2 * et, 0.0065 * min(1.25, es), m=bolt_m, ref=Tt, thr=0.008 * es) + + +def clevis(P, c, d, n, w, t, base, r_eye, gap, m=G2, bead_m=G3, bead_at=None): + """Two lug plates either side of an eye at c, normal to the bolt axis n, rising along d from their bases (`base` back along -d, buried + in what they are welded to); a weld bead where each meets that surface, bead_at back from c. Returns the bolt's head point and length.""" + n = Vector(n).normalized() + d = (Vector(d) - n * Vector(d).dot(n)).normalized() + u = d.cross(n) + for sz in (-1, 1): + off = n * sz * (gap / 2 + t / 2) + Fm = Matrix((u, d, n)).transposed().to_4x4() + Fm.translation = c - d * base + off + P.append(bprism("lug", lug_outline(w, base, r_eye), -t / 2, t / 2, [m, G3], bev=min(0.0014, t * 0.3), segs=1, frame=Fm, bev_slot=1)) + if bead_at is not None: + b0 = c - d * bead_at + n * sz * (gap / 2 + t + 0.0008) + bead(P, [b0 - u * w * 0.5, b0, b0 + u * w * 0.5], 0.0024, m=bead_m) + return c + n * (gap / 2 + t), gap + 2 * t + + +def flat_brace(P, a, b, n, w, t, r_eye, m=IRON, segs_mid=6): + """A forged flat bar from eye a to eye b: rounded section, flattened wider into an eye round each bolt, the bolt axis n.""" + a, b = Vector(a), Vector(b) + d = (b - a).normalized() + n = (Vector(n) - d * Vector(n).dot(d)).normalized() + u = n.cross(d) + Lb = (b - a).length + ns = 18 + C = [a.lerp(b, k / ns) for k in range(ns + 1)] + T = [d] * len(C) + N = [u] * len(C) + Bv = [n] * len(C) + + def sec(sf, i): + x = sf * Lb + e = min(x, Lb - x) + k = max(0.0, 1 - e / (r_eye * 2.6)) # 1 at the eye, 0 along the bar + hw = w / 2 + (r_eye - w / 2) * k ** 1.5 + hh = t / 2 * (1 - 0.25 * k) + return rrect(hw, hh, min(hw, hh) * (0.8 - 0.4 * k), 2 if HW_LOD[0] else 3) + P.append(sweep("brace", C, sec, [m], frm=(T, N, Bv), ang=34)) + for c in (a, b): + Fm = Matrix((u, d, n)).transposed().to_4x4() + Fm.translation = c + P.append(bprism("eye", circ(r_eye, 14), -t * 0.37, t * 0.37, [m, G3], bev=t * 0.18, segs=1, frame=Fm, bev_slot=0, ang=40)) + + +def rod_eye(P, c, d, n, r_rod, R, m=G3): + """A forged eye on the end of a rod: a ring round the bolt (axis n) at c, the rod coming in along -d.""" + d = Vector(d).normalized() + n = (Vector(n) - d * Vector(n).dot(d)).normalized() + u = n.cross(d) + ring = [] + for k in range(14): + a = TAU * k / 14 + ring.append(c + (u * math.cos(a) + d * math.sin(a)) * R) + P.append(UT.tube("eye", ring + [ring[0], ring[1]], lambda s: (r_rod * 1.05, r_rod * 0.85), m, segs=6, per=1, cap=False, ang=50)) + + +def turnbuckle(P, a, b, n, r_rod, m_body=BRASS, m_rod=G3, m_nut=G4, Lb=0.13, Rb=0.0175): + """An open-frame turnbuckle in the middle of a rod from a to b: two hex end bosses joined by two side bars, threaded rods screwed in + from each end, a lock nut against each boss, the rod ends showing in the frame.""" + a, b = Vector(a), Vector(b) + d = (b - a).normalized() + n = (Vector(n) - d * Vector(n).dot(d)).normalized() + u = n.cross(d) + mid = (a + b) / 2 + hb = 0.02 # boss length + for sg in (-1, 1): + c0 = mid + d * sg * (Lb / 2 - hb) + prof = [(0.0, 0.0), (Rb * 0.82, 0.0), (Rb, 0.0025), (Rb, hb - 0.004), (Rb * 0.8, hb), (r_rod * 1.3, hb + 0.002), (0.0, hb + 0.002)] + P.append(lathe("tbboss", prof, segs=6, m=m_body, frame=fz(c0, d * sg, n), smooth_ang=20)) + # lock nut and the threaded rod going in + q = hexnut(P, c0 + d * sg * (hb + 0.0025), d * sg, r_rod * 1.95, r_rod * 1.55, m=m_nut, ref=u) + P.append(lathe("rodthread", thread_prof(r_rod, Lb / 2 - 0.006 - hb + 0.016), segs=6 if HW_LOD[0] else 8, m=m_rod, frame=fz(mid + d * sg * 0.006, d * sg), smooth_ang=25)) + # the side bars: flat, swelling a little in the middle + for sg in (-1, 1): + C = [mid + d * (Lb / 2 - hb * 0.6) * k + u * sg * (Rb * 0.78 + 0.004 * (1 - k * k)) for k in (-1, -0.6, -0.2, 0.2, 0.6, 1)] + P.append(sweep("tbbar", resample(C, 8), lambda sf, i: rrect(0.0042, 0.0068, 0.003, 1), [m_body], ref=u, ang=40)) + + +def thread_prof(r, L, pitch=None): + pitch = pitch or max(r * 0.75, 0.0018) + prof = [(0.0, 0.0), (r * 0.84, 0.0)] + z = 0.0 + while z + pitch < L - r * 0.25: + prof += [(r, z + pitch * 0.25), (r * 0.84, z + pitch * 0.75)] + z += pitch + prof += [(r * 0.92, L - r * 0.25), (r * 0.62, L), (0.0, L)] + return prof + + +def path_at_y(pth, y): + """The point of a Path where it crosses y (the paths here run down -Y).""" + C = pth.C + for a, b in zip(C, C[1:]): + if (a.y - y) * (b.y - y) <= 0 and a.y != b.y: + return a.lerp(b, (y - a.y) / (b.y - a.y)) + return C[0] if abs(C[0].y - y) < abs(C[-1].y - y) else C[-1] + + +# ======================================================================= the mount ("shoe") at the heel of a scythe + +def shoe(P, x0, x1, y0, y1, z0, z1, bev, bolts, wedge, entry, m=DGY, blade_z=None, taper=(0.56, 0.48)): + """A forged shoe round the end of the snath, swept along X: a forged pillow section (a superellipse, flats that swell and corners + that round, worn bright) that rounds over at the back, keeps its size over the snath, then draws in towards the blade where the heel + leaves it (narrower, and its top coming down towards the blade's plane blade_z), on a flat underside with crisp edges, forge scale + mottled along the atlas' dark ramp. A swelled socket collar where the snath goes in + (the +Y face), forged bosses under the bolt heads, through-bolts from the top with washers, nuts and threads under, and a timber + wedge driven down the +X end under an iron keeper: a tapered block with long grain up its sides and a mushroomed end-grain head. + bolts: [(x, y)]. wedge: (y0, y1, depth). entry: (pth, section fn (d, k) -> [(x, z)] where k = 1 / cos(slope)). bev: unused (kept + for the callers).""" + cy = (y0 + y1) / 2 + A0 = (y1 - y0) / 2 + bz = blade_z if blade_z is not None else z0 + (z1 - z0) * 0.25 + xs0 = x0 + (x1 - x0) * 0.42 + rb = min(0.024, (z1 - z0) * 0.36) + re = 0.01 + zt_end = bz + (z1 - bz) * taper[1] + PB = 9.0 # the underside: flat, with crisp rounded edges + + def prof(x): + """(half width in Y, top, bottom, exponent of the top half) at x. The bottom stays flat at z0 (it only rounds up at the very + ends); the top comes down towards the blade.""" + d = max(0.0, min(1.0, (x - xs0) / (x1 - xs0))) + d = d * d * (3 - 2 * d) + e0 = min(1.0, max(0.0, (x - x0) / rb)) + e1 = min(1.0, max(0.0, (x1 - x) / re)) + kb = 0.5 + 0.5 * math.sqrt(max(0.0, 1 - (1 - e0) ** 2)) + ke = 0.8 + 0.2 * math.sqrt(max(0.0, 1 - (1 - e1) ** 2)) + A = A0 * (1 - (1 - taper[0]) * d) * kb * ke + top = z1 + (zt_end - z1) * d + bot = z0 + (top - z0) * (1 - kb * ke) * 0.45 + top = bot + (top - bot) * kb * ke + return A, top, bot, 4.6 - 1.2 * d + + def ssec(A, top, bot, pt, n): + """The shoe's section round its waist line: a superellipse with a fuller top half and a flat underside.""" + H = top - bot + Bt, Bb = H * 0.6, H * 0.4 + out = [] + for k in range(n): + t = PI / n + TAU * k / n + c_, s_ = math.cos(t), math.sin(t) + p_ = pt if s_ >= 0 else PB + out.append((A * math.copysign(abs(c_) ** (2 / p_), c_), (Bt if s_ >= 0 else Bb) * math.copysign(abs(s_) ** (2 / p_), s_))) + return out, bot + Bb + + xs = [x0 + rb * (1 - math.cos(k / 4 * PI / 2)) for k in range(4)] + xs += [x0 + rb + (x1 - re - x0 - rb) * k / 9 for k in range(10)] + xs += [x1 - re + re * math.sin(k / 3 * PI / 2) for k in range(1, 4)] + NP = 24 + C, secs = [], [] + for x in xs: + A, top, bot, p = prof(x) + sec_, mid = ssec(A, top, bot, p, NP) + C.append(Vector((x, cy, mid))) + secs.append(sec_) + X, Y, Z = Vector((1, 0, 0)), Vector((0, 1, 0)), Vector((0, 0, 1)) + nn = len(C) + + def wornf(i, j): + if j < 0: + return 0 + t = PI / NP + TAU * (j + 0.5) / NP + return 1 if abs(math.cos(t)) > 0.58 and abs(math.sin(t)) > 0.58 else 0 + so = sweep("shoe", C, lambda sf, i: secs[i], [m, G1], colfn=wornf, ang=32, frm=([X] * nn, [Y] * nn, [Z] * nn)) + if m == DGY: + hammer_uv(so, 0, FORGE_RAMP, scale=0.016, seed=int(abs(x1 * 997)) % 97) + P.append(so) + + def surf_top(x, y, up=True): + A, top, bot, p = prof(x) + H = top - bot + q = min(0.98, abs(y - cy) / A) + if up: + return bot + H * 0.4 + H * 0.6 * (1 - q ** p) ** (1 / p) + return bot + H * 0.4 - H * 0.4 * (1 - q ** PB) ** (1 / PB) + # the socket collar where the snath goes in: swept along the snath itself, it swells out of the shoe, then draws down to a rolled + # lip hugging the snath. Capped, so it is a solid ring (the cap discs lie inside the snath). + pth, secf = entry + tf_ = pth.nearest_y(y1) + Lp = pth.L[-1] + offs = [0.01, 0.0, -0.007, -0.014, -0.021, -0.026, -0.029, -0.031] # metres along the snath from the +Y face, + = into the shoe + dd = [0.013, 0.0148, 0.0152, 0.0132, 0.0094, 0.0074, 0.005, 0.001] + cs = [pth.at(tf_ + o_ / Lp) for o_ in offs] + P.append(sweep("lip", cs, lambda sf, i: secf(dd[i], 1.0), [m, G1], colfn=lambda i, j: 1 if i in (4, 5) else 0, ang=40, ref=(1, 0, 0))) + # through-bolts on forged bosses + for bx_, by_ in bolts: + zt = surf_top(bx_, by_) + zb = surf_top(bx_, by_, up=False) + r = 0.0085 + P.append(lathe("boss", [(0.0, zt - 0.006), (r * 2.75, zt - 0.006), (r * 2.65, zt - 0.0015), (r * 2.45, zt + 0.0012), (r * 2.25, zt + 0.0022), + (0.0, zt + 0.0022)], segs=16, m=m, frame=Matrix.Translation((bx_, by_, 0)), smooth_ang=40)) + bolt5(P, (bx_, by_, zt + 0.0022), (0, 0, 1), zt + 0.0022 - zb, r, m=G4, ref=(1, 0, 0), thr=0.012) + if wedge: + wy0, wy1, wd = wedge + wd = max(wd, 0.024) + A, top_e, bot_e, _ = prof(x1 - re) + zb_w = max(bot_e + 0.004, bz + 0.012) + zh = z1 + 0.012 # where the head starts to spread + yc_, hy = (wy0 + wy1) / 2, (wy1 - wy0) / 2 + rng = random.Random(int(abs(x1 * 1000 + wy0 * 100))) + # the block, from the bottom of the slot up to the head: thin at the foot, thick at the top + zs = [zb_w + (zh - zb_w) * q / 6 for q in range(7)] + # the mushroom: (spread) per ring, the lip rolling out and down over the block, then the bruised rim and the dome + hd = [(0.0042, 0.0), (0.0092, 0.0), (0.0122, 0.0), (0.0128, 0.0), (0.0112, 0.0), (0.0082, 0.0), (0.0048, 0.0)] + zs_h = [zh + 0.0010, zh + 0.0024, zh + 0.0020, zh + 0.0036, zh + 0.006, zh + 0.0078, zh + 0.009] + rings_z = zs + zs_h + jit = [rng.uniform(-1, 1) for _ in range(20)] + + def wsec(sf, i): + z = rings_z[i] + if i < len(zs): + f = (z - zb_w) / (zh - zb_w) + tx = wd * (0.42 + 0.58 * f) + hyy = hy * (0.9 + 0.1 * f) + sp = 0.0 + else: + tx, hyy = wd, hy + sp = hd[i - len(zs)][0] + pts = rrect(tx / 2 + sp, hyy + sp, 0.003 + sp * 0.5, 3) + if i >= len(zs): # the bruised rim of the head: uneven + kj = min(1.0, sp / 0.006) + pts = [(a * (1 + 0.06 * jit[q % 20] * kj), b * (1 + 0.035 * jit[(q + 7) % 20] * kj)) for q, (a, b) in enumerate(pts)] + return pts + Cw = [] + for i, z in enumerate(rings_z): + if i < len(zs): + f = (z - zb_w) / (zh - zb_w) + tx = wd * (0.42 + 0.58 * f) + else: + tx = wd + Cw.append(Vector((x1 - 0.006 + tx / 2, yc_, z))) + nw = len(Cw) + o = sweep("wedge", Cw, wsec, [TIM], uv=(0.375, 0.08, 1.8), cap0=True, cap1=False, ang=40, frm=([Z] * nw, [X] * nw, [Y] * nw)) + P.append(o) + # the end-grain head: a low dome, the growth rings as arcs round a pith off one corner (the timber texture laid radially across + # all four of its boards: the dark lines between them become rings) + top_ring = [Cw[-1] + X * a + Y * b for a, b in wsec(1.0, nw - 1)] + cc = Cw[-1] + Z * 0.0024 + pith = cc + X * (wd * 1.6) + Y * (hy * 1.2) + bm = bmesh.new() + uvl = bm.loops.layers.uv.verify() + rows = [top_ring] + [[cc.lerp(p, f) + Z * (0.0024 * (1 - f * f)) for p in top_ring] for f in (0.7, 0.4)] + V = [[bm.verts.new(p) for p in r] for r in rows] + vc = bm.verts.new(cc + Z * 0.0024) + dmax = max((p - pith).length for p in top_ring) + dmin = (cc - pith).length - max(wd, hy * 2) + uvf = lambda p: (0.06 + 0.88 * max(0.0, min(1.0, ((p - pith).length - dmin) / (dmax - dmin))), + math.atan2((p - pith).y, (p - pith).x) * 0.02) + nr = len(top_ring) + for a in range(len(V) - 1): + for j in range(nr): + q = (j + 1) % nr + f = bm.faces.new((V[a][j], V[a][q], V[a + 1][q], V[a + 1][j])) + for lp in f.loops: + lp[uvl].uv = uvf(lp.vert.co) + for j in range(nr): + f = bm.faces.new((V[-1][j], V[-1][(j + 1) % nr], vc)) + for lp in f.loops: + lp[uvl].uv = uvf(lp.vert.co) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + for f in bm.faces: + f.normal_update() + if sum(f.normal.z for f in bm.faces) < 0: + bmesh.ops.reverse_faces(bm, faces=bm.faces) + eg = mesh_obj("endgrain", bm) + set_mats(eg, TIM) + smooth(eg, 50) + eg["uv_done"] = True + P.append(eg) + # the iron keeper: a strap round the wedge and the shoe's end, riveted to the shoe's sides + kz = zb_w + (zh - zb_w) * 0.45 + txk = wd * (0.42 + 0.58 * 0.45) + xo = x1 - 0.006 + txk + 0.0025 + xb = x1 - re - 0.018 + A_b = prof(xb)[0] + ya, yb_ = min(wy0, cy - A_b) - 0.0025, max(wy1, cy + A_b) + 0.0025 + Ab = prof(xb)[0] + kp = [Vector((xb, cy - Ab - 0.0022, kz)), Vector((x1 - 0.004, ya, kz)), Vector((xo - 0.004, ya, kz)), Vector((xo, ya + 0.005, kz)), + Vector((xo, yb_ - 0.005, kz)), Vector((xo - 0.004, yb_, kz)), Vector((x1 - 0.004, yb_, kz)), Vector((xb, cy + Ab + 0.0022, kz))] + kc = resample(kp, 18, per=4) + P.append(sweep("keeper", kc, lambda sf, i: rrect(0.0075, 0.0022, 0.0012, 1), [IRON, G2], colfn=lambda i, j: 1 if j % 4 == 3 else 0, + ref=(0, 0, 1), ang=40)) + for sg in (-1, 1): + rivet(P, Vector((xb + 0.006, cy + sg * (prof(xb + 0.006)[0] + 0.0044), kz)), (0, sg, 0), 0.0032, m=G4) + ny = (y1 - y0) + return [(y0 + ny * 0.1, z0), (y1, z0), (y1, z1), (y0 + ny * 0.22, z1), (y0, z1 - (z1 - z0) * 0.24), (y0, z0 + (z1 - z0) * 0.18)] + + +def jaws(P, S, E, z, t, F, x0, x1, width, th=0.006, rivets=2, m=DGY): + """Jaw plates over and under the blade where it leaves the mount, from the spine out by `width` (fraction of the blade's width), + rounded and chamfered, riveted through the blade.""" + s0, e0 = Vector(S[0]), Vector(E[0]) + n = 10 + pts_top = [] + xs = [x0 + (x1 - x0) * k / n for k in range(n + 1)] + + def at(x): + # interpolate spine and edge at x along the outline stations + for i in range(len(S) - 1): + if S[i][0] <= x <= S[i + 1][0] or i == len(S) - 2: + f = (x - S[i][0]) / max(1e-9, S[i + 1][0] - S[i][0]) + return Vector(S[i]).lerp(Vector(S[i + 1]), f), Vector(E[i]).lerp(Vector(E[i + 1]), f) + return Vector(S[0]), Vector(E[0]) + lo, hi = [], [] + for x in xs: + s, e = at(x) + k = 1 - 0.35 * ((x - x0) / (x1 - x0)) ** 2 + lo.append(s + (s - e).normalized() * 0.006) + hi.append(s.lerp(e, width * k)) + outline = [(p.x, p.y) for p in lo] + [(p.x, p.y) for p in reversed(hi)] + up = (F.to_3x3() @ Vector((0, 0, 1))).normalized() + for sz in (-1, 1): + zt = t * 0.5 * sz + z0_, z1_ = (z + zt, z + zt + th) if sz > 0 else (z + zt - th, z + zt) + P.append(bprism("jaw", outline, z0_, z1_, [m, G2], bev=0.0018, segs=1, frame=F, bev_slot=1, min_ang=35)) + for k in range(rivets): + x = x0 + (x1 - x0) * (0.45 + 0.4 * k / max(1, rivets - 1)) + s, e = at(x) + c = s.lerp(e, width * 0.5) + rivet(P, F @ Vector((c.x, c.y, z + t * 0.5 + th)), up, 0.0075, m=G4, tail=G4, L=t + 2 * th) + + +# ======================================================================= the tools + +def wide_scythe(): + P = [] + nibs = ((0.03, -0.04), (-0.03, -0.62)) + pts = [(0.0, 0.13, 0.136), (0.0, 0.05, 0.145), (0.0, -0.3, 0.15), (0.0, -0.8, 0.135), (0.0, -1.3, 0.07), (0.0, -1.62, -0.02), (0.0, -1.74, -0.06)] + pth = UT.Path(pts, per=6) + Ltot = pth.L[-1] + # ---- the beam: an eased square section (round 4's chamfered octagon, same size), green paint worn to the timber on the corners + # where the hands and the shoulder rub + C = resample(pts, 32) + hwf = lambda s: 0.0425 - 0.0092 * s + hhf = lambda s: 0.0495 - 0.011 * s + rcf = lambda s: 0.36 * hwf(s) + rng = random.Random(11) + wear = [lambda s: 0.0 <= s <= 0.14, lambda s: 0.03 <= s <= 0.12, lambda s: 0.34 <= s <= 0.43] + worn = {} + for i in range(len(C) - 1): + s = i / (len(C) - 1) + for j in range(16): + corner = j % 4 != 3 + if corner and any(w(s) for w in wear) and (j % 4 == 1 or rng.random() < 0.35) and j // 4 in (0, 1): + worn[(i, j)] = 1 + P.append(sweep("snath", C, lambda sf, i: rrect(hwf(sf), hhf(sf), rcf(sf), 3), [TEAL, TIM], colfn=lambda i, j: worn.get((i, j), 0), ref=(1, 0, 0), + uv=(0.625, 0.09, 1.2), ang=34)) + sat = lambda t: (hwf(t), hhf(t), rcf(t)) + for t0 in (0.13, 0.48): + strap5(P, pth, t0 + 0.011, *sat(t0 + 0.011), w=0.026, ears=1 if t0 < 0.3 else -1) + # ---- a stuffed sacking shoulder pad, quilted in three pillows, roped on with two coils of three-strand rope + Cp = [pth.at(0.0) + (pth.at(0.0) - pth.at(0.01)).normalized() * 0.014] + [pth.at(k * 0.125 / 12) for k in range(13)] + + def padsec(sf, i): + puff = 0.0045 * abs(math.sin(sf * PI * 3)) ** 0.6 + 0.0015 + end = math.sin(min(1.0, sf * 9, (1 - sf) * 9) * PI / 2) ** 0.5 + k_ = (0.8 if sf < 0.5 else 0.86) + (0.2 if sf < 0.5 else 0.14) * end + hw, hh = (hwf(0.0) + 0.014 + puff) * k_, (hhf(0.0) + 0.013 + puff) * k_ + return rrect(hw, hh, min(hw, hh) * 0.62, 3) + P.append(sweep("pad", Cp, padsec, ["M_Burlap"], ref=(1, 0, 0), uv=(0.5, 0.5, 5.0), ang=40)) + Lcp = arclen(Cp)[-1] + for q in (1, 2): # in the quilting seams + hw, hh = hwf(0.0) + 0.0155 + 0.0032, hhf(0.0) + 0.0145 + 0.0032 + + def Rr(ph, hw=hw, hh=hh): + c, s = math.cos(ph), math.sin(ph) + return 1.0 / ((abs(c) / hw) ** 3.2 + (abs(s) / hh) ** 3.2) ** (1 / 3.2) + P.append(rope_coil("lash", Cp, Lcp * q / 3, Rr, 0.0058, 1.75, segs=13, ref=(1, 0, 0))) + # ---- D-handles: a turned nib, a forged strap from an eye bolted through the beam's side round under the knob + for k, (x, y) in enumerate(nibs): + t = pth.nearest_y(y + 0.05) + cb = pth.at(t) + hw, hh = hwf(t), hhf(t) + Bp = Vector((x, y, -0.1325)) + nib5(P, x, y, 0.1, m_knob=GOLD, r=0.038, wrap=LEAT, nut_drop=0.0075) + A = Vector((-hw - 0.0034, y + 0.05, cb.z + 0.008)) + xo = min(A.x, x - 0.074) + sp = [A, Vector((A.x, A.y, cb.z - hh + 0.004)), Vector((xo, y + 0.05, 0.03)), Vector((xo, y + 0.05, -0.1)), Vector((x - 0.03, y + 0.02, Bp.z)), Bp] + sp = resample(sp, 16, per=6) + P.append(sweep("stirrup", sp, lambda sf, i: rrect(0.0105, 0.0032, 0.0022, 1), [IRON, G2], colfn=lambda i, j: 1 if j % 2 == 0 else 0, + ref=(0, 1, 0), ang=36)) + Fm = fz(A, (-1, 0, 0), (0, 0, 1)) + P.append(bprism("eye", circ(0.0145, 12), -0.0032, 0.0032, [IRON, G2], bev=0.0012, segs=1, frame=Fm, bev_slot=1)) + bolt5(P, A + Vector((-0.0032, 0, 0)), (-1, 0, 0), 2 * hw + 0.0068, 0.0062, kind="dome", m=G4, ref=(0, 0, 1), thr=0.007) + P.append(lathe("eye2", [(0.0, -0.0034), (0.0165, -0.0034), (0.0178, -0.0018), (0.0178, 0.0018), (0.0165, 0.0034), (0.0, 0.0034)], segs=12, m=IRON, + frame=Matrix.Translation(Bp), smooth_ang=40)) + # ---- the blade: round 4's outline, finer, with a beard at the heel + hz, y0 = -0.11, -1.78 + F = tilt_frame(y0, hz) + S, E = scythe_outline(y0, 1.42, 0.3, 0.17, 0.42, 44, neck=(0.088, 0.09, 0.24)) + S36, E36 = scythe_outline(y0, 1.42, 0.3, 0.17, 0.42, 36, neck=(0.088, 0.09, 0.24)) + S20, _ = scythe_outline(y0, 1.42, 0.3, 0.17, 0.42, 20) + tw = (UT.TILT, 0.09) + P.append(blade5("blade", S, E, hz, 0.036, frame=F, ground=0.3, seed=9, rust={(11, 2), (28, 2)}, P=P, twist=tw, sub=1, nc=4)) + on = lambda i, dy=0.012, dz=0.019: F @ Vector((S20[i][0], S20[i][1] + dy, hz + dz)) + up = (F.to_3x3() @ Vector((0, 0, 1))).normalized() + # the riveted back: a channel clasping the spine + back_channel(P, S36, E36, hz, 0.036, F, 0, 34, wf=0.03, th=0.0055, m=G2, rivets=(4, 11, 20, 27), r_riv=0.0085, nose=0.009, taper=0.6, twist=tw) + # ---- the mount: a forged shoe round the beam's end, jaws over the blade where it leaves + end = pth.at(1.0) + dv = (pth.at(1.0) - pth.at(0.97)).normalized() + hwe, hhe, rce = sat(1.0) + shoe(P, -0.062, 0.095, -1.82, -1.68, hz - 0.016, -0.012, 0.009, bolts=[(-0.03, -1.75), (0.05, -1.75)], wedge=(-1.795, -1.712, 0.02), + entry=(pth, lambda d, k: [(a, b * k) for a, b in rrect(hwe + d, hhe + d, rce + d, 3)]), blade_z=hz) + jaws(P, S, E, hz, 0.036, F, 0.09, 0.2, 0.62, th=0.0055, rivets=2) + # ---- the braces. A saddle strap where round 4's braces met the beam, clevis lugs welded on it and on the blade's back + tb = pth.nearest_y(-1.36) + b1 = pth.at(tb) + hwb, hhb, rcb = sat(tb) + sth = 0.0045 + strap5(P, pth, tb, hwb, hhb, rcb, w=0.06, th=sth, ears=0) + ch_top = lambda i: 0.036 * (1.0 - 0.6 * (i / 20) ** 3) * 0.5 + 0.0055 # the back channel's top over the blade plane + # strut A: a flat bar from a clevis on the saddle's +X side down to one on the back at round 4's station 6 + pA = on(6, dz=0.045) + dA = (pA - b1).normalized() + nA = dA.cross((Vector((0, 0, 1)) + up).normalized()).normalized() + sideX = Vector((1, 0, 0)) + kA = (hwb + sth + 0.026) / max(1e-6, dA.x) + eA0 = b1 + dA * kA + eA1 = pA + gapA = 0.0105 + flat_brace(P, eA0, eA1, nA, 0.026, gapA - 0.001, 0.0155, m=IRON) + hp, Lb = clevis(P, eA0, sideX, nA, 0.036, 0.0055, (eA0.x - hwb) + 0.004, 0.0165, gapA, bead_at=eA0.x - hwb - sth) + bolt5(P, hp, nA, Lb, 0.0058, m=G4, ref=dA, thr=0.0065) + hp, Lb = clevis(P, eA1, up, nA, 0.036, 0.0055, 0.045 - ch_top(6) + 0.004, 0.0165, gapA, bead_at=0.045 - ch_top(6)) + bolt5(P, hp, nA, Lb, 0.0058, m=G4, ref=dA, thr=0.0065) + # strut B: rods with forged eyes, a turnbuckle in the middle + r0 = b1 + Vector((0, 0.02, hhb + sth + 0.022)) + pB = on(12, dz=0.045) + dB = (pB - r0).normalized() + nB = dB.cross(Vector((0, 0, 1))).normalized() + r_rod = 0.0078 + for c, dl, base, ba in ((r0, Vector((0, 0, 1)), 0.022 + 0.004, 0.022), (pB, up, 0.045 - ch_top(12) + 0.004, 0.045 - ch_top(12))): + dd = dB if c is r0 else -dB + rod_eye(P, c, -dd, nB, 0.0062, 0.0135, m=G3) + hp, Lb = clevis(P, c, dl, nB, 0.032, 0.005, base, 0.0145, 0.0098, bead_at=ba) + bolt5(P, hp, nB, Lb, 0.0052, m=G4, ref=dd, thr=0.006) + Lt = 0.13 + mid = (r0 + pB) / 2 + for sg, c in ((-1, r0), (1, pB)): + a_ = c - sg * dB * 0.0135 + b_ = mid + sg * dB * (Lt / 2 + 0.008) + P.append(UT.tube("rod", [a_, b_], lambda s: r_rod * 0.92, G3, segs=10, ang=40)) + turnbuckle(P, mid - dB * 0.5, mid + dB * 0.5, nB, r_rod, Lb=Lt) + tfin4(P, "Body", uv=2.4, ang=30) + return dict(elev=38, azim=-30, dist_mul=.7) + + +def scythe(): + P = [] + nibs = ((0.03, -0.04), (-0.03, -0.66)) + pts = [(0.012, 0.15, 0.116), (0.018, 0.07, 0.13), (0.0, -0.08, 0.125), (-0.02, -0.4, 0.13), (-0.012, -0.72, 0.105), (0.01, -1.02, 0.03), (0.0, -1.27, -0.05)] + pth = UT.Path(pts, per=6) + rf = lambda s: 0.0295 - 0.0075 * s + # the snath runs on into the shoe + ext = pts[:-1] + [(0.0, -1.27, -0.05), (-0.002, -1.31, -0.062)] + C = resample(ext, 64) + P.append(turned("snath", C, lambda s: 0.0295 - 0.0075 * min(1.0, s * 1.03), segs=16, s=0.9, u0=0.125, ang=34)) + for k, (x, y) in enumerate(nibs): + nib5(P, x, y, 0.12, m_knob=PRED, r=0.036, wrap=LEAT) + t = pth.nearest_y(y) + r = rf(t) + ring_clamp5(P, pth, t, r, boltside=1 if y > -0.3 else -1) + # the butt: a spiral leather wrap between brass rings, a domed iron cap with a rivet + Lt = pth.L[-1] + Cb = [pth.at(k * 0.12 / 12) for k in range(13)] + P.append(spiral_wrap("buttwrap", Cb, 0.006 * Lt, 0.094 * Lt, lambda q: rf(q / Lt) + 0.0008, 0.0165, 0.003, LEAT, segs=16, rows=4, ref=(1, 0, 0))) + for t in (0.006, 0.096): + c, d = pth.at(t), (pth.at(t + 0.004) - pth.at(t - 0.004)).normalized() + r = rf(t) + P.append(lathe("ring", [(r + 0.0005, -0.0045), (r + 0.0048, -0.003), (r + 0.0058, 0.0), (r + 0.0048, 0.003), (r + 0.0005, 0.0045)], segs=16, m=BRASS, + frame=fz(c, d), smooth_ang=50)) + c0, d0 = pth.at(0.0), (pth.at(0.0) - pth.at(0.02)).normalized() + P.append(lathe("buttcap", [(0.031, -0.012), (0.0335, -0.006), (0.0335, -0.002), (0.031, 0.003), (0.024, 0.0075), (0.012, 0.0098), (0.0, 0.0102)], + segs=16, m=G2, frame=fz(c0, d0), smooth_ang=40)) + P.append(lathe("capring", [(0.0335, -0.012), (0.0352, -0.0105), (0.0352, -0.0075), (0.0335, -0.006)], segs=16, m=G3, frame=fz(c0, d0), smooth_ang=40)) + head(P, c0 + d0 * 0.0095, d0, 0.005, "dome", m=BRASS) + # painted bands by the fore grip + for t0, m in ((.47, PRED), (.495, CRM), (.52, PRED)): + a, b = pth.at(t0 + 0.001), pth.at(t0 + 0.015) + P.append(UT.tube("band", [a, b], lambda s: rf(t0) + 0.0012, m, segs=16, ang=30, cap=False)) + # a whetstone in a cow horn, hung off the snath on a leather strap with a buckle + hk = pth.at(pth.nearest_y(-.26)) + P.append(UT.tube("hstrap", [hk + Vector((0, -.012, 0)), hk + Vector((0, .012, 0))], lambda s: (.0335, .0335), LEAT, segs=16, ang=30, cap=False)) + P.append(bprism("buckle", rounded_outline([(-0.009, -0.011), (0.009, -0.011), (0.009, 0.011), (-0.009, 0.011)], 0.003, 2), 0.0, 0.003, [BRASS], + bev=0.001, segs=1, frame=fz(hk + Vector((0, 0, 0.0335)), (0, 0, 1), (0, 1, 0)))) + a = hk + Vector((.03, 0, -.02)) + hn = [a, a + Vector((.012, 0, -.05)), a + Vector((.03, .004, -.11)), a + Vector((.05, .01, -.19))] + P.append(turned("horn", resample(hn, 14), lambda s: .03 * (1 - s) ** .7 + .005, m="M_PaintCream", segs=14, s=1.0)) + for s0 in (0.08, 0.32): + cc = resample(hn, 20) + q = int(s0 * 20) + dd = (cc[q + 1] - cc[q]).normalized() + P.append(lathe("hornring", [(0.0, -0.004), (.03 * (1 - s0) ** .7 + .0065, -0.004), (.03 * (1 - s0) ** .7 + .0075, 0.0), (.03 * (1 - s0) ** .7 + .0065, 0.004), (0.0, 0.004)], + segs=14, m=BRASS, frame=fz(cc[q], dd), smooth_ang=50)) + P.append(bprism("hone", rounded_outline([(-0.015, -0.015), (0.015, -0.015), (0.015, 0.015), (-0.015, 0.015)], 0.006, 2), -0.025, 0.028, [G3], + bev=0.003, segs=2, frame=Matrix.Translation(a + Vector((-.003, 0, .03))))) + # ---- the blade + end = Vector((0, -1.3, -0.055)) + hz, y0 = -0.095, -1.3 + F = tilt_frame(y0, hz) + S, E = scythe_outline(y0, 0.8, 0.19, 0.13, 0.17, 48, neck=(0.046, 0.022, 0.15)) + S18, _ = scythe_outline(y0, 0.8, 0.19, 0.13, 0.17, 18) + tw = (UT.TILT, 0.05) + P.append(blade5("blade", S, E, hz, 0.026, frame=F, ground=0.3, seed=4, rust={(24, 2)}, P=P, twist=tw, sub=1, nc=4)) + back_channel(P, S, E, hz, 0.026, F, 0, 37, wf=0.02, th=0.0045, m=DGY, rivets=(), nose=0.008, taper=0.55, twist=tw) + UM.star_badge(P, F @ Vector((0.1, -1.255, hz + 0.0135)), .05, F.to_3x3() @ Vector((0, 0, 1))) + # ---- the mount + dv = (pth.at(1.0) - pth.at(0.97)).normalized() + shoe(P, -0.036, 0.05, -1.35, -1.27, hz - 0.012, -0.027, 0.007, bolts=[(0.007, -1.31)], wedge=(-1.335, -1.292, 0.018), + entry=(pth, lambda d, k: [(a, b * k) for a, b in circ(0.022 + d, 16)]), blade_z=hz) + # a side bolt through the shoe, nut on the far side + bolt5(P, (-0.036, -1.31, -0.075), (-1, 0, 0), 0.086, 0.0072, m=G4, ref=(0, 0, 1), thr=0.0) + jaws(P, S, E, hz, 0.026, F, 0.045, 0.13, 0.6, th=0.0045, rivets=2) + # ---- the grass nail: a flat stay from a lug under a little strap on the snath to a lug on the blade's back + tn = pth.nearest_y(-1.08) + a = pth.at(tn) + ring_clamp5(P, pth, tn, rf(tn), boltside=0, w=0.02, saddle=True) + sd = rf(tn) + 0.0045 * 0.6 + 0.006 # the saddle's underside below the snath's centre + p0 = a + Vector((0.0, 0, -sd - 0.011)) + up = (F.to_3x3() @ Vector((0, 0, 1))).normalized() + ch3 = 0.026 * 0.5 + 0.0045 + p1 = F @ Vector((S18[3][0], S18[3][1] + 0.008, hz + 0.03)) + d = (p1 - p0).normalized() + nn = d.cross((Vector((0, 0, 1)) + up).normalized()).normalized() + flat_brace(P, p0, p1, nn, 0.013, 0.0046, 0.0085, m=IRON) + hp, Lb = clevis(P, p0, Vector((0, 0, -1)), nn, 0.02, 0.0035, 0.011 + 0.004, 0.009, 0.0052, bead_at=0.011) + bolt5(P, hp, nn, Lb, 0.0034, m=G4, ref=d, thr=0.004) + hp, Lb = clevis(P, p1, up, nn, 0.02, 0.0035, 0.03 - ch3 + 0.003, 0.009, 0.0052, bead_at=0.03 - ch3) + bolt5(P, hp, nn, Lb, 0.0034, m=G4, ref=d, thr=0.004) + tfin4(P, "Body", uv=2.4, ang=30) + return dict(elev=38, azim=-30, dist_mul=.7) + + +def ring_clamp5(P, pth, t, r, boltside=1, w=0.028, th=0.0045, m=IRON, saddle=False, ear_scale=1.5, bolt_m=G2): + """A round strap round the snath at t: rolled edges, the ends chamfered down, pinch ears on the bolt side, a saddle under it.""" + Ltot = pth.L[-1] + ss = [-0.5, -0.47, -0.4, -0.3, 0.3, 0.4, 0.47, 0.5] + tk = [0.0006, th * 0.9, th * 1.25, th, th, th * 1.25, th * 0.9, 0.0006] + C = [pth.at(t + q * w / Ltot) for q in ss] + T, N, B = frames(C, ref=(1, 0, 0)) + P.append(sweep("clamp", C, lambda sf, i: circ(r + tk[i], 16), [m], cap0=False, cap1=False, ang=40, frm=(T, N, B))) + c = pth.at(t) + i = len(C) // 2 + Tt = T[i] + if boltside: + side = Vector((boltside, 0, 0)) + side = (side - Tt * side.dot(Tt)).normalized() + Bz = Tt.cross(side) * boltside + Bz = Bz if Bz.z > 0 else -Bz + es = ear_scale + gap = 0.0065 * es ** 0.5 + ear_len, ew, et = 0.024 * es, w * min(0.48, 0.4 * es), th * min(1.35, es) + for sz in (-1, 1): + org = c + side * (r - 0.004) + Bz * sz * (gap / 2 + et / 2) + Fm = Matrix((side, Tt, Bz)).transposed().to_4x4() + Fm.translation = org + out = rounded_outline([(0.0, -ew), (ear_len * 0.35, -ew * 0.97), (ear_len, -ew * 0.84), (ear_len, ew * 0.84), (ear_len * 0.35, ew * 0.97), (0.0, ew)], + 0.008 * es, n=2 if HW_LOD[0] else 3) + P.append(bprism("ear", out, -et / 2, et / 2, [m, G3], bev=0.0011 * es, segs=1, frame=Fm, bev_slot=1)) + bc = c + side * (r - 0.004 + ear_len * 0.6) + bolt5(P, bc + Bz * (gap / 2 + et), Bz, gap + 2 * et, 0.005 * min(1.3, es), m=bolt_m, ref=Tt, thr=0.006 * es) + # the saddle under the strap that the stay hangs from + if not saddle: + return + Fm = fz(c - Vector((0, 0, r + th * 0.6)), (0, 0, -1), Tt) + P.append(bprism("saddle", rounded_outline([(-0.017, -w * 0.45), (0.017, -w * 0.45), (0.017, w * 0.45), (-0.017, w * 0.45)], 0.006, 2), + -0.004, 0.006, [m, G3], bev=0.0015, segs=1, frame=Fm, bev_slot=1)) + + +def garden_shears(): + py, ty = PV_Y, -0.62 + z_in = 0.0008 + tf = lambda u: 0.0145 * (1 - 0.45 * u) + 0.002 + + def hw(u): # the spine: straight, then rounding over into the tip + k = 0.78 + base = 0.041 - 0.009 * min(u, k) + return base * math.sqrt(max(0.0, 1 - ((u - k) / (1 - k)) ** 2)) + 0.002 if u > k else base + + he = lambda u: 0.011 * (1 - 0.5 * u) + # a crisper branch notch: a round hollow with a short flat run-in + notch = lambda u: 0.0135 * math.sin(PI * (u - 0.05) / 0.12) ** 0.7 if 0.05 < u < 0.17 else 0.0 + cfn = lambda u: 0.0 + t0 = tf(0.0) + for nm, sx, sz in (("BladeA", 1, 1), ("BladeB", -1, -1)): + P = [shear_blade5(sx, sz, py, ty, hw, he, cfn, tf, z_in=z_in, n=40, notch=notch if sx > 0 else None, seed=3 if sx > 0 else 8)] + zc = sz * (z_in + t0 * 0.5) + hz = sz * 0.0105 + # the boss round the pivot: a chamfered disc with a raised rim and a seat for the washer + zA, zB = sz * z_in, sz * (z_in + t0) + lo, hi = min(zA, zB), max(zA, zB) + if sz > 0: + prof = [(0.0, lo), (0.0315, lo), (0.034, lo + 0.002), (0.034, hi - 0.003), (0.031, hi), (0.0225, hi), (0.0215, hi - 0.0012), (0.0, hi - 0.0012)] + else: + prof = [(0.0, lo + 0.0012), (0.0215, lo + 0.0012), (0.0225, lo), (0.031, lo), (0.034, lo + 0.003), (0.034, hi - 0.002), (0.0315, hi), (0.0, hi)] + P.append(lathe("boss", prof, segs=24, m=G2, frame=Matrix.Translation((0, py, 0)), smooth_ang=30)) + # the forged tang: a flat bar from the boss to the ferrule, rounded edges + fr0 = Vector((sx * 0.031, -0.05, hz)) + tg = [Vector((sx * 0.004, py + 0.012, zc)), Vector((sx * 0.012, -0.095, zc)), Vector((sx * 0.024, -0.066, hz)), fr0 + Vector((0, 0.012, 0))] + tgc = resample(tg, 14, per=6) + P.append(sweep("tang", tgc, lambda sf, i: rrect(0.0145 - 0.0025 * sf, 0.0068 + 0.0035 * sf, 0.0045 + 0.002 * sf, 2), [G2, G3], + colfn=lambda i, j: 1 if j % 3 != 2 else 0, ref=(1, 0, 0), ang=36)) + # the ash handle: turned, a bead and a groove behind the ferrule + hp = [fr0, Vector((sx * 0.038, 0.0, hz)), Vector((sx * 0.044, 0.08, hz)), Vector((sx * 0.046, 0.168, hz))] + hc = resample(hp, 30, per=6) + + def hrf(s): + r = 0.0175 + 0.003 * math.sin(s * PI) - 0.0025 * max(0.0, 1 - s / 0.14) + if 0.2 < s < 0.24: + r += 0.0018 * math.sin((s - 0.2) / 0.04 * PI) + if 0.27 < s < 0.3: + r -= 0.0012 * math.sin((s - 0.27) / 0.03 * PI) + return r + P.append(turned("handle", hc, hrf, segs=16, s=1.6, u0=0.125, ref=(0, 0, 1))) + # the steel ferrule: rolled rims, two rivets through it and the tang, a brass head on top and a peened tail under + fa, fb = fr0 + Vector((-sx * 0.0015, -0.012, 0)), fr0 + Vector((sx * 0.0012, 0.022, 0)) + fd = (fb - fa).normalized() + P.append(lathe("ferrule", [(0.0, -0.002), (0.0195, -0.002), (0.0212, 0.0), (0.0212, 0.0035), (0.02, 0.005), (0.02, 0.029), (0.0218, 0.0305), + (0.0218, 0.034), (0.0202, 0.0355), (0.0, 0.0355)], segs=16, m=G3, frame=fz(fa, fd, (0, 0, 1)), smooth_ang=40)) + for k_ in (0.35, 0.7): + rc = fa.lerp(fb, k_) + rivet(P, rc + Vector((0, 0, 0.0201)), (0, 0, 1), 0.0036, m=BRASS, tail=BRASS, L=0.0402) + # the red rubber grip: a lip at the front, finger swells, rings to hold it, a flared end + gp = Path4([Vector((sx * 0.0405, 0.05, hz)), Vector((sx * 0.044, 0.1, hz)), Vector((sx * 0.046, 0.165, hz))]) + gq = resample(gp.pts, 40) + + def grf(s): + r = 0.0218 + 0.0042 * max(0.0, 1 - s / 0.06) ** 1.5 + 0.0018 * abs(math.sin(s * PI * 3.0)) ** 2 * (1 if s < 0.84 else 0) + 0.004 * max(0.0, (s - 0.88) / 0.12) + if 0.08 < s < 0.86: + r += 0.0011 * (1 if math.sin((s - 0.08) / 0.78 * PI * 11) > 0.35 else 0) # moulded grip rings + return r + P.append(sweep("grip", gq, lambda sf, i: circ(grf(sf), 16), [PRED], ref=(0, 0, 1), ang=40)) + end = gp.pts[-1] + P.append(lathe("knob", [(0.0, -0.002), (0.0245, -0.002), (0.0262, 0.003), (0.0262, 0.007), (0.024, 0.0105), (0.021, 0.0125), (0.0185, 0.0155), + (0.0, 0.017)], segs=16, m=RUB, frame=Matrix.Translation(end) @ Matrix.Rotation(DEG(-90), 4, "X"), smooth_ang=40)) + # the bumper: a rubber dome in a steel cup on the inside of each tang, the handles stop on these + bc = Vector((sx * 0.02, -0.062, hz)) + bn = Vector((-sx, 0, 0)) + P.append(lathe("bumpcup", [(0.0, -0.002), (0.0098, -0.002), (0.0105, 0.0), (0.0105, 0.0045), (0.0092, 0.0055), (0.0, 0.0055)], segs=12, m=G4, + frame=fz(bc - bn * 0.002, bn), smooth_ang=40)) + P.append(lathe("bump", [(0.0, 0.004), (0.0078, 0.004), (0.0078, 0.0085), (0.0068, 0.0092), (0.0072, 0.0104), (0.0055, 0.0128), (0.003, 0.0138), (0.0, 0.014)], + segs=12, m=RUB, frame=fz(bc - bn * 0.002, bn), smooth_ang=50)) + if sx < 0: # a leather hanging loop through a brass eyelet in the end of one handle + e = end + Vector((0, 0.012, 0)) + P.append(lathe("eyelet", [(0.0045, -0.0035), (0.0068, -0.0035), (0.0075, -0.002), (0.0075, 0.002), (0.0068, 0.0035), (0.0045, 0.0035)], segs=12, m=BRASS, + frame=fz(e + Vector((0, -0.004, 0)), (0, 0, 1)), smooth_ang=50)) + pts = [e, e + Vector((-0.02, 0.022, 0)), e + Vector((-0.012, 0.056, 0)), e + Vector((0.016, 0.064, 0)), e + Vector((0.026, 0.034, 0)), e + Vector((0.006, 0.006, 0))] + P.append(UT.tube("lanyard", pts, lambda s: (0.0055, 0.0028), LEAT, segs=8, per=5, ang=40, cap=False)) + o = tfin4(P, nm, uv=5.0, ang=30) + set_origin(o, (0, py, 0)) + # ---- the pivot bolt (static Body): a domed brass head with a slot over a dished steel washer, a hex nut under a washer, + # the thread poking through the nut + zt = z_in + t0 + c = Vector((0, py, 0)) + B = [] + B.append(lathe("dish", [(0.0, zt - 0.0012), (0.0205, zt - 0.0012), (0.0215, zt + 0.0004), (0.016, zt + 0.0022), (0.0, zt + 0.0022)], segs=24, m=G4, smooth_ang=30, + frame=Matrix.Translation(c))) + z1 = zt + 0.0022 + B.append(lathe("head", [(0.0, z1 - 0.0005), (0.0172, z1 - 0.0005), (0.0175, z1 + 0.0018), (0.0155, z1 + 0.0048), (0.011, z1 + 0.0068), (0.005, z1 + 0.0078), + (0.0, z1 + 0.008)], segs=20, m=BRASS, frame=Matrix.Translation(c), smooth_ang=40)) + B.append(bprism("slot", [(-0.0115, -0.0014), (0.0115, -0.0014), (0.0115, 0.0014), (-0.0115, 0.0014)], z1 + 0.0055, z1 + 0.0082, [DGY], frame=Matrix.Translation(c))) + q = washer(B, c + Vector((0, 0, -zt + 0.0006)), (0, 0, -1), 0.0185, 0.0018, m=G4, segs=20) + q = hexnut(B, q, (0, 0, -1), 0.0165, 0.0085, m=G4, ref=(1, 0, 0)) + thread(B, q + Vector((0, 0, 0.002)), (0, 0, -1), 0.0072, 0.0075, m=G3, segs=12) + B.append(UT.disc("shaft", 0.008, 2 * zt, (0, py, 0), G3, n=12)) + tfin4(B, "Body", uv=5.0, ang=30) + return dict(elev=60, azim=-12, dist_mul=.72) + + +def shear_blade5(sx, sz, py, ty, hw, he, cfn, tf, z_in=0.0008, n=30, heel=0.03, notch=None, seed=3, nc=6, mscale=0.03, mottle=True, + spine=G2, inner=G3, cheek=G1): + """One shear blade from the pivot to the tip: a flat inner face, a rounded spine, a hammered outer cheek, a dark grind line, a bright + ground bevel and a fine edge. sx = +1: spine on -X, edge on +X (BladeA). sz: the layer. nc: points across the cheek.""" + rng = random.Random(seed) + rings, slots = [], None + ys = [] + for i in range(n + 1): + f = i / n + ys.append((py + heel) + (ty + 0.004 - (py + heel)) * f ** 0.92) + # more stations through the notch + if notch: + ux = [0.05 + 0.12 * k / 10 for k in range(1, 10)] + ys += [py - u * (py - ty) for u in ux] + ys = sorted(set(round(y, 5) for y in ys), reverse=True) + cf = [0.74 - (0.74 - 0.47) * q / (nc - 1) for q in range(nc)] + for i, y in enumerate(ys): + u = max(0.0, (py - y) / (py - ty)) + c = cfn(u) + k = 1.0 - 0.5 * (max(0.0, y - py) / heel) ** 2 + h_e = he(u) * k - (notch(u) if notch else 0.0) + S, E = c - sx * hw(u) * k, c + sx * h_e + t = tf(u) + W = abs(S - E) + ch = min(0.0035, W * 0.18) + X = lambda f: E + (S - E) * f # f: 0 at the edge, 1 at the spine + dim = 0.00025 if 0 < i < len(ys) - 1 else 0.0 + pts = ([(S, z_in), (S, z_in + t * 0.62), (S + sx * ch * 0.35, z_in + t * 0.9), (S + sx * ch, z_in + t)] + + [(X(f), z_in + t + (rng.uniform(-dim, dim) if 0 < q < nc - 1 else 0.0)) for q, f in enumerate(cf)] + + [(X(0.44), z_in + t * 0.95), (X(0.06), z_in + t * 0.2), (E, z_in + t * 0.08), (E, z_in)]) + slots = [0, 0, 0] + [1] * nc + [2, 3, 4, 4, 5] + rings.append([Vector((x, y, sz * z)) for x, z in pts]) + tipc = cfn(1.0) + sx * he(1.0) * 0.4 + rings.append([Vector((tipc, ty, sz * (z_in + tf(1.0) * 0.35)))]) + mats = [spine, cheek, GLINE, BEV, EDGE, inner, HMD, HML] + + def col(i, j): + if j < 0: + return 0 + return slots[j] + o = rings_mesh("blade", rings, mats, colfn=col, ang=32) + if mottle: + hammer_uv(o, 1, STEEL_RAMP, scale=mscale * 0.6, seed=seed) + return o + + +# ======================================================================= round 5, second batch: the other blade tools + +def bump(s, c, w): + """A smooth bump of half-width w centred on c (1 at c, 0 beyond).""" + x = abs(s - c) / w + return 0.0 if x >= 1 else 0.5 + 0.5 * math.cos(PI * x) + + +def feature_ss(n, feats, lo=0.0, hi=1.0): + """n even path fractions lo..hi plus a few around each feature (c, w), so grooves and beads get the stations they need.""" + ss = [lo + (hi - lo) * k / n for k in range(n + 1)] + for c, w in feats: + ss += [c + w * q for q in (-1.3, -1.0, -0.7, -0.4, 0.0, 0.4, 0.7, 1.0, 1.3)] + return sorted(set(round(min(hi, max(lo, s)), 6) for s in ss)) + + +def rope_sec(r, lobes=3, n=7, tw=7.0, turns=1.0): + """A three-strand rope section that twists along the rope: sec(s, i).""" + return lambda s, i: [(r * (1 + 0.16 * math.cos(lobes * (q * TAU / n) - tw * s * turns * TAU / lobes)) * math.cos(q * TAU / n), + r * (1 + 0.16 * math.cos(lobes * (q * TAU / n) - tw * s * turns * TAU / lobes)) * math.sin(q * TAU / n)) for q in range(n)] + + +def endgrain_cap(name, ring, centre, nrm, rise, pith, u0=0.5, uw=0.44, m=TIM): + """A low dome closing a ring of points (the cut end of a timber part): the timber texture laid radially round `pith` (a point off to + one side) across all four of its boards, so the dark lines between the boards and the grain stripes become arcs: growth rings.""" + nrm = Vector(nrm).normalized() + centre = Vector(centre) + pith = Vector(pith) + bm = bmesh.new() + uvl = bm.loops.layers.uv.verify() + rows = [list(ring)] + [[centre.lerp(Vector(p), f) + nrm * (rise * (1 - f * f)) for p in ring] for f in (0.7, 0.4)] + V = [[bm.verts.new(p) for p in r] for r in rows] + vc = bm.verts.new(centre + nrm * rise) + ds = [(Vector(p) - pith).length for p in ring] + dmax, dmin = max(ds), max(0.0, min(ds) - (max(ds) - min(ds)) * 0.2) + ax = (Vector(ring[0]) - centre).normalized() + ay = nrm.cross(ax) + + def uvf(p): + d = p - pith + return (u0 - uw + 2 * uw * max(0.0, min(1.0, (d.length - dmin) / max(1e-6, dmax - dmin))), math.atan2(d.dot(ay), d.dot(ax)) * 0.02) + nr = len(ring) + for a in range(len(V) - 1): + for j in range(nr): + q = (j + 1) % nr + f = bm.faces.new((V[a][j], V[a][q], V[a + 1][q], V[a + 1][j])) + for lp in f.loops: + lp[uvl].uv = uvf(lp.vert.co) + for j in range(nr): + f = bm.faces.new((V[-1][j], V[-1][(j + 1) % nr], vc)) + for lp in f.loops: + lp[uvl].uv = uvf(lp.vert.co) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + for f in bm.faces: + f.normal_update() + if sum(f.normal.dot(nrm) for f in bm.faces) < 0: + bmesh.ops.reverse_faces(bm, faces=bm.faces) + o = mesh_obj(name, bm) + set_mats(o, m) + smooth(o, 50) + o["uv_done"] = True + return o + + +def bow_ring(name, c, rx, ry, a_in, a_z, z, m_out=PRED, m_in=G4, seg=40, ns=14, p=2.4): + """A finger bow: a closed ring round an oval centre line in the XY plane (rx, ry), its section a superellipse a_in across, a_z up. + The enamel (m_out) stops short of the inside of the loop, where the steel (m_in) shows, worn by the finger.""" + bm = bmesh.new() + R = [] + sec = sellipse(a_in, a_z, p, ns, ph=PI / ns) + for i in range(seg): + a = TAU * i / seg + q = Vector((c[0] + rx * math.cos(a), c[1] + ry * math.sin(a), z)) + nrm = Vector((math.cos(a) / rx, math.sin(a) / ry, 0)).normalized() + R.append([bm.verts.new(q + nrm * u + Vector((0, 0, v))) for u, v in sec]) + idx = [] + for i in range(seg): + A, B_ = R[i], R[(i + 1) % seg] + for j in range(ns): + k = (j + 1) % ns + bm.faces.new((A[j], B_[j], B_[k], A[k])) + t = PI / ns + TAU * (j + 0.5) / ns + idx.append(1 if math.cos(t) < -0.55 else 0) + bmesh.ops.recalc_face_normals(bm, faces=bm.faces) + o = mesh_obj(name, bm) + set_mats(o, m_out, m_in) + o.data.polygons.foreach_set("material_index", idx) + o.data.update() + smooth(o, 45) + return o + + +# ----------------------------------------------------------------------- nail scissors + +def nail_scissors(): + """Round 4's frame (screw at PV_Y, tips at -0.455, the bows where they were). Polished blades with the real section (flat inner face, + a rounded spine, a satin cheek, a dark grind line, a bright bevel, a fine edge) curving to the tips; a chamfered boss with a seat for + the screw; shanks forged oval with a knuckle by the boss and a bead where they meet the bows; the bows enamelled over steel, the steel + showing round the inside; a finger rest curling off the big bow to a polished ball; a slotted domed brass screw over a washer, a domed + cap nut under.""" + py, ty = PV_Y, -0.455 + z_in = 0.0006 + tf = lambda u: 0.0105 * (1 - 0.62 * u) + 0.0018 + hw = lambda u: 0.0275 * (1 - u) ** 0.85 + 0.0016 + he = lambda u: 0.0205 * (1 - u) ** 0.95 + 0.0010 + cfn = lambda u: -0.02 * u ** 2.2 # curved nail scissors: the tips sweep a little to -X + t0 = tf(0.0) + for nm, sx, sz in (("BladeA", 1, 1), ("BladeB", -1, -1)): + P = [shear_blade5(sx, sz, py, ty, hw, he, cfn, tf, z_in=z_in, n=44, heel=0.022, seed=5 if sx > 0 else 6, nc=5, mottle=False, + cheek=G3, spine=G2, inner=G2)] + zc = sz * (z_in + t0 * 0.5) + # the boss round the screw: chamfered, a seat for the screw head (top) or the cap nut (under) + zA, zB = sz * z_in, sz * (z_in + t0) + lo, hi = min(zA, zB), max(zA, zB) + if sz > 0: + prof = [(0.0, lo), (0.0215, lo), (0.023, lo + 0.0015), (0.023, hi - 0.0022), (0.0208, hi), (0.0146, hi), (0.0139, hi - 0.0008), (0.0, hi - 0.0008)] + else: + prof = [(0.0, lo + 0.0008), (0.0139, lo + 0.0008), (0.0146, lo), (0.0208, lo), (0.023, lo + 0.0022), (0.023, hi - 0.0015), (0.0215, hi), (0.0, hi)] + P.append(lathe("boss", prof, segs=24, m=G4, frame=Matrix.Translation((0, py, 0)), smooth_ang=30)) + # the shank: forged oval, a knuckle by the boss, drawn thinner towards the bow + big = sx < 0 + cb = Vector((sx * (0.061 if big else 0.056), 0.064 if big else 0.06, zc)) + rx, ry = (0.036, 0.046) if big else (0.031, 0.04) + d = (Vector((0, py, zc)) - cb) + a_in = math.atan2(d.y / ry, d.x / rx) + entry = cb + Vector((rx * math.cos(a_in), ry * math.sin(a_in), 0)) + sh = [Vector((0, py + 0.006, zc)), Vector((sx * 0.011, py + 0.05, zc)), Vector((sx * 0.03, -0.045, zc)), entry + Vector((0, -0.012, 0)), entry] + C = resample(sh, 26, per=5) + + def shsec(s, i): + k = 1 + 0.16 * bump(s, 0.16, 0.12) + 0.1 * bump(s, 0.86, 0.08) + return sellipse(0.0066 * k * (1 - 0.12 * s), (0.0108 - 0.0024 * s) * k, 2.6, 14) + P.append(sweep("shank", C, shsec, [G4, G5], colfn=lambda i, j: 1 if j in (0, 13, 6, 7) else 0, ref=(0, 0, 1), ang=40)) + dd = (C[-3] - C[-1]).normalized() + P.append(lathe("bead", [(0.0, -0.002), (0.0098, -0.002), (0.0122, 0.0), (0.0128, 0.0022), (0.0118, 0.0045), (0.0098, 0.0058), (0.0, 0.0058)], + segs=14, m=G5, frame=fz(entry + dd * 0.004, dd), smooth_ang=50)) + # the bow: red enamel over an oval steel loop, the steel showing round the inside + P.append(bow_ring("bow", cb, rx, ry, 0.0118, 0.0082, zc, seg=40, ns=14)) + if big: + # the finger rest: a tapering spur curling back off the outside of the big bow, a polished ball on its end + a0 = DEG(150) + p0 = cb + Vector((rx * math.cos(a0), ry * math.sin(a0), 0)) + spur = [p0 + Vector((0.004, -0.004, 0)), p0 + Vector((-0.012, 0.022, 0)), p0 + Vector((-0.014, 0.055, 0)), p0 + Vector((0.004, 0.075, 0))] + Cs = resample(spur, 18, per=5) + P.append(sweep("spur", Cs, lambda s, i: sellipse(0.0055 * (1 - 0.3 * s), 0.0072 * (1 - 0.45 * s), 2.3, 12), [G4, G5], + colfn=lambda i, j: 1 if j in (2, 3) else 0, ref=(0, 0, 1), ang=40)) + de = (Cs[-1] - Cs[-2]).normalized() + P.append(lathe("spurtip", [(0.0, -0.003), (0.0042, -0.0025), (0.0062, 0.0), (0.0068, 0.0035), (0.0058, 0.0068), (0.0032, 0.0088), (0.0, 0.0092)], + segs=14, m=G5, frame=fz(Cs[-1] - de * 0.002, de), smooth_ang=50)) + P.append(lathe("spurcol", [(0.0, -0.0025), (0.0068, -0.0025), (0.0082, 0.0), (0.0068, 0.0025), (0.0, 0.0025)], segs=12, m=G5, + frame=fz(Cs[2], (Cs[3] - Cs[1]).normalized()), smooth_ang=50)) + o = tfin4(P, nm, uv=5.0, ang=30) + set_origin(o, (0, py, 0)) + # ---- the screw (static Body): a slotted domed brass head on a thin washer, a domed cap nut under, the shaft between + zt = z_in + t0 + c = Vector((0, py, 0)) + B = [lathe("washer", [(0.0, zt - 0.0009), (0.0136, zt - 0.0009), (0.0139, zt - 0.0002), (0.0131, zt + 0.0004), (0.0, zt + 0.0004)], segs=24, m=G4, + frame=Matrix.Translation(c), smooth_ang=30)] + z1 = zt + 0.0004 + B.append(lathe("head", [(0.0, z1 - 0.0004), (0.0124, z1 - 0.0004), (0.0127, z1 + 0.0009), (0.0118, z1 + 0.0026), (0.0094, z1 + 0.0041), + (0.0055, z1 + 0.005), (0.0, z1 + 0.0053)], segs=24, m=BRASS, frame=Matrix.Translation(c), smooth_ang=40)) + B.append(bprism("slot", [(-0.0082, -0.0009), (0.0082, -0.0009), (0.0082, 0.0009), (-0.0082, 0.0009)], z1 + 0.0032, z1 + 0.0056, [DGY], + frame=Matrix.Translation(c))) + B.append(lathe("capnut", [(0.0, -zt + 0.0008), (0.0112, -zt + 0.0008), (0.0114, -zt - 0.0006), (0.0108, -zt - 0.0022), (0.0088, -zt - 0.0036), + (0.0052, -zt - 0.0043), (0.0, -zt - 0.0045)], segs=20, m=G4, frame=Matrix.Translation(c), smooth_ang=40)) + B.append(UT.disc("shaft", 0.006, 2 * zt, (0, py, 0), G3, n=12)) + tfin4(B, "Body", uv=5.0, ang=30) + return dict(elev=60, azim=-12, dist_mul=.72) + + +# ----------------------------------------------------------------------- sickle + +def sickle(): + """Round 4's frame: the same pistol-handle path, reach and crescent. A turned handle (swell, waist, incised rings, a bead behind the + ferrule, grain along it) with a spiral leather grip between brass welts; a turned red pommel with a brass ring and a screw eye at its + end, a three-strand rope loop through it, the ends whipped with jute; a rolled brass ferrule riveted through; one forged iron bolster + where the tang goes in; the crescent with the real section (edge, bevel, grind line, hammered cheek, a thickened forged spine).""" + P = [] + z = 0.26 + hp = [(0, 0.03, -0.3), (0, 0.012, -0.14), (0, 0, 0.02), (0, -0.04, 0.17), (0, -0.16, z - 0.005), (0, -0.335, z)] + pth = UT.Path(hp, per=5) + Lh = pth.L[-1] + + def rf(s): + r = 0.04 + 0.009 * math.exp(-((s - 0.2) / 0.13) ** 2) + 0.004 * math.exp(-((s - 0.47) / 0.08) ** 2) - 0.004 * max(0.0, (s - 0.62) / 0.38) + r -= 0.0016 * (bump(s, 0.575, 0.007) + bump(s, 0.6, 0.007)) # two incised rings ahead of the grip + r += 0.0024 * bump(s, 0.925, 0.014) - 0.0012 * bump(s, 0.95, 0.008) # a bead and a cove behind the ferrule + return r + ss = feature_ss(70, [(0.575, 0.007), (0.6, 0.007), (0.925, 0.014), (0.95, 0.008)], 0.0, 0.985) + C = [pth.at(s) for s in ss] + P.append(sweep("handle", C, lambda sf, i: circ(rf(ss[i]), 18), [TIM], uv=(0.125, 0.09, 1.0), ref=(1, 0, 0), ang=34)) + # the leather grip: a spiral wrap between two brass welts where the fingers close + g0, g1 = 0.255, 0.5 + P.append(spiral_wrap("wrap", C, g0 * Lh, g1 * Lh, lambda q: rf(q / Lh) + 0.0004, 0.021, 0.0033, LEAT, segs=18, rows=3, ref=(1, 0, 0))) + for t in (g0 - 0.006, g1 + 0.006): + c, d = pth.at(t), (pth.at(t + 0.004) - pth.at(t - 0.004)).normalized() + r = rf(t) + 0.0035 + P.append(lathe("welt", [(r - 0.004, -0.0048), (r - 0.0008, -0.0042), (r + 0.0012, -0.002), (r + 0.0016, 0.0), (r + 0.0012, 0.002), + (r - 0.0008, 0.0042), (r - 0.004, 0.0048)], segs=18, m=BRASS, frame=fz(c, d), smooth_ang=50)) + # the pommel: turned, red, a cove and a bead, a brass ring where it meets the handle, a screw eye in its end + FP = Matrix.Translation((0, 0.031, 0)) + P.append(lathe("pommel", [(0.037, -0.288), (0.0445, -0.2915), (0.0466, -0.2965), (0.0446, -0.3005), (0.0458, -0.3035), (0.0492, -0.3095), + (0.0512, -0.317), (0.0514, -0.3245), (0.0494, -0.332), (0.0446, -0.3385), (0.0362, -0.3428), (0.022, -0.3452), + (0.0, -0.346)], segs=20, m=PRED, frame=FP, smooth_ang=40)) + P.append(lathe("pring", [(0.0405, -0.2925), (0.0436, -0.2912), (0.0458, -0.2895), (0.0462, -0.2862), (0.0452, -0.2826), (0.0428, -0.281), + (0.0405, -0.2805)], segs=20, m=BRASS, frame=Matrix.Translation((0, 0.03, 0)), smooth_ang=50)) + ey = Vector((0, 0.031, -0.3605)) + P.append(lathe("eyeplate", [(0.0, -0.3448), (0.011, -0.3448), (0.0118, -0.3462), (0.0104, -0.3478), (0.004, -0.3484), (0.0, -0.3484)], segs=14, + m=BRASS, frame=Matrix.Translation((0, 0.031, 0)), smooth_ang=40)) + P.append(UT.tube("eyeshank", [Vector((0, 0.031, -0.347)), ey + Vector((0, 0, 0.0082))], lambda s: 0.0028, BRASS, segs=8, ang=40)) + ring = [ey + Vector((0, 0.0085 * math.sin(TAU * k / 16), 0.0085 * math.cos(TAU * k / 16))) for k in range(16)] + P.append(UT.tube("eye", ring + ring[:2], lambda s: 0.0026, BRASS, segs=8, per=1, cap=False, ang=50)) + # a three-strand rope loop through the eye, the two ends laid together and whipped with twine + lp = [ey + Vector((0.0, -0.002, 0.0)), ey + Vector((0.009, 0.005, -0.008)), ey + Vector((0.0055, 0.022, -0.018)), Vector((0.036, 0.085, -0.39)), + Vector((0.0, 0.14, -0.414)), Vector((-0.036, 0.085, -0.39)), ey + Vector((-0.0055, 0.022, -0.018)), ey + Vector((-0.009, 0.005, -0.008)), + ey + Vector((0.0, -0.002, 0.0))] + Cl = resample(lp, 44, per=5) + P.append(sweep("loop", Cl, rope_sec(0.0062, turns=4.5), [ROPE], ref=(0, 1, 0), ang=50)) + wa, wb = ey + Vector((0, 0.019, -0.016)), ey + Vector((0, 0.034, -0.024)) + wd_ = (wb - wa).normalized() + P.append(lathe("whipcore", [(0.0, -0.0085), (0.0098, -0.008), (0.0128, -0.003), (0.0128, 0.003), (0.0098, 0.008), (0.0, 0.0085)], segs=12, m=ROPE, + frame=fz((wa + wb) / 2, wd_, (1, 0, 0)), smooth_ang=50)) + P.append(rope_coil("whip", [wa - wd_ * 0.01, wb + wd_ * 0.01], 0.01 + (wb - wa).length / 2, lambda ph: 0.0132, 0.0019, 3.2, m=JUTE, segs=12, + ref=(1, 0, 0))) + # the ferrule: rolled brass, a bead round its middle, a rivet through it and the tang (heads both sides) + FY = Matrix.Translation((0, 0, z)) @ Matrix.Rotation(DEG(90), 4, "X") # local +Z -> world -Y + P.append(lathe("ferrule", [(0.0372, 0.289), (0.0402, 0.2898), (0.0418, 0.2925), (0.0412, 0.296), (0.0404, 0.299), (0.0404, 0.3225), + (0.0418, 0.325), (0.0424, 0.3295), (0.0418, 0.334), (0.0404, 0.3365), (0.0404, 0.3595), (0.0416, 0.3625), + (0.0408, 0.3665), (0.0382, 0.3684), (0.0336, 0.369)], segs=22, m=BRASS, frame=FY, smooth_ang=40)) + for sx in (-1, 1): + rivet(P, Vector((sx * 0.0404, -0.31, z)), (sx, 0, 0), 0.0052, m=BRASS) + # the bolster: forged iron where the tang goes in, a chamfered collar, a groove, a washer face against the blade's neck + # one forged piece: an octagon swelling out of the ferrule, its shoulder rounding over into a domed front face round the neck + pb_ = [(-0.3605, 0.0302), (-0.3625, 0.0336), (-0.3655, 0.0355), (-0.3695, 0.0359), (-0.3735, 0.035), (-0.3772, 0.0328), (-0.3805, 0.0296), + (-0.3829, 0.0258), (-0.3845, 0.0214), (-0.3854, 0.0158)] + nb_ = len(pb_) + Xv, Yv, Zv = Vector((1, 0, 0)), Vector((0, 1, 0)), Vector((0, 0, 1)) + bo = sweep("bolster", [Vector((0.0, y, z)) for y, r in pb_], lambda sf, i: oct_sec(pb_[i][1], pb_[i][1], pb_[i][1] * 0.92, pb_[i][1] * 0.5, + pb_[i][1] * 0.16), [DGY, G3], + colfn=lambda i, j: 1 if (j >= 0 and j % 3 == 2 and (j // 3) % 2 == 1) else 0, frm=([-Yv] * nb_, [Xv] * nb_, [Zv] * nb_), ang=36) + hammer_uv(bo, 0, FORGE_RAMP, scale=0.01, seed=5) + P.append(bo) + # ---- the crescent: same outer circle and widths as round 4, a narrow neck from the bolster + c = Vector((0.335, -0.79, 0)) + S, E = [], [] + n = 26 + for i in range(n + 1): + ad = 150 + (378 - 150) * i / n + u = (ad - 142) / 236 + a = DEG(ad) + r_o = 0.455 - 0.05 * u + 0.012 * math.sin(u * math.pi) + w = 0.128 * (1 - u) ** 0.62 * (0.86 + 0.14 * math.sin(min(1.0, u * 2.2) * 1.57)) + 0.005 + S.append((c.x + r_o * math.cos(a), c.y + r_o * math.sin(a))) + E.append((c.x + (r_o - w) * math.cos(a), c.y + (r_o - w) * math.sin(a))) + E[-1] = (S[-1][0] - 0.002, S[-1][1] - 0.006) + s0, e0 = Vector((-0.015, -0.372)), Vector((0.015, -0.372)) + s1, e1 = Vector(S[0]), Vector(E[0]) + neck = [(s0.lerp(s1, k / 4), e0.lerp(e1, (k / 4) ** 1.4)) for k in range(4)] + S = [tuple(a_) for a_, b_ in neck] + S + E = [tuple(b_) for a_, b_ in neck] + E + j = 4 + next(i for i in range(n + 1) if 150 + 228 * i / n >= 178) + L = [0.0] + for q in range(1, j + 1): + L.append(L[-1] + (Vector(S[q]) - Vector(S[q - 1])).length) + for q in range(1, j): + E[q] = tuple(e0.lerp(Vector(E[j]), (L[q] / L[j]) ** 1.15)) + t = 0.03 + P.append(blade5("blade", S, E, z, t, ground=0.36, seed=12, rust={(15, 2)}, P=P, sub=2, nc=6)) + # the forged spine: the back thickened into a rounded rib on both faces, swelling out of the neck and dying away towards the tip + ns = len(S) + rib = [] + for i in range(2, 24): + sp, ed = Vector(S[i]), Vector(E[i]) + rib.append(Vector((*(sp + (ed - sp).normalized() * 0.012), z))) + nr = len(rib) + + def ribsec(sf, i): + u = (i + 2) / (ns - 1) + tt = t * (1.0 - 0.6 * u ** 3) * 0.5 + k = math.sin(min(1.0, sf * 5) * PI / 2) * (1 - sf ** 3) + return [((tt + 0.0055 * k) * math.sin(TAU * q / 14), (0.0035 + 0.0075 * k) * math.cos(TAU * q / 14)) for q in range(14)] + P.append(sweep("rib", rib, ribsec, [DGY, G2], colfn=lambda i, j: 1 if j in (3, 4, 10, 11) else 0, ref=(0, 0, 1), ang=50)) + UM.star_badge(P, Vector((-0.004, -0.455, z + 0.0158)), .052, (0, 0, 1)) + tfin4(P, "Body", uv=2.4, ang=30) + return dict(elev=62, azim=-10, dist_mul=.72) + + +# ----------------------------------------------------------------------- hammer + +def oct_sec(A1, A2, B, ch, fil, n=2): + """An octagon round (a, b): a from -A1 to A2, b from -B to B, corners cut by ch, every corner rounded by fil. 8 (n + 1) points. + Face 3k + 2 (n = 2) is the straight side k: even k a flat, odd k a chamfer.""" + ch = min(ch, (A1 + A2) * 0.45, B * 0.9) + pts = [(A2, -B + ch), (A2, B - ch), (A2 - ch, B), (-A1 + ch, B), (-A1, B - ch), (-A1, -B + ch), (-A1 + ch, -B), (A2 - ch, -B)] + return rounded_outline(pts, fil, n=n) + + +def claw_half(T, Wd, g, ch, cv, fil, sz): + """One prong's section in (a along the claw's inward normal from its back, b across): the back and the side chamfered like the + head's root (so the outline runs on unbroken), the face into the V ground to a bevel at its inner edge. sz: which half.""" + pts = [(0.0, g), (T - cv, g), (T, g + cv), (T, Wd - ch), (T - ch, Wd), (ch, Wd), (0.0, Wd - ch)] + pts = rounded_outline(pts, fil, n=2) + if sz < 0: + pts = [(a, -b) for a, b in reversed(pts)] + return pts + + +def hammer(): + """Round 4's frame: the handle along -Y from the butt at +0.2, the head across it at y = -0.56, the round face on +X, the split claw on + -X curling back towards the handle. The head and the claw's root are one forged solid swept from the face round the claw: chamfered + cheeks (forge scale mottled on the flats, the chamfers worn bright) drawing into a chamfered octagonal neck that waists and swells into + the round poll, a raised band round the poll, a bevelled striking face. The claw curves smoothly (64 stations), rounded with chamfered + edges, split by a V that opens towards two sharp tips flaring a little apart, the V's edges ground and the tips polished. The neck's + chamfers run out on a small shoulder before the poll. Under the head an eye boss grows out of it as a tapered octagonal skirt round + the handle, chamfered at its rim. Through the top of the eye: end grain, a dark walnut wedge along the head, a + steel wedge across it, two round wedges. A hickory handle; a moulded rubber grip with a flared butt, finger swells and ridges, a red + stop band, a leather thong through brass grommets.""" + P = [] + hy = -0.56 + hp = [(0.0, 0.2, 0.0), (0.012, 0.06, 0.0), (0.004, -0.14, 0.0), (0.0, -0.36, 0.0), (0.0, hy - 0.05, 0.0)] + pth = UT.Path(hp, per=5) + HT, HB, HW = 0.058, 0.056, 0.044 # half height up (-Y), down (+Y), half width (Z) + swell = lambda s: math.exp(-((s - 0.18) / 0.22) ** 2) + flare = lambda s: max(0.0, (s - .86) / .14) ** 2 + hrad = lambda s: (0.0305 + 0.007 * swell(s) + 0.012 * flare(s), 0.0215 + 0.005 * swell(s) + 0.0045 * flare(s)) + X_, Y_, Z_ = Vector((1, 0, 0)), Vector((0, 1, 0)), Vector((0, 0, 1)) + # ---- the handle, from under the grip up through the eye: inside the head it narrows to the eye + g1 = 0.34 + sy = [pth.at(g1 - 0.03 + (1 - g1 + 0.03) * k / 46) for k in range(47)] + top = Vector((0.0, hy - HT - 0.0012, 0.0)) + sy = sy + [top] + y_in = hy + HB - 0.004 + + def hsec(sf, i): + p = sy[i] + s = g1 - 0.03 + (1 - g1 + 0.03) * min(1.0, i / 46) + ra, rb = hrad(s) + if p.y < y_in: + f = min(1.0, (y_in - p.y) / 0.012) + ra, rb = ra + (0.0298 - ra) * f, rb + (0.0188 - rb) * f + return circ((ra, rb), 18) + P.append(sweep("handle", sy, hsec, [TIM], uv=(0.875, 0.09, 0.9), ref=(1, 0, 0), ang=34, cap0=False)) + # the end of the handle through the top of the eye: end grain, a walnut wedge along the head, a steel wedge across, two round wedges + ytop = hy - HT + er = [Vector((0.0298 * math.cos(PI / 18 + TAU * k / 18), top.y, 0.0188 * math.sin(PI / 18 + TAU * k / 18))) for k in range(18)] + P.append(endgrain_cap("endgrain", er, top, (0, -1, 0), 0.0012, top + Vector((0.05, 0, 0.03)))) + Fw = fz(top + Vector((0, 0.0014, 0)), (0, -1, 0), (1, 0, 0)) + P.append(bprism("wwedge", rounded_outline([(-0.027, -0.0034), (0.027, -0.0034), (0.027, 0.0034), (-0.027, 0.0034)], 0.0018, 2), 0.0, 0.0034, + ["P_BROWN", "P_BROWN"], bev=0.0012, segs=1, bev_slot=1, frame=Fw)) + P.append(bprism("swedge", rounded_outline([(-0.0034, -0.0172), (0.0034, -0.0172), (0.0034, 0.0172), (-0.0034, 0.0172)], 0.0012, 1), 0.0, 0.0032, + [G4, G5], bev=0.0009, segs=1, bev_slot=1, frame=Fw)) + for x in (-0.017, 0.017): + P.append(lathe("pin", [(0.0, -0.002), (0.0042, -0.002), (0.0046, 0.0004), (0.0036, 0.0022), (0.0, 0.0028)], segs=10, m=G5, + frame=fz(top + Vector((x, 0.0006, 0)), (0, -1, 0)), smooth_ang=50)) + lipr = [Vector((0.0332 * math.cos(TAU * k / 20), ytop - 0.0004, 0.0222 * math.sin(TAU * k / 20))) for k in range(20)] + P.append(UT.tube("eyelip", lipr + lipr[:2], lambda s: (0.0026, 0.0016), G1, segs=6, per=1, cap=False, ang=50)) + # ---- the head and the claw's root: one forged solid, swept from the face end back along -X and round the claw to the V + # stations (x, half height, half width, chamfer, fillet); the cheeks are centred 1 mm above hy, the neck and the poll on hy + Ah, cyh = (HT + HB) / 2, hy + (HB - HT) / 2 + # towards the poll the neck's chamfers run out at 0.172 on a small forged shoulder (0.178), the section rounding over into a + # short round neck below the poll band + hs = [(0.213, 0.0486, 0.0486, 0.0285, 0.02), (0.204, 0.0486, 0.0486, 0.0285, 0.02), (0.193, 0.0478, 0.0478, 0.028, 0.016), + (0.185, 0.0458, 0.0458, 0.027, 0.0145), (0.178, 0.0453, 0.0453, 0.0258, 0.0118), (0.172, 0.0432, 0.0432, 0.0236, 0.0048), + (0.166, 0.0418, 0.0418, 0.0228, 0.0042), (0.148, 0.0378, 0.0378, 0.0205, 0.0035), + (0.13, 0.0342, 0.0342, 0.0185, 0.003), (0.113, 0.0318, 0.0318, 0.0172, 0.003), (0.098, 0.0322, 0.0322, 0.0174, 0.003), + (0.086, 0.0352, 0.0345, 0.0172, 0.003), (0.076, 0.0405, 0.0375, 0.017, 0.0032), (0.067, 0.0468, 0.0405, 0.0158, 0.0034), + (0.059, 0.0526, 0.0428, 0.0135, 0.0035), (0.052, 0.0558, 0.0437, 0.0118, 0.0035), (0.046, Ah, HW, 0.011, 0.0035), + (0.03, Ah, HW, 0.011, 0.0035), (0.0, Ah, HW, 0.011, 0.0035)] + rings, kinds = [], [] + for x, A, B, ch, fil in hs: + f = min(1.0, max(0.0, (0.076 - x) / 0.03)) + c = Vector((x, hy + (cyh - hy) * f, 0.0)) + rings.append([c + Y_ * a + Z_ * b for a, b in oct_sec(A, A, B, ch, fil)]) + kinds.append("head") + # the claw: an outer curve continuing the top line, 64 stations; thickness inward and half width fall away towards the tips + O = resample([(-0.03, hy - HT, 0), (-0.05, hy - HT, 0), (-0.12, hy - 0.053, 0), (-0.185, hy - 0.032, 0), (-0.238, hy + 0.008, 0), + (-0.276, hy + 0.066, 0), (-0.296, hy + 0.128, 0)], 64, per=8) + m_ = len(O) - 1 + TN = [] + for i in range(len(O)): + T = (O[min(i + 1, m_)] - O[max(i - 1, 0)]).normalized() + TN.append(Vector((T.y, -T.x, 0))) + th = lambda t: 0.1105 * (1 - t) ** 1.2 + 0.0035 + Wf = lambda t: HW - 0.011 * t + tv = 0.36 + iv = int(round(tv * m_)) + for i in range(1, iv + 1): + t = i / m_ + T_ = th(t) + c = O[i] + TN[i] * (T_ / 2) + rings.append([c + TN[i] * a + Z_ * b for a, b in oct_sec(T_ / 2, T_ / 2, Wf(t), min(0.011, T_ * 0.2), 0.0035)]) + kinds.append("root") + nh = len(rings) + + i_run = next(k for k, h in enumerate(hs) if h[0] <= 0.1725) + + def hcol(i, j): + if j < 0 or i < i_run: # the poll and its neck: no chamfer stripe past the shoulder + return 0 + if j % 3 == 2 and (j // 3) % 2 == 1: # the chamfers, worn bright + return 1 + return 0 + head = rings_mesh("head", rings, [DGY, G3], colfn=hcol, ang=34) + hammer_uv(head, 0, FORGE_RAMP, scale=0.014, seed=17) + P.append(head) + FX = M_axis("X", (0, hy, 0)) + # the striking face: a wide bevel worn bright, the face polished, a little crowned + P.append(lathe("face", [(0.0486, 0.2128), (0.0486, 0.2142), (0.0476, 0.2186), (0.0452, 0.2232), (0.0418, 0.2276), (0.0398, 0.2298), + (0.0392, 0.2306)], segs=24, m=G4, frame=FX, smooth_ang=30)) + P.append(lathe("facec", [(0.0394, 0.2304), (0.03, 0.2314), (0.016, 0.232), (0.0, 0.2322)], segs=24, m=G5, frame=FX, smooth_ang=30)) + # a forged band round the poll, standing proud, a groove turned in its middle + P.append(lathe("pollband", [(0.0478, 0.1952), (0.0499, 0.1962), (0.0506, 0.1978), (0.05, 0.1992), (0.0493, 0.2), (0.05, 0.2008), + (0.0506, 0.2022), (0.0499, 0.2038), (0.0478, 0.2048)], segs=24, m=G4, frame=FX, smooth_ang=40)) + # ---- the prongs: from the V's root to the tips, the V opening, the tips narrowing and flaring a little apart + gap = lambda t: 0.0032 + 0.017 * max(0.0, (t - tv) / (1 - tv)) ** 0.85 + for sz in (1, -1): + R = [] + for i in range(iv, m_ + 1): + t = i / m_ + T_, g = th(t), gap(t) / 2 + narrow = 1 - 0.55 * max(0.0, (t - 0.78) / 0.22) ** 1.6 + Wd = g + (Wf(t) - g) * narrow + fl = 0.006 * max(0.0, (t - 0.7) / 0.3) ** 2 + ch = min(0.011, T_ * 0.2, (Wd - g) * 0.3) + cv = min(0.0055, T_ * 0.35, (Wd - g) * 0.3) + fil = min(0.0035, T_ * 0.15, (Wd - g) * 0.12) + sec = claw_half(T_, Wd + fl, g + fl, ch, cv, fil, sz) + R.append([O[i] + TN[i] * a + Z_ * b for a, b in sec]) + nseg = len(R[0]) + bright = int((m_ - iv) * 0.7) + + def cf(i, j, sz=sz, bright=bright, nseg=nseg): + if j < 0: + return 2 + jo = j if sz > 0 else (nseg - 2 - j) % nseg # the face's index on the +Z half's section + if jo in (2, 3, 4, 5): # the V and its ground bevel + return 2 if i >= bright else 1 + if jo in (6, 7, 8): # the concave side, polished towards the tips + return 2 if i >= bright else 0 + return 1 if jo in (11, 17) else 0 + pr = rings_mesh("prong", R, [DGY, G3, G5], colfn=cf, ang=34) + hammer_uv(pr, 0, FORGE_RAMP, scale=0.014, seed=17) + P.append(pr) + for sz in (-1, 1): + UM.star_badge(P, Vector((-0.004, hy, sz * (HW + 0.0005))), .064, (0, 0, sz)) + # ---- the eye boss: grown out of the head's underside, filleted into it on every side (its walls leave the flat just inside the + # cheeks' chamfers, so nothing steps out), an octagonal skirt tapering a little round the handle with an even wall, 18 mm long, + # a small chamfer round its bottom rim, a narrow end face closing onto the wood + # Its sides carry the cheeks' faces straight on down (covering the head's lower chamfers there), its ends grow out of the + # underside and the claw's root, then the whole skirt draws in a little to a chamfered rim and a coned end face onto the wood. + yb = hy + HB + L_b = 0.0172 # the skirt below the head + dys = [-0.0135, -0.0112, 0.0, 0.004, 0.0085, 0.013, L_b, L_b + 0.0017, L_b + 0.0025, L_b + 0.003, L_b + 0.0034] + na = len(dys) + i_rim = 7 + Ca = [Vector((0.0, yb + d, 0.0)) for d in dys] + A0, B0, A1, B1 = 0.0495, HW - 0.0002, 0.0445, 0.0375 + + def boss_oct(d, inset=0.0): + t = min(1.0, max(0.0, d / L_b)) ** 1.25 + A, B = A0 + (A1 - A0) * t - inset, B0 + (B1 - B0) * t - inset + return oct_sec(A, A, B, min(A, B) * 0.3, 0.0028) + + def asec(sf, i): + d = dys[i] + if i <= i_rim: + return boss_oct(d, 0.0018 if i == i_rim else 0.0) + ra, rb = hrad(pth.nearest_y(yb + L_b)) + e = (0.0062, 0.0012, -0.0006)[i - i_rim - 1] # the coned end face, then tucked into the wood + out = [] + for a, b in boss_oct(L_b, 0.0018): + t = 1.0 / math.sqrt((a / (ra + e)) ** 2 + (b / (rb + e)) ** 2) + out.append((a * t, b * t)) + return out + + def acol(i, j): + if j < 0: + return 0 + if i == i_rim - 1: # the rim chamfer, worn bright + return 1 + return 1 if (i < i_rim - 1 and j % 3 == 2 and (j // 3) % 2 == 1) else 0 + ad = sweep("eyeboss", Ca, asec, [DGY, G3], colfn=acol, ang=34, frm=([Y_] * na, [X_] * na, [Z_] * na), cap0=False, cap1=False) + hammer_uv(ad, 0, FORGE_RAMP, scale=0.014, seed=17) + P.append(ad) + # ---- the grip: moulded rubber, a flared butt, four finger swells, fine ridges between them, a lip and a red stop band + gp = [pth.at(g1 * k / 8) for k in range(9)] + gp[0] = gp[0] + (gp[0] - gp[1]).normalized() * 0.012 + gC = resample(gp, 110, per=5) + + def gr(s): + k = (1.0 + 0.22 * max(0.0, 1 - s / 0.11) ** 2 + 0.05 * max(0.0, math.sin((s - 0.2) / 0.62 * 4 * PI)) * (0.2 < s < 0.82) + + 0.06 * max(0.0, (s - 0.93) / 0.07)) + if 0.13 < s < 0.9: + k += 0.026 * max(0.0, math.cos((s - 0.13) / 0.77 * 26 * PI)) ** 6 # moulded ridges + return k + P.append(sweep("grip", gC, lambda sf, i: circ((0.0405 * gr(sf), 0.0295 * gr(sf)), 20), [RUB], ref=(1, 0, 0), ang=40)) + c0, d0 = gC[0], (gC[0] - gC[2]).normalized() + P.append(lathe("buttend", [(0.0, 0.0034), (0.022, 0.0028), (0.034, 0.0006), (0.0405, -0.003), (0.0, -0.003)], segs=20, m=RUB, + frame=fz(c0, d0, (1, 0, 0)) @ Matrix(((1.2, 0, 0, 0), (0, 0.87, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1))), smooth_ang=40)) + a, b = pth.at(g1 + 0.002), pth.at(g1 + 0.02) + P.append(sweep("gband", [a.lerp(b, k / 5) for k in range(6)], lambda sf, i: circ((0.0412 - 0.004 * sf + 0.0008 * bump(sf, 0.5, 0.5), + 0.0302 - 0.003 * sf + 0.0008 * bump(sf, 0.5, 0.5)), 20), + [PRED], ref=(1, 0, 0), ang=40)) + gy = gC[4] + for sx in (-1, 1): + rr = 0.0405 * gr(4 / 110) * 0.99 + P.append(lathe("grommet", [(0.0042, -0.0025), (0.0068, -0.0022), (0.0076, 0.0), (0.0068, 0.0022), (0.0042, 0.0025)], segs=12, m=BRASS, + frame=fz(gy + Vector((sx * rr, 0, 0)), (sx, 0, 0)), smooth_ang=50)) + th_ = [gy + Vector((0.034, 0.0, 0)), gy + Vector((0.052, 0.028, 0)), Vector((0.04, 0.29, 0)), Vector((0.0, 0.306, 0)), Vector((-0.036, 0.28, 0)), + gy + Vector((-0.05, 0.03, 0)), gy + Vector((-0.034, 0.0, 0))] + P.append(UT.tube("thong", resample(th_, 30, per=5), lambda s: (0.0068, 0.0026), LEAT, segs=8, per=1, ang=40, cap=False)) + tfin4(P, "Body", uv=4.0, ang=30) + return dict(elev=64, azim=-14, dist_mul=.72) + + +# ----------------------------------------------------------------------- long scythe + +def long_scythe(): + """Round 4's frame: the longer barn-red snath on the same line, nibs at the same grips, the blade on the same outline, the grain + cradle in the same place. The snath painted barn red with cream bands, worn through to the timber where the hands and the ground rub; + a brass butt cap; turned nibs with yellow knobs held by brass straps; the blade with the real section, a folded back, a forged shoe + with a driven wedge, jaw plates; the paint worn away in soft patches; the cradle: a turned post in an iron socket strapped to the snath, three bent ash fingers mortised + into it with iron ferrules, an iron stay bolted to the blade's back and lashed to each finger with twine, an iron bow from the post.""" + P = [] + nibs = ((0.03, -0.04), (-0.03, -0.64)) + pts = [(0.02, 0.15, 0.108), (0.02, 0.07, 0.125), (0.0, -0.2, 0.12), (-0.022, -0.6, 0.12), (-0.012, -1.02, 0.09), (0.008, -1.34, 0.01), (0.0, -1.5, -0.055)] + pth = UT.Path(pts, per=6) + Lt = pth.L[-1] + rxf = lambda s: 0.0295 - 0.0065 * min(1.0, s) + rzf = lambda s: 0.0325 - 0.0075 * min(1.0, s) + # ---- the snath, run on into the shoe. Paint worn through on the top where the hands go and all round the butt + ext = pts + [(-0.002, -1.54, -0.066)] + pe = UT.Path(ext, per=6) + kx = Lt / pe.L[-1] + # stations: every 3 cm, every 7 mm through the worn zones (the butt, the fore grip, under the heel) + ss = [q / 30 for q in range(31)] + for a_, b_ in ((0.0, 0.1), (0.33, 0.47), (0.93, 1.0)): + ss += [(a_ + (b_ - a_) * q / 13) * kx for q in range(14)] + ss = sorted(set(round(min(1.0, q), 5) for q in ss)) + C = [pe.at(q) for q in ss] + Le = arclen(C) + sf_of = lambda i: min(1.0, Le[i] / Lt) + worn = {} + + def wearw(s, up): + """How worn the paint is here: all round the butt, on top where the fore hand slides, underneath at the heel.""" + w = 1.0 if s < 0.045 else max(0.0, 1 - (s - 0.045) / 0.05) + w = max(w, bump(s, 0.395, 0.06) * max(0.0, up) ** 0.6) + w = max(w, max(0.0, (s - 0.95) / 0.05) * max(0.0, -up) ** 0.6) + return w + for i in range(len(C) - 1): + s = (sf_of(i) + sf_of(i + 1)) / 2 + for j in range(16): + ang = PI / 16 + TAU * (j + 0.5) / 16 + up = math.sin(ang) # B is roughly up + w = wearw(s, up) + if w <= 0: + continue + cpt = (C[i] + C[i + 1]) / 2 + Vector((rxf(s) * math.cos(ang), 0, rzf(s) * math.sin(ang))) + n_ = hammer_field(cpt, 0.028, 21) * 0.5 + 0.5 + if n_ < w * 0.78: + worn[(i, j)] = 1 + P.append(sweep("snath", C, lambda sf, i: circ((rxf(sf_of(i)), rzf(sf_of(i))), 16), [PRED, TIM], colfn=lambda i, j: worn.get((i, j), 0), + ref=(1, 0, 0), uv=(0.125, 0.09, 0.9), ang=34)) + # cream bands, painted a hair proud + for t0 in (0.33, 0.37, 0.72, 0.76): + cs = [pth.at(t0 + 0.011 * k) for k in range(2)] + P.append(sweep("stripe", cs, lambda sf, i, t0=t0: circ((rxf(t0) + 0.0007, rzf(t0) + 0.0007), 18), [CRM], ref=(1, 0, 0), cap0=False, cap1=False, ang=40)) + # the brass butt cap: a rim, a dome, a rivet + c0, d0 = pth.at(0.0), (pth.at(0.0) - pth.at(0.02)).normalized() + Fb = fz(c0, d0, (1, 0, 0)) + P.append(lathe("buttcap", [(0.031, -0.014), (0.0338, -0.0128), (0.0352, -0.0098), (0.0352, -0.0062), (0.0336, -0.004), (0.0338, -0.0015), + (0.031, 0.003), (0.024, 0.0072), (0.013, 0.0094), (0.0, 0.0098)], segs=18, m=BRASS, frame=Fb, smooth_ang=40)) + head(P, c0 + d0 * 0.0092, d0, 0.0048, "dome", m=G4) + # ---- nibs and their brass straps + for x, y in nibs: + nib5(P, x, y, 0.125, m_knob=GOLD, r=0.036, wrap=LEAT) + t = pth.nearest_y(y) + ring_clamp5(P, pth, t, max(rxf(t), rzf(t)) + 0.0006, boltside=1 if y > -0.3 else -1, m=BRASS, bolt_m=G4) + # ---- the blade + hz, y0 = -0.098, -1.52 + F = tilt_frame(y0, hz) + S, E = scythe_outline(y0, 1.1, 0.17, 0.15, 0.27, 44, neck=(0.046, 0.022, 0.15)) + S36, E36 = scythe_outline(y0, 1.1, 0.17, 0.15, 0.27, 36, neck=(0.046, 0.022, 0.15)) + S20, _ = scythe_outline(y0, 1.1, 0.17, 0.15, 0.27, 20) + tw = (UT.TILT, 0.05) + P.append(blade5("blade", S, E, hz, 0.024, frame=F, ground=0.3, seed=7, rust={(26, 2)}, P=P, twist=tw, sub=1, nc=4)) + back_channel(P, S36, E36, hz, 0.024, F, 0, 28, wf=0.02, th=0.0045, m=G2, rivets=(4, 12, 20), r_riv=0.0062, nose=0.008, taper=0.55, twist=tw) + # ---- the mount + rxe, rze = rxf(1.0), rzf(1.0) + shoe(P, -0.036, 0.05, -1.57, -1.49, hz - 0.012, -0.032, 0.007, bolts=[(0.007, -1.53)], wedge=(-1.555, -1.512, 0.018), + entry=(pth, lambda d, k: [(a, b * k) for a, b in circ((rxe + d, rze + d), 18)]), blade_z=hz) + bolt5(P, (-0.036, -1.53, -0.076), (-1, 0, 0), 0.086, 0.0072, m=G4, ref=(0, 0, 1), thr=0.0) + jaws(P, S, E, hz, 0.024, F, 0.045, 0.13, 0.6, th=0.0045, rivets=2) + # ---- the grain cradle + tc = pth.nearest_y(-1.22) + base = pth.at(tc) + topp = Vector((0.05, -1.26, 0.27)) + rc = max(rxf(tc), rzf(tc)) + 0.0006 + ring_clamp5(P, pth, tc, rc, boltside=-1, w=0.034, m=IRON, bolt_m=G4) + # the socket: an iron cup welded on the strap, the post standing in it, a bolt across + dpost = (topp - base).normalized() + sb = base + Vector((0, 0, rc - 0.004)) + P.append(lathe("socket", [(0.0, -0.002), (0.0262, -0.002), (0.0282, 0.004), (0.0282, 0.03), (0.0296, 0.0325), (0.0296, 0.037), (0.0268, 0.039), + (0.0, 0.039)], segs=18, m=IRON, frame=fz(sb, dpost, (1, 0, 0)), smooth_ang=40)) + bead(P, [sb + Vector((-0.024, 0.006, 0.002)), sb + Vector((0.0, 0.009, 0.003)), sb + Vector((0.024, 0.006, 0.002))], 0.0026, m=G3) + bolt5(P, sb + dpost * 0.02 + Vector((0.0296, 0, 0)), (1, 0, 0), 0.0592, 0.0048, m=G4, ref=(0, 0, 1), thr=0.005) + # the post: turned, a bead under its head, an iron cap + Cp = [sb.lerp(topp, q) for q in feature_ss(5, [(0.86, 0.035), (0.9, 0.02)])] + + def prf(s): + return 0.0235 - 0.004 * s + 0.0022 * bump(s, 0.86, 0.035) - 0.0012 * bump(s, 0.9, 0.02) + P.append(turned("post", Cp, prf, segs=14, s=1.6, u0=0.375, ref=(1, 0, 0))) + P.append(lathe("postcap", [(0.0182, -0.012), (0.0212, -0.0108), (0.0222, -0.008), (0.0222, -0.001), (0.0205, 0.0022), (0.016, 0.0048), + (0.008, 0.0062), (0.0, 0.0065)], segs=16, m=IRON, frame=fz(topp, dpost, (1, 0, 0)), smooth_ang=40)) + # the fingers: round 4's lines, bent ash, tapering, a rounded tip; an iron ferrule where each goes into the post + ns_ = len(S20) - 1 + fingers = [] + for k, (lift, frac) in enumerate(((0.3, 0.84), (0.205, 0.92), (0.105, 0.98))): + Fp = [] + for i in range(6): + u = i / 5 + q = S20[int(round(u * (ns_ - 2) * frac))] + Fp.append(F @ Vector((0.03 + q[0] * 0.98, q[1] + 0.03, hz + lift + (0.03 - 0.02 * k) * math.sin(u * 1.6)))) + root = base.lerp(topp, (1.0, 0.68, 0.36)[k]) + Fp = [root] + Fp[2:] + Cf = resample(Fp, 16, per=5) + P.append(turned("finger", Cf, lambda s: (0.0155 - 0.008 * s) * (1 - 0.6 * max(0.0, (s - 0.95) / 0.05) ** 2) + 0.0006, segs=10, s=1.4, u0=0.375, + ref=(0, 0, 1))) + df = (Cf[2] - Cf[0]).normalized() + P.append(lathe("fferrule", [(0.0, -0.002), (0.0168, -0.002), (0.0178, 0.0005), (0.0178, 0.0098), (0.0166, 0.012), (0.0, 0.012)], segs=10, m=IRON, + frame=fz(Cf[0] + df * 0.018, df), smooth_ang=40)) + fingers.append((Fp, Cf)) + # the stay: a forged flat bar through each finger's lashing, down to a lug riveted on the blade's back + pS = F @ Vector((S20[10][0], S20[10][1] + 0.01, hz + 0.024)) + stay = [fingers[0][0][3], fingers[1][0][3], fingers[2][0][3], pS] + Cs = resample(stay, 16, per=5) + P.append(sweep("stay", Cs, lambda sf, i: rrect(0.0068, 0.0034, 0.0022, 2), [IRON, G2], colfn=lambda i, j: 1 if j % 3 == 1 else 0, ref=(0, 0, 1), ang=40)) + for k in range(3): + Fp, Cf = fingers[k] + Lf = arclen(Cf) + j = min(range(len(Cf)), key=lambda q: (Cf[q] - Fp[3]).length) + rr = (0.0155 - 0.008 * Lf[j] / Lf[-1]) + 0.0006 + P.append(rope_coil("lash", Cf, Lf[j], lambda ph, rr=rr: rr + 0.0024, 0.0024, 2.5, m=TWINE, segs=7, ref=(0, 0, 1))) + up = (F.to_3x3() @ Vector((0, 0, 1))).normalized() + nS = (Cs[-1] - Cs[-3]).normalized().cross(up).normalized() + Fe = Matrix(((Cs[-1] - Cs[-3]).normalized(), nS.cross((Cs[-1] - Cs[-3]).normalized()), nS)).transposed().to_4x4() + Fe.translation = pS + P.append(bprism("stayeye", circ(0.0092, 14), -0.0034, 0.0034, [IRON, G2], bev=0.0012, segs=1, frame=Fe, bev_slot=1)) + hp_, Lb = clevis(P, pS, up, nS, 0.022, 0.0035, 0.024 - (0.012 + 0.0045) + 0.003, 0.0095, 0.0075, bead_at=0.024 - (0.012 + 0.0045)) + bolt5(P, hp_, nS, Lb, 0.0036, m=G4, ref=up, thr=0.004) + # the bow: an iron rod from the post's head round to the top finger, forged eyes, a bolt through the post + f0 = fingers[0][0] + bw = [topp + dpost * -0.03, f0[2], f0[3]] + Cb = resample(bw, 20, per=5) + P.append(UT.tube("cbow", Cb, lambda s: 0.0064, IRON, segs=8, per=1, ang=40)) + rope_c = fingers[0][1] + P.append(rope_coil("lash", rope_c, arclen(rope_c)[min(range(len(rope_c)), key=lambda q: (rope_c[q] - f0[2]).length)], + lambda ph: 0.0155 * 0.85 + 0.0036, 0.0022, 2.0, m=TWINE, segs=10, ref=(0, 0, 1))) + tfin4(P, "Body", uv=2.4, ang=30) + return dict(elev=38, azim=-30, dist_mul=.7) + + +# ======================================================================= main + +BUILDERS = {"SM_Tool_WideScythe": _lod(wide_scythe), "SM_Tool_Scythe": _lod(scythe), "SM_Tool_GardenShears": garden_shears, + "SM_Tool_NailScissors": nail_scissors, "SM_Tool_Shears": garden_shears, "SM_Tool_Sickle": sickle, "SM_Tool_Hammer": hammer, + "SM_Tool_LongScythe": _lod(long_scythe)} +BUDGET = {n: 20000 for n in BUILDERS} + + +def main(): + common.MODELS = os.path.join(OUT, "fbx") + common.BLENDS = OUT + common.PREVIEWS = os.path.join(OUT, "previews") + KIT.SHOTS = os.path.join(OUT, "previews") + for d in (common.MODELS, common.PREVIEWS): + os.makedirs(d, exist_ok=True) + if "--" in sys.argv and "--quick" not in sys.argv: + sys.argv.append("--quick") # the review renders are gc_up5_check.py's job + elif "--" not in sys.argv: + sys.argv += ["--", "--quick"] + KIT.build_main(BUILDERS, BUDGET) + + +if __name__ == "__main__": + main()