diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2501f61 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +XSBoner/Generated \ No newline at end of file diff --git a/XSBoner/Bone Stuff/Bone Models/Blender Bone Stick.obj b/XSBoner/Bone Stuff/Bone Models/Blender Bone Stick.obj new file mode 100644 index 0000000..eea4b98 --- /dev/null +++ b/XSBoner/Bone Stuff/Bone Models/Blender Bone Stick.obj @@ -0,0 +1,116 @@ +# Blender v2.79 (sub 0) OBJ File: '' +# www.blender.org +mtllib BlenderBoneStick.mtl +o Sphere.001 +v 0.000000 2.028086 -0.029990 +v 0.000000 1.998096 -0.042412 +v 0.000000 1.968106 -0.029990 +v 0.000000 1.955684 0.000000 +v 0.028522 2.028086 -0.009267 +v 0.040336 1.998096 -0.013106 +v 0.028522 1.968106 -0.009267 +v 0.017628 2.028086 0.024262 +v 0.024929 1.998096 0.034312 +v 0.017628 1.968106 0.024262 +v -0.000000 2.040508 0.000000 +v -0.017628 2.028086 0.024262 +v -0.024929 1.998096 0.034312 +v -0.017628 1.968106 0.024262 +v -0.028522 2.028086 -0.009267 +v -0.040336 1.998096 -0.013106 +v -0.028522 1.968106 -0.009267 +v 0.000000 0.029990 -0.029990 +v 0.000000 -0.000000 -0.042412 +v 0.000000 -0.029990 -0.029990 +v 0.000000 -0.042412 0.000000 +v 0.028522 0.029990 -0.009267 +v 0.040336 -0.000000 -0.013106 +v 0.028522 -0.029990 -0.009267 +v 0.017628 0.029990 0.024262 +v 0.024929 -0.000000 0.034312 +v 0.017628 -0.029990 0.024262 +v -0.000000 0.042412 0.000000 +v -0.017628 0.029990 0.024262 +v -0.024929 -0.000000 0.034312 +v -0.017628 -0.029990 0.024262 +v -0.028522 0.029990 -0.009267 +v -0.040336 -0.000000 -0.013106 +v -0.028522 -0.029990 -0.009267 +v -0.000000 0.002673 -0.010542 +v -0.000000 1.994065 -0.010542 +v 0.009129 0.002673 0.005271 +v 0.009129 1.994065 0.005271 +v -0.009129 0.002673 0.005271 +v -0.009129 1.994065 0.005271 +vn 0.2679 -0.8901 -0.3687 +vn 0.5573 0.3177 -0.7671 +vn 0.5573 -0.3177 -0.7671 +vn 0.2679 0.8901 -0.3687 +vn 0.9018 -0.3177 0.2930 +vn 0.4334 0.8901 0.1408 +vn 0.4334 -0.8901 0.1408 +vn 0.9018 0.3177 0.2930 +vn -0.0000 0.3177 0.9482 +vn -0.0000 -0.3177 0.9482 +vn 0.0000 0.8901 0.4557 +vn -0.0000 -0.8901 0.4557 +vn -0.4334 -0.8901 0.1408 +vn -0.9018 0.3177 0.2930 +vn -0.9018 -0.3177 0.2930 +vn -0.4334 0.8901 0.1408 +vn -0.2679 -0.8901 -0.3687 +vn -0.5573 0.3177 -0.7671 +vn -0.5573 -0.3177 -0.7671 +vn -0.2679 0.8901 -0.3687 +vn 0.8660 0.0000 -0.5000 +vn -0.0000 0.0000 1.0000 +vn 0.0000 1.0000 0.0000 +vn -0.8660 0.0000 -0.5000 +vn 0.0000 -1.0000 0.0000 +usemtl None +s off +f 4//1 3//1 7//1 +f 2//2 1//2 5//2 6//2 +f 3//3 2//3 6//3 7//3 +f 1//4 11//4 5//4 +f 7//5 6//5 9//5 10//5 +f 5//6 11//6 8//6 +f 4//7 7//7 10//7 +f 6//8 5//8 8//8 9//8 +f 9//9 8//9 12//9 13//9 +f 10//10 9//10 13//10 14//10 +f 8//11 11//11 12//11 +f 4//12 10//12 14//12 +f 4//13 14//13 17//13 +f 13//14 12//14 15//14 16//14 +f 14//15 13//15 16//15 17//15 +f 12//16 11//16 15//16 +f 4//17 17//17 3//17 +f 16//18 15//18 1//18 2//18 +f 17//19 16//19 2//19 3//19 +f 15//20 11//20 1//20 +f 21//1 20//1 24//1 +f 19//2 18//2 22//2 23//2 +f 20//3 19//3 23//3 24//3 +f 18//4 28//4 22//4 +f 24//5 23//5 26//5 27//5 +f 22//6 28//6 25//6 +f 21//7 24//7 27//7 +f 23//8 22//8 25//8 26//8 +f 26//9 25//9 29//9 30//9 +f 27//10 26//10 30//10 31//10 +f 25//11 28//11 29//11 +f 21//12 27//12 31//12 +f 21//13 31//13 34//13 +f 30//14 29//14 32//14 33//14 +f 31//15 30//15 33//15 34//15 +f 29//16 28//16 32//16 +f 21//17 34//17 20//17 +f 33//18 32//18 18//18 19//18 +f 34//19 33//19 19//19 20//19 +f 32//20 28//20 18//20 +f 35//21 36//21 38//21 37//21 +f 37//22 38//22 40//22 39//22 +f 38//23 36//23 40//23 +f 39//24 40//24 36//24 35//24 +f 35//25 37//25 39//25 diff --git a/XSBoner/Bone Stuff/Bone Models/Blender Bone Stick.obj.meta b/XSBoner/Bone Stuff/Bone Models/Blender Bone Stick.obj.meta new file mode 100644 index 0000000..23985f0 --- /dev/null +++ b/XSBoner/Bone Stuff/Bone Models/Blender Bone Stick.obj.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 574754a47b2f7924ba9d122ffbd3e702 +timeCreated: 1538178661 +licenseType: Free +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: //RootNode + 100002: default + 400000: //RootNode + 400002: default + 2300000: default + 3300000: default + 4300000: default + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + serializedVersion: 2 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Bone Models/Blender Bone.obj b/XSBoner/Bone Stuff/Bone Models/Blender Bone.obj new file mode 100644 index 0000000..d8e00c2 --- /dev/null +++ b/XSBoner/Bone Stuff/Bone Models/Blender Bone.obj @@ -0,0 +1,74 @@ +# Blender v2.79 (sub 0) OBJ File: '' +# www.blender.org +mtllib BlenderBone.mtl +o Cube +v 0.000000 0.000000 0.000000 +v 0.000000 2.000000 0.000000 +v -0.189297 0.225751 0.189297 +v -0.189297 0.225751 -0.189297 +v 0.189297 0.225751 -0.189297 +v 0.189297 0.225751 0.189297 +v 0.000000 -0.108594 -0.108594 +v 0.000000 -0.153576 0.000000 +v 0.108594 0.108594 0.000000 +v 0.153576 0.000000 0.000000 +v 0.108594 -0.108594 0.000000 +v 0.000000 0.108594 0.108595 +v -0.000000 0.000000 0.153576 +v 0.000000 -0.108594 0.108595 +v -0.000000 0.153576 0.000000 +v -0.108594 0.108594 0.000000 +v -0.153576 0.000000 0.000000 +v -0.108594 -0.108594 0.000000 +v 0.000000 0.108594 -0.108594 +v 0.000000 0.000000 -0.153576 +vn -0.9944 0.1061 0.0000 +vn 0.0000 0.1061 -0.9944 +vn 0.9944 0.1061 0.0000 +vn 0.0000 0.1061 0.9944 +vn 0.0000 -0.6425 0.7663 +vn 0.7663 -0.6425 0.0000 +vn 0.0000 -0.6425 -0.7663 +vn -0.7663 -0.6425 0.0000 +vn 0.6786 -0.2811 -0.6786 +vn 0.3574 0.8629 -0.3574 +vn 0.3574 -0.8629 -0.3574 +vn 0.6786 0.2811 -0.6786 +vn 0.3574 -0.8629 0.3574 +vn 0.6786 0.2811 0.6786 +vn 0.6786 -0.2811 0.6786 +vn 0.3574 0.8629 0.3574 +vn -0.3574 0.8629 0.3574 +vn -0.3574 -0.8629 0.3574 +vn -0.6786 0.2811 0.6786 +vn -0.6786 -0.2811 0.6786 +vn -0.6786 -0.2811 -0.6786 +vn -0.3574 0.8629 -0.3574 +vn -0.3574 -0.8629 -0.3574 +vn -0.6786 0.2811 -0.6786 +usemtl None +s off +f 3//1 2//1 4//1 +f 4//2 2//2 5//2 +f 5//3 2//3 6//3 +f 6//4 2//4 3//4 +f 1//5 6//5 3//5 +f 1//6 5//6 6//6 +f 1//7 4//7 5//7 +f 1//8 3//8 4//8 +f 7//9 20//9 10//9 11//9 +f 19//10 15//10 9//10 +f 8//11 7//11 11//11 +f 20//12 19//12 9//12 10//12 +f 8//13 11//13 14//13 +f 10//14 9//14 12//14 13//14 +f 11//15 10//15 13//15 14//15 +f 9//16 15//16 12//16 +f 12//17 15//17 16//17 +f 8//18 14//18 18//18 +f 13//19 12//19 16//19 17//19 +f 14//20 13//20 17//20 18//20 +f 18//21 17//21 20//21 7//21 +f 16//22 15//22 19//22 +f 8//23 18//23 7//23 +f 17//24 16//24 19//24 20//24 diff --git a/XSBoner/Bone Stuff/Bone Models/Blender Bone.obj.meta b/XSBoner/Bone Stuff/Bone Models/Blender Bone.obj.meta new file mode 100644 index 0000000..8489162 --- /dev/null +++ b/XSBoner/Bone Stuff/Bone Models/Blender Bone.obj.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 31e2c5aa36c9dca449b2fdd0f0828e48 +timeCreated: 1538178412 +licenseType: Free +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: //RootNode + 100002: default + 400000: //RootNode + 400002: default + 2300000: default + 3300000: default + 4300000: default + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + serializedVersion: 2 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Bone Models/Spooky Bones.obj b/XSBoner/Bone Stuff/Bone Models/Spooky Bones.obj new file mode 100644 index 0000000..1a86ddf --- /dev/null +++ b/XSBoner/Bone Stuff/Bone Models/Spooky Bones.obj @@ -0,0 +1,162 @@ +# Blender v2.79 (sub 0) OBJ File: '' +# www.blender.org +mtllib SpookyBones.mtl +o Cube +v -0.034175 1.991182 0.102433 +v -0.034175 1.991182 -0.102433 +v 0.034175 1.991182 0.102433 +v 0.034175 1.991182 -0.102433 +v -0.102433 1.706871 0.102433 +v -0.102433 1.706871 -0.102433 +v 0.102433 1.706871 -0.102433 +v 0.102433 1.706871 0.102433 +v -0.195819 1.844881 0.069931 +v -0.096657 2.042452 0.102433 +v -0.096657 2.042452 -0.102433 +v 0.096657 2.042452 -0.102433 +v 0.096657 2.042452 0.102433 +v -0.195819 1.844881 -0.069931 +v 0.195819 1.844881 -0.069931 +v 0.195819 1.844881 0.069931 +v -0.068304 1.876953 0.153340 +v -0.068304 1.876953 -0.153340 +v 0.068304 1.876953 -0.153340 +v 0.068304 1.876953 0.153340 +v -0.205332 1.961081 0.102433 +v -0.205332 1.961081 -0.102433 +v 0.205332 1.961081 -0.102433 +v 0.205332 1.961081 0.102433 +v -0.034175 0.008818 0.102433 +v -0.034175 0.008818 -0.102433 +v 0.034175 0.008818 0.102433 +v 0.034175 0.008818 -0.102433 +v -0.102433 0.293129 0.102433 +v -0.102433 0.293129 -0.102433 +v 0.102433 0.293129 -0.102433 +v 0.102433 0.293129 0.102433 +v -0.195819 0.155119 0.069931 +v -0.096657 -0.042452 0.102433 +v -0.096657 -0.042452 -0.102433 +v 0.096657 -0.042452 -0.102433 +v 0.096657 -0.042452 0.102433 +v -0.195819 0.155119 -0.069931 +v 0.195819 0.155119 -0.069931 +v 0.195819 0.155119 0.069931 +v -0.068304 0.123047 0.153340 +v -0.068304 0.123047 -0.153340 +v 0.068304 0.123047 -0.153340 +v 0.068304 0.123047 0.153340 +v -0.205332 0.038919 0.102433 +v -0.205332 0.038919 -0.102433 +v 0.205332 0.038919 -0.102433 +v 0.205332 0.038919 0.102433 +vn 0.2665 0.3248 0.9075 +vn 0.0000 0.4071 -0.9134 +vn -0.2665 0.3248 -0.9075 +vn 0.0000 0.4071 0.9134 +vn 0.0000 1.0000 0.0000 +vn 0.0000 0.0000 -1.0000 +vn 1.0000 0.0000 0.0000 +vn -0.5994 0.8005 0.0000 +vn 0.5994 0.8005 0.0000 +vn -0.8282 -0.5604 0.0000 +vn -0.6343 0.7731 0.0000 +vn 0.8282 -0.5604 0.0000 +vn 0.4999 -0.2024 0.8421 +vn 0.6343 0.7731 0.0000 +vn -0.4999 -0.2024 -0.8421 +vn -0.1932 0.2581 -0.9466 +vn 0.1932 0.2581 0.9466 +vn 0.9967 -0.0816 0.0000 +vn -0.9967 -0.0816 0.0000 +vn 0.0000 -0.2867 0.9580 +vn 0.4999 -0.2024 -0.8421 +vn 0.0000 -0.2867 -0.9580 +vn -0.4999 -0.2024 0.8421 +vn -0.2665 0.3248 0.9075 +vn -0.1932 0.2581 0.9466 +vn 0.1932 0.2581 -0.9466 +vn 0.2665 0.3248 -0.9075 +vn 0.2665 -0.3248 0.9075 +vn 0.0000 -0.4071 -0.9134 +vn -0.2665 -0.3248 -0.9075 +vn 0.0000 -0.4071 0.9134 +vn 0.0000 -1.0000 0.0000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 0.0000 1.0000 +vn -0.5994 -0.8005 0.0000 +vn 0.5994 -0.8005 0.0000 +vn -0.8282 0.5604 0.0000 +vn -0.6343 -0.7731 0.0000 +vn 0.8282 0.5604 0.0000 +vn 0.4999 0.2024 0.8421 +vn 0.6343 -0.7731 0.0000 +vn -0.4999 0.2024 -0.8421 +vn -0.1932 -0.2581 -0.9466 +vn 0.1932 -0.2581 0.9466 +vn 0.9967 0.0816 0.0000 +vn -0.9967 0.0816 0.0000 +vn 0.0000 0.2867 0.9580 +vn 0.4999 0.2024 -0.8421 +vn 0.0000 0.2867 -0.9580 +vn -0.4999 0.2024 0.8421 +vn -0.2665 -0.3248 0.9075 +vn -0.1932 -0.2581 0.9466 +vn 0.1932 -0.2581 -0.9466 +vn 0.2665 -0.3248 -0.9075 +usemtl None +s off +f 17//1 1//1 10//1 +f 18//2 2//2 4//2 19//2 +f 19//3 4//3 12//3 +f 20//4 3//4 1//4 17//4 +f 4//5 2//5 1//5 3//5 +f 6//6 7//6 31//6 30//6 +f 31//7 7//7 8//7 32//7 +f 21//8 10//8 11//8 22//8 +f 23//9 12//9 13//9 24//9 +f 6//10 5//10 9//10 14//10 +f 4//11 3//11 13//11 12//11 +f 8//12 7//12 15//12 16//12 +f 20//13 8//13 16//13 24//13 +f 1//14 2//14 11//14 10//14 +f 18//15 6//15 14//15 22//15 +f 18//16 22//16 11//16 +f 20//17 24//17 13//17 +f 15//18 23//18 24//18 16//18 +f 9//19 21//19 22//19 14//19 +f 8//20 20//20 17//20 5//20 +f 7//21 19//21 23//21 15//21 +f 6//22 18//22 19//22 7//22 +f 5//23 17//23 21//23 9//23 +f 3//24 20//24 13//24 +f 21//25 17//25 10//25 +f 23//26 19//26 12//26 +f 2//27 18//27 11//27 +f 41//28 34//28 25//28 +f 42//29 43//29 28//29 26//29 +f 43//30 36//30 28//30 +f 44//31 41//31 25//31 27//31 +f 28//32 27//32 25//32 26//32 +f 5//33 6//33 30//33 29//33 +f 5//34 29//34 32//34 8//34 +f 45//35 46//35 35//35 34//35 +f 47//36 48//36 37//36 36//36 +f 30//37 38//37 33//37 29//37 +f 28//38 36//38 37//38 27//38 +f 32//39 40//39 39//39 31//39 +f 44//40 48//40 40//40 32//40 +f 25//41 34//41 35//41 26//41 +f 42//42 46//42 38//42 30//42 +f 42//43 35//43 46//43 +f 44//44 37//44 48//44 +f 39//45 40//45 48//45 47//45 +f 33//46 38//46 46//46 45//46 +f 32//47 29//47 41//47 44//47 +f 31//48 39//48 47//48 43//48 +f 30//49 31//49 43//49 42//49 +f 29//50 33//50 45//50 41//50 +f 27//51 37//51 44//51 +f 45//52 34//52 41//52 +f 47//53 36//53 43//53 +f 26//54 35//54 42//54 diff --git a/XSBoner/Bone Stuff/Bone Models/Spooky Bones.obj.meta b/XSBoner/Bone Stuff/Bone Models/Spooky Bones.obj.meta new file mode 100644 index 0000000..e6f3f0d --- /dev/null +++ b/XSBoner/Bone Stuff/Bone Models/Spooky Bones.obj.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 27bbb6c21e9ff5d409858875fe3abbd2 +timeCreated: 1538330725 +licenseType: Free +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: default + 100002: //RootNode + 400000: default + 400002: //RootNode + 2300000: default + 3300000: default + 4300000: default + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + serializedVersion: 2 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Bone Models/Unity Mecanim Bone.obj b/XSBoner/Bone Stuff/Bone Models/Unity Mecanim Bone.obj new file mode 100644 index 0000000..de8e1da --- /dev/null +++ b/XSBoner/Bone Stuff/Bone Models/Unity Mecanim Bone.obj @@ -0,0 +1,18 @@ +# Blender v2.79 (sub 0) OBJ File: 'Schan-Persona.blend' +# www.blender.org +mtllib UnityMecanimBone.mtl +o Cylinder.001 +v -0.000000 0.000000 0.131156 +v -0.000000 1.994026 -0.000000 +v -0.113585 0.000000 -0.065578 +v 0.113585 0.000000 -0.065578 +vn -0.8656 0.0329 0.4997 +vn 0.0000 0.0329 -0.9995 +vn 0.8656 0.0329 0.4997 +vn 0.0000 -1.0000 0.0000 +usemtl None +s off +f 1//1 2//1 3//1 +f 3//2 2//2 4//2 +f 4//3 2//3 1//3 +f 1//4 3//4 4//4 diff --git a/XSBoner/Bone Stuff/Bone Models/Unity Mecanim Bone.obj.meta b/XSBoner/Bone Stuff/Bone Models/Unity Mecanim Bone.obj.meta new file mode 100644 index 0000000..5144510 --- /dev/null +++ b/XSBoner/Bone Stuff/Bone Models/Unity Mecanim Bone.obj.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: cf3ae3fd848e4d14eab3436a2f36a3a4 +timeCreated: 1538153141 +licenseType: Free +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: default + 100002: //RootNode + 400000: default + 400002: //RootNode + 2300000: default + 3300000: default + 4300000: default + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + serializedVersion: 2 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Materials/Bones.meta b/XSBoner/Bone Stuff/Materials/Bones.meta new file mode 100644 index 0000000..c53cd54 --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/Bones.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 820ceeba55780cc4b81c291860758508 +folderAsset: yes +timeCreated: 1538334999 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Materials/Bones/Mecanim Colors.mat b/XSBoner/Bone Stuff/Materials/Bones/Mecanim Colors.mat new file mode 100644 index 0000000..c2485c9 --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/Bones/Mecanim Colors.mat @@ -0,0 +1,31 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Mecanim Colors + m_Shader: {fileID: 4800000, guid: a519d85f64eea744d84f1ee4fc831d26, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Floats: + - _Stencil: 80 + - _WireSmoothness: 3 + - _WireThickness: 300 + m_Colors: + - _BaseColor: {r: 0, g: 1, b: 0.56471, a: 0.37647} + - _BaseColor2: {r: 0.54999995, g: 0.54999995, b: 0.54999995, a: 0.37647} + - _BaseColor3: {r: 0, g: 0.56471, b: 1, a: 0.37647} + - _WireColor: {r: 0, g: 1, b: 0.56471, a: 1} + - _WireColor2: {r: 0.54999995, g: 0.54999995, b: 0.54999995, a: 1} + - _WireColor3: {r: 0, g: 0.56471, b: 1, a: 1} diff --git a/XSBoner/Bone Stuff/Materials/Bones/Mecanim Colors.mat.meta b/XSBoner/Bone Stuff/Materials/Bones/Mecanim Colors.mat.meta new file mode 100644 index 0000000..c4cf471 --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/Bones/Mecanim Colors.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7b564b0f8a61209459788d101e3e35cf +timeCreated: 1538145737 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Materials/Bones/Unreal Colors.mat b/XSBoner/Bone Stuff/Materials/Bones/Unreal Colors.mat new file mode 100644 index 0000000..fabf462 --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/Bones/Unreal Colors.mat @@ -0,0 +1,31 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Unreal Colors + m_Shader: {fileID: 4800000, guid: a519d85f64eea744d84f1ee4fc831d26, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Floats: + - _Stencil: 80 + - _WireSmoothness: 3 + - _WireThickness: 300 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 0.039215688} + - _BaseColor2: {r: 0.5294118, g: 0.5294118, b: 0.5294118, a: 0.039215688} + - _BaseColor3: {r: 0.5294118, g: 0.5294118, b: 0.5294118, a: 0.039215688} + - _WireColor: {r: 1, g: 1, b: 1, a: 1} + - _WireColor2: {r: 0.58088225, g: 0.58088225, b: 0.58088225, a: 1} + - _WireColor3: {r: 0.5808823, g: 0.5808823, b: 0.5808823, a: 1} diff --git a/XSBoner/Bone Stuff/Materials/Bones/Unreal Colors.mat.meta b/XSBoner/Bone Stuff/Materials/Bones/Unreal Colors.mat.meta new file mode 100644 index 0000000..aa73a3f --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/Bones/Unreal Colors.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d3f35145b7914a94facff806a1f3fb1f +timeCreated: 1538145737 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Materials/IK Lines.meta b/XSBoner/Bone Stuff/Materials/IK Lines.meta new file mode 100644 index 0000000..9dab531 --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/IK Lines.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1c793ac9a998c854c871c4eccd7120b5 +folderAsset: yes +timeCreated: 1538335003 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Red.mat b/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Red.mat new file mode 100644 index 0000000..8d29123 --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Red.mat @@ -0,0 +1,24 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: IKLine Red + m_Shader: {fileID: 4800000, guid: bb535250c98d7484a8962797206e97df, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Floats: + - _Stencil: 80 + m_Colors: + - _Color: {r: 1, g: 0, b: 0, a: 1} diff --git a/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Red.mat.meta b/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Red.mat.meta new file mode 100644 index 0000000..457630d --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Red.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 23d242a981d4b8e4ab19a4ef6c255f19 +timeCreated: 1538178042 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Yellow.mat b/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Yellow.mat new file mode 100644 index 0000000..b51f12e --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Yellow.mat @@ -0,0 +1,24 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: IKLine Yellow + m_Shader: {fileID: 4800000, guid: bb535250c98d7484a8962797206e97df, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Floats: + - _Stencil: 80 + m_Colors: + - _Color: {r: 1, g: 1, b: 0, a: 1} diff --git a/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Yellow.mat.meta b/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Yellow.mat.meta new file mode 100644 index 0000000..d3b5792 --- /dev/null +++ b/XSBoner/Bone Stuff/Materials/IK Lines/IKLine Yellow.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5abae5d6b5a52d1418b515aec665e003 +timeCreated: 1538178042 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Bone Stuff/Shaders/XSBonerBones.shader b/XSBoner/Bone Stuff/Shaders/XSBonerBones.shader new file mode 100644 index 0000000..7d71e82 --- /dev/null +++ b/XSBoner/Bone Stuff/Shaders/XSBonerBones.shader @@ -0,0 +1,345 @@ +Shader "Xiexe/XSBoner/Bones" +{ + Properties + { + [Header(Global Wire Settings)] + _WireThickness ("Wire Thickness", RANGE(0, 800)) = 300 + _WireSmoothness ("Wire Smoothness", RANGE(0, 20)) = 3 + //_MaxTriSize ("Max Tri Size", RANGE(0, 200)) = 25 + + //144 = .56471 + //96 = .37647 + + [Header(Humanoid Bone Colors)] + _WireColor ("Wire Color", Color) = (0, 1, .56471, 1) + _BaseColor ("Base Color", Color) = (0, 1, .56471, .37647) + + [Header(NonHumanoid Bone Colors)] + _WireColor2 ("Wire Color", Color) = (.55, .55, .55, 1) + _BaseColor2 ("Base Color", Color) = (.55, .55, .55, .37647) + + [Header(Dynamic Bone Colors)] + _WireColor3 ("Wire Color", Color) = (0, .56471, 1, 1) + _BaseColor3 ("Base Color", Color) = (0, .56471, 1, .37647) + + [Header(Stencil)] + // _Offset("Offset", float) = 0 + _Stencil ("Stencil ID [0;255]", Float) = 0 + // _ReadMask ("ReadMask [0;255]", Int) = 255 + // _WriteMask ("WriteMask [0;255]", Int) = 255 + // [Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Int) = 8 + // [Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Int) = 2 + // [Enum(UnityEngine.Rendering.StencilOp)] _StencilFail ("Stencil Fail", Int) = 0 + // [Enum(UnityEngine.Rendering.StencilOp)] _StencilZFail ("Stencil ZFail", Int) = 0 + // [Enum(Off,0,On,1)] _ZWrite("ZWrite", Int) = 0 + // [Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Int) = 0 + // [Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _colormask("Color Mask", Int) = 15 + } + SubShader + { + Tags { "RenderType"="Transparent" "Queue"="Transparent"} + LOD 100 + + Blend SrcAlpha OneMinusSrcAlpha // blend + + //Stenciled in bones under the avatar + Pass + { + + ZTest Always + ZWrite On + + Stencil + { + Ref [_Stencil] + ReadMask 255 + WriteMask 255 + Comp Equal + Pass Keep + } + + + CGPROGRAM + #pragma vertex vert + #pragma geometry geom + #pragma fragment frag + // make fog work + #pragma multi_compile_fog + + #include "UnityCG.cginc" + + float _WireThickness; + float _WireSmoothness; + float4 _WireColor; + float4 _BaseColor; + float _MaxTriSize; + float4 _WireColor2; + float4 _BaseColor2; + float4 _WireColor3; + float4 _BaseColor3; + + struct appdata + { + float4 vertex : POSITION; + float4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2g + { + float4 projectionSpaceVertex : SV_POSITION; + float4 worldSpacePosition : TEXCOORD1; + float4 color : TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct g2f + { + float4 projectionSpaceVertex : SV_POSITION; + float4 worldSpacePosition : TEXCOORD0; + float4 dist : TEXCOORD1; + float4 area : TEXCOORD2; + float4 color : TEXCOORD3; + UNITY_VERTEX_OUTPUT_STEREO + }; + + v2g vert (appdata v) + { + v2g o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + o.projectionSpaceVertex = UnityObjectToClipPos(v.vertex); + o.worldSpacePosition = mul(unity_ObjectToWorld, v.vertex); + o.color = v.color; + return o; + } + + [maxvertexcount(3)] + void geom(triangle v2g i[3], inout TriangleStream triangleStream) + { + float2 p0 = i[0].projectionSpaceVertex.xy / i[0].projectionSpaceVertex.w; + float2 p1 = i[1].projectionSpaceVertex.xy / i[1].projectionSpaceVertex.w; + float2 p2 = i[2].projectionSpaceVertex.xy / i[2].projectionSpaceVertex.w; + + float2 edge0 = p2 - p1; + float2 edge1 = p2 - p0; + float2 edge2 = p1 - p0; + + float4 worldEdge0 = i[0].worldSpacePosition - i[1].worldSpacePosition; + float4 worldEdge1 = i[1].worldSpacePosition - i[2].worldSpacePosition; + float4 worldEdge2 = i[0].worldSpacePosition - i[2].worldSpacePosition; + + // To find the distance to the opposite edge, we take the + // formula for finding the area of a triangle Area = Base/2 * Height, + // and solve for the Height = (Area * 2)/Base. + // We can get the area of a triangle by taking its cross product + // divided by 2. However we can avoid dividing our area/base by 2 + // since our cross product will already be double our area. + float area = abs(edge1.x * edge2.y - edge1.y * edge2.x); + float wireThickness = 800 - _WireThickness; + + g2f o; + + o.area = float4(0, 0, 0, 0); + o.area.x = max(length(worldEdge0), max(length(worldEdge1), length(worldEdge2))); + + o.worldSpacePosition = i[0].worldSpacePosition; + o.projectionSpaceVertex = i[0].projectionSpaceVertex; + o.dist.xyz = float3( (area / length(edge0)), 0.0, 0.0) * o.projectionSpaceVertex.w * wireThickness; + o.dist.w = 1.0 / o.projectionSpaceVertex.w; + o.color = i[0].color; + UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[0], o); + triangleStream.Append(o); + + o.worldSpacePosition = i[1].worldSpacePosition; + o.projectionSpaceVertex = i[1].projectionSpaceVertex; + o.dist.xyz = float3(0.0, (area / length(edge1)), 0.0) * o.projectionSpaceVertex.w * wireThickness; + o.dist.w = 1.0 / o.projectionSpaceVertex.w; + o.color = i[1].color; + UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[1], o); + triangleStream.Append(o); + + o.worldSpacePosition = i[2].worldSpacePosition; + o.projectionSpaceVertex = i[2].projectionSpaceVertex; + o.dist.xyz = float3(0.0, 0.0, (area / length(edge2))) * o.projectionSpaceVertex.w * wireThickness; + o.dist.w = 1.0 / o.projectionSpaceVertex.w; + o.color = i[2].color; + UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[2], o); + triangleStream.Append(o); + } + + fixed4 frag(g2f i) : SV_Target + { + float minDistanceToEdge = min(i.dist[0], min(i.dist[1], i.dist[2])) * i.dist[3]; + + if(minDistanceToEdge > 0.9 || i.area.x > 25) + { + float4 basecolors1 = lerp(_BaseColor2, _BaseColor, i.color.r); + float4 basecolors2 = lerp(basecolors1, _BaseColor3, i.color.b); + + return basecolors2; + } + + // Smooth our line out + float t = exp2(_WireSmoothness * -1.0 * minDistanceToEdge * minDistanceToEdge); + //Humanoid + fixed4 finalColorH = lerp(_BaseColor, _WireColor, t); + //NonHumanoid + fixed4 finalColorNH = lerp(_BaseColor2, _WireColor2, t); + //Dynamic Bone + fixed4 finalColorDB = lerp(_BaseColor3, _WireColor3, t); + + float4 colors1 = lerp(finalColorNH, finalColorH, i.color.r); + float4 colors2 = lerp(colors1, finalColorDB, i.color.b); + + return colors2; + + } + ENDCG + } + + // SECOND PASS FOR BONES OUTSIDE OF THE MESH, FIRST PASS MUST BE STENCILED IN. + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma geometry geom + #pragma fragment frag + // make fog work + #pragma multi_compile_fog + + #include "UnityCG.cginc" + + float _WireThickness; + float _WireSmoothness; + float4 _WireColor; + float4 _BaseColor; + float _MaxTriSize; + float4 _WireColor2; + float4 _BaseColor2; + float4 _WireColor3; + float4 _BaseColor3; + + struct appdata + { + float4 vertex : POSITION; + float4 color : COLOR; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2g + { + float4 projectionSpaceVertex : SV_POSITION; + float4 worldSpacePosition : TEXCOORD1; + float4 color : TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct g2f + { + float4 projectionSpaceVertex : SV_POSITION; + float4 worldSpacePosition : TEXCOORD0; + float4 dist : TEXCOORD1; + float4 area : TEXCOORD2; + float4 color : TEXCOORD3; + UNITY_VERTEX_OUTPUT_STEREO + }; + + v2g vert (appdata v) + { + v2g o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + o.projectionSpaceVertex = UnityObjectToClipPos(v.vertex); + o.worldSpacePosition = mul(unity_ObjectToWorld, v.vertex); + o.color = v.color; + return o; + } + + [maxvertexcount(3)] + void geom(triangle v2g i[3], inout TriangleStream triangleStream) + { + float2 p0 = i[0].projectionSpaceVertex.xy / i[0].projectionSpaceVertex.w; + float2 p1 = i[1].projectionSpaceVertex.xy / i[1].projectionSpaceVertex.w; + float2 p2 = i[2].projectionSpaceVertex.xy / i[2].projectionSpaceVertex.w; + + float2 edge0 = p2 - p1; + float2 edge1 = p2 - p0; + float2 edge2 = p1 - p0; + + float4 worldEdge0 = i[0].worldSpacePosition - i[1].worldSpacePosition; + float4 worldEdge1 = i[1].worldSpacePosition - i[2].worldSpacePosition; + float4 worldEdge2 = i[0].worldSpacePosition - i[2].worldSpacePosition; + + // To find the distance to the opposite edge, we take the + // formula for finding the area of a triangle Area = Base/2 * Height, + // and solve for the Height = (Area * 2)/Base. + // We can get the area of a triangle by taking its cross product + // divided by 2. However we can avoid dividing our area/base by 2 + // since our cross product will already be double our area. + float area = abs(edge1.x * edge2.y - edge1.y * edge2.x); + float wireThickness = 800 - _WireThickness; + + g2f o; + + o.area = float4(0, 0, 0, 0); + o.area.x = max(length(worldEdge0), max(length(worldEdge1), length(worldEdge2))); + + o.worldSpacePosition = i[0].worldSpacePosition; + o.projectionSpaceVertex = i[0].projectionSpaceVertex; + o.dist.xyz = float3( (area / length(edge0)), 0.0, 0.0) * o.projectionSpaceVertex.w * wireThickness; + o.dist.w = 1.0 / o.projectionSpaceVertex.w; + o.color = i[0].color; + UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[0], o); + triangleStream.Append(o); + + o.worldSpacePosition = i[1].worldSpacePosition; + o.projectionSpaceVertex = i[1].projectionSpaceVertex; + o.dist.xyz = float3(0.0, (area / length(edge1)), 0.0) * o.projectionSpaceVertex.w * wireThickness; + o.dist.w = 1.0 / o.projectionSpaceVertex.w; + o.color = i[1].color; + UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[1], o); + triangleStream.Append(o); + + o.worldSpacePosition = i[2].worldSpacePosition; + o.projectionSpaceVertex = i[2].projectionSpaceVertex; + o.dist.xyz = float3(0.0, 0.0, (area / length(edge2))) * o.projectionSpaceVertex.w * wireThickness; + o.dist.w = 1.0 / o.projectionSpaceVertex.w; + o.color = i[2].color; + UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(i[2], o); + triangleStream.Append(o); + } + + fixed4 frag(g2f i) : SV_Target + { + float minDistanceToEdge = min(i.dist[0], min(i.dist[1], i.dist[2])) * i.dist[3]; + + if(minDistanceToEdge > 0.9 || i.area.x > 25) + { + float4 basecolors1 = lerp(_BaseColor2, _BaseColor, i.color.r); + float4 basecolors2 = lerp(basecolors1, _BaseColor3, i.color.b); + + return basecolors2; + } + + // Smooth our line out + float t = exp2(_WireSmoothness * -1.0 * minDistanceToEdge * minDistanceToEdge); + //Humanoid + fixed4 finalColorH = lerp(_BaseColor, _WireColor, t); + //NonHumanoid + fixed4 finalColorNH = lerp(_BaseColor2, _WireColor2, t); + //Dynamic Bone + fixed4 finalColorDB = lerp(_BaseColor3, _WireColor3, t); + + float4 colors1 = lerp(finalColorNH, finalColorH, i.color.r); + float4 colors2 = lerp(colors1, finalColorDB, i.color.b); + + return colors2; + + } + ENDCG + } + + + } +} diff --git a/XSBoner/Bone Stuff/Shaders/XSBonerBones.shader.meta b/XSBoner/Bone Stuff/Shaders/XSBonerBones.shader.meta new file mode 100644 index 0000000..0c69f83 --- /dev/null +++ b/XSBoner/Bone Stuff/Shaders/XSBonerBones.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a519d85f64eea744d84f1ee4fc831d26 +timeCreated: 1538156442 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Editor/Doot.mp3 b/XSBoner/Editor/Doot.mp3 new file mode 100644 index 0000000..7f06283 Binary files /dev/null and b/XSBoner/Editor/Doot.mp3 differ diff --git a/XSBoner/Editor/Doot.mp3.meta b/XSBoner/Editor/Doot.mp3.meta new file mode 100644 index 0000000..da2f4fe --- /dev/null +++ b/XSBoner/Editor/Doot.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 06bba58b3550c8c429d114ae6887e44b +timeCreated: 1538326972 +licenseType: Free +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Editor/SKULL TRUMPET.mp3 b/XSBoner/Editor/SKULL TRUMPET.mp3 new file mode 100644 index 0000000..7f06283 Binary files /dev/null and b/XSBoner/Editor/SKULL TRUMPET.mp3 differ diff --git a/XSBoner/Editor/SKULL TRUMPET.mp3.meta b/XSBoner/Editor/SKULL TRUMPET.mp3.meta new file mode 100644 index 0000000..da2f4fe --- /dev/null +++ b/XSBoner/Editor/SKULL TRUMPET.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 06bba58b3550c8c429d114ae6887e44b +timeCreated: 1538326972 +licenseType: Free +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/XSBoner/Editor/XSBonerGenerator.cs b/XSBoner/Editor/XSBonerGenerator.cs index 579a4a4..c66415c 100644 --- a/XSBoner/Editor/XSBonerGenerator.cs +++ b/XSBoner/Editor/XSBonerGenerator.cs @@ -3,287 +3,411 @@ using System.Collections.Generic; using System.Collections; using System.Linq; +using System.Text.RegularExpressions; +using System.IO; public class XSBonerGenerator : EditorWindow { private Object armatureObj; - private Object bone; - private Object smr; - private Material boneMaterial; - private Material ikMaterial; - private bool haveIKLines; + private Object bone; + private Object smr; + private Material boneMaterial; + private Material ikMaterial; + private bool haveIKLines; + private bool spookMode; private Animator ani; - private List bones; - private Hashtable bonesByHash; - private List boneWeights; - private List combineInstances; - private List coloUrs; + private List bones; + private Hashtable bonesByHash; + private List boneWeights; + private List combineInstances; + private List coloUrs; + private Object startingBone; - [MenuItem("Xiexe/Tools/XSBonerGenerator")] + + [MenuItem("Xiexe/Tools/XSBonerGenerator")] static void Init() { XSBonerGenerator window = (XSBonerGenerator)GetWindow(typeof(XSBonerGenerator)); window.Show(); } - private void OnGUI() - { - armatureObj = EditorGUILayout.ObjectField("Animator Object", armatureObj, typeof(Animator), true); - if (armatureObj) { - ani = (Animator)armatureObj; - } - bone = EditorGUILayout.ObjectField("Bone Model", bone, typeof(Object), true); - smr = EditorGUILayout.ObjectField("Skinned Mesh Renderer", smr, typeof(SkinnedMeshRenderer), true); - boneMaterial = (Material)EditorGUILayout.ObjectField("Bone Material", boneMaterial, typeof(Material), true); - - if (armatureObj && ani.isHuman) { - if (haveIKLines) { - ikMaterial = (Material)EditorGUILayout.ObjectField("IK Material", ikMaterial, typeof(Material), true); - } - haveIKLines = EditorGUILayout.Toggle("Have IK Lines", haveIKLines); - } - - bool error = false; - if (armatureObj == null) - { - EditorGUILayout.HelpBox("No Animator found", MessageType.Warning, true); - error = true; - } - if (bone == null) - { - EditorGUILayout.HelpBox("No Bone Object found", MessageType.Warning, true); - error = true; - } - if (smr == null) - { - EditorGUILayout.HelpBox("No Skinned Mesh Renderer found", MessageType.Warning, true); - error = true; - } - if (boneMaterial == null) - { - EditorGUILayout.HelpBox("No Bone Material found", MessageType.Warning, true); - error = true; - } - if (ikMaterial == null && haveIKLines) - { - EditorGUILayout.HelpBox("No IK Material found", MessageType.Warning, true); - error = true; - } - - if (error) return; - - if (GUILayout.Button("Generate")) - { - bone = AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(bone), typeof(Object)); - boneMaterial = (Material)AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(boneMaterial), typeof(Material)); - ikMaterial = (Material)AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(ikMaterial), typeof(Material)); - - bones = new List(); - bonesByHash = new Hashtable(); - boneWeights = new List(); - combineInstances = new List(); - coloUrs = new List(); - - int boneIndex = 0; - foreach (Transform _bone in ((SkinnedMeshRenderer)smr).bones) - { - bones.Add(_bone); - bonesByHash.Add(_bone.name, boneIndex); - boneIndex++; - } + private void OnGUI() + { + armatureObj = EditorGUILayout.ObjectField(new GUIContent("Animator Object", "Your Model's Animator object"), armatureObj, typeof(Animator), true); + if (armatureObj != null) { + ani = (Animator)armatureObj; + } else + { + startingBone = null; + smr = null; + } - recursiveShit(ani.transform.GetChild(0).GetChild(0)); + if (armatureObj && !ani.isHuman) + { + if (startingBone == null) + { + if (ani.transform.childCount > 0) + { + startingBone = ani.transform.GetChild(0); + for (int i = 0; i < ani.transform.childCount; i++) + { + if (ani.transform.GetChild(i).childCount > 0) + { + startingBone = ani.transform.GetChild(i).GetChild(0); + break; + } + } + } + } + startingBone = EditorGUILayout.ObjectField(new GUIContent("Starting Bone", "Where the bones start from"), startingBone, typeof(Transform), true); + } else + { + startingBone = null; + } - //keep bindposes - List bindposes = new List(); + bone = EditorGUILayout.ObjectField(new GUIContent("Bone Model", "The Model to use as the bone"), bone, typeof(Object), true); + if (armatureObj != null && smr == null) + { + foreach (SkinnedMeshRenderer skinedmeshr in ani.GetComponentsInChildren()) + { + if (skinedmeshr.transform.parent == ani.transform) + { + smr = skinedmeshr; + break; + } + } + } + smr = EditorGUILayout.ObjectField(new GUIContent("Skinned Mesh Renderer", "The main skinned mesh renderer"), smr, typeof(SkinnedMeshRenderer), true); + boneMaterial = (Material)EditorGUILayout.ObjectField(new GUIContent("Bone Material", "The Material you want for your bones"), boneMaterial, typeof(Material), true); + + if (armatureObj && ani.isHuman) { + if (haveIKLines) { + ikMaterial = (Material)EditorGUILayout.ObjectField(new GUIContent("IK Material", "The Material you want for your IK Lines"), ikMaterial, typeof(Material), true); + } + haveIKLines = EditorGUILayout.Toggle("Have IK Lines", haveIKLines); + } else + { + haveIKLines = false; + } + + //Toggle for Spook Mode + spookMode = EditorGUILayout.Toggle("Spook Mode (Optional)", spookMode); - for (int b = 0; b < bones.Count; b++) - { - bindposes.Add(bones[b].worldToLocalMatrix * ani.transform.worldToLocalMatrix); - } + bool error = false; + if (armatureObj == null) + { + EditorGUILayout.HelpBox("No Animator found", MessageType.Error); + error = true; + } + if (bone == null) + { + EditorGUILayout.HelpBox("No Bone Object found", MessageType.Error); + error = true; + } + if (smr == null) + { + EditorGUILayout.HelpBox("No Skinned Mesh Renderer found", MessageType.Error); + error = true; + } + if (boneMaterial == null) + { + EditorGUILayout.HelpBox("No Bone Material found", MessageType.Error); + error = true; + } + if (ikMaterial == null && haveIKLines) + { + EditorGUILayout.HelpBox("No IK Material found", MessageType.Error); + error = true; + } + if (error) return; - GameObject yourBones = new GameObject(ani.name + "_YourBones"); - yourBones.transform.parent = ani.transform; + EditorGUILayout.Separator(); - SkinnedMeshRenderer yourSkinnedMeshRenderer = yourBones.AddComponent(); - yourSkinnedMeshRenderer.sharedMesh = new Mesh - { - name = ani.name + "_YourBones" - }; - yourSkinnedMeshRenderer.sharedMesh.CombineMeshes(combineInstances.ToArray()); + if (GUILayout.Button("Generate")) + { - Vector3 scale = ani.transform.localScale; - - List vertices = new List(); - for (int i = 0; i < yourSkinnedMeshRenderer.sharedMesh.vertexCount; i++) - { - var vertex = yourSkinnedMeshRenderer.sharedMesh.vertices[i]; - vertex.x *= scale.x; - vertex.y *= scale.y; - vertex.z *= scale.z; - vertex += ani.transform.position; - vertices.Add(vertex); - } + string[] guids1 = AssetDatabase.FindAssets("XSBonerGenerator", null); + string untouchedString = AssetDatabase.GUIDToAssetPath(guids1[0]); + string[] splitString = untouchedString.Split('/'); - if (haveIKLines) - { - IKLines(vertices, HumanBodyBones.RightUpperArm, HumanBodyBones.RightHand, HumanBodyBones.RightLowerArm); - IKLines(vertices, HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftHand, HumanBodyBones.LeftLowerArm); - IKLines(vertices, HumanBodyBones.RightUpperLeg, HumanBodyBones.RightFoot, HumanBodyBones.RightLowerLeg); - IKLines(vertices, HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftFoot, HumanBodyBones.LeftLowerLeg); + ArrayUtility.RemoveAt(ref splitString, splitString.Length - 1); + ArrayUtility.RemoveAt(ref splitString, splitString.Length - 1); + + string finalFilePath = string.Join("/", splitString); + string pathToGenerated = finalFilePath + "/Generated"; + string editorPath = string.Join("/", splitString) + "/Editor"; + + if (!Directory.Exists(pathToGenerated)) { + Directory.CreateDirectory(pathToGenerated); + } + + bone = AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(bone), typeof(Object)); + boneMaterial = (Material)AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(boneMaterial), typeof(Material)); + ikMaterial = (Material)AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(ikMaterial), typeof(Material)); + + string name = Regex.Replace(ani.name, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled); + string bonename = Regex.Replace(bone.name, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled); + + bones = new List(); + bonesByHash = new Hashtable(); + boneWeights = new List(); + combineInstances = new List(); + coloUrs = new List(); + + int boneIndex = 0; + foreach (Transform _bone in ((SkinnedMeshRenderer)smr).bones) + { + if (_bone != null) { + bones.Add(_bone); + bonesByHash.Add(_bone.name, boneIndex); + boneIndex++; + } + } + + recursiveShit(startingBone != null ? (Transform)startingBone : ani.GetBoneTransform(HumanBodyBones.Hips), collectDynamicBones(ani.transform)); + + //keep bindposes + List bindposes = new List(); + + for (int b = 0; b < bones.Count; b++) + { + bindposes.Add(bones[b].worldToLocalMatrix * ani.transform.worldToLocalMatrix); + } + + + GameObject yourBones = new GameObject(name + "_" + bonename + "_YourBones"); + yourBones.transform.parent = ani.transform; + + SkinnedMeshRenderer yourSkinnedMeshRenderer = yourBones.AddComponent(); + yourSkinnedMeshRenderer.sharedMesh = new Mesh + { + name = name + "_" + bonename + "_YourBones" + }; + + //Adding Audio Source for Super Spooky Mode. + if (spookMode){ + yourBones.AddComponent(); + AudioSource doot = yourBones.GetComponent(); + doot.clip = (AudioClip)AssetDatabase.LoadAssetAtPath(editorPath + "/Doot.mp3", typeof(AudioClip)); + doot.spatialBlend = 1; + doot.dopplerLevel = 0; + doot.minDistance = 2; + doot.maxDistance = 10; } + //---- + yourSkinnedMeshRenderer.sharedMesh.CombineMeshes(combineInstances.ToArray()); + + Vector3 scale = ani.transform.localScale; + + List boneVertices = new List(); + for (int i = 0; i < yourSkinnedMeshRenderer.sharedMesh.vertexCount; i++) + { + var vertex = yourSkinnedMeshRenderer.sharedMesh.vertices[i]; + vertex.x *= scale.x; + vertex.y *= scale.y; + vertex.z *= scale.z; + vertex += ani.transform.position; + boneVertices.Add(vertex); + } + + if (haveIKLines) + { + IKLines(boneVertices, HumanBodyBones.RightUpperArm, HumanBodyBones.RightHand, HumanBodyBones.RightLowerArm); + IKLines(boneVertices, HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftHand, HumanBodyBones.LeftLowerArm); + IKLines(boneVertices, HumanBodyBones.RightUpperLeg, HumanBodyBones.RightFoot, HumanBodyBones.RightLowerLeg); + IKLines(boneVertices, HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftFoot, HumanBodyBones.LeftLowerLeg); + } + + yourSkinnedMeshRenderer.sharedMesh.vertices = boneVertices.ToArray(); + + if (haveIKLines) + { + yourSkinnedMeshRenderer.sharedMesh.subMeshCount = 2; + int[] values = Enumerable.Range(yourSkinnedMeshRenderer.sharedMesh.vertexCount - 12, 12).ToArray(); + yourSkinnedMeshRenderer.sharedMesh.SetTriangles(values, 1); + } + + yourSkinnedMeshRenderer.bones = bones.ToArray(); + yourSkinnedMeshRenderer.rootBone = bones[0]; + yourSkinnedMeshRenderer.sharedMesh.boneWeights = boneWeights.ToArray(); + yourSkinnedMeshRenderer.sharedMesh.bindposes = bindposes.ToArray(); + yourSkinnedMeshRenderer.sharedMesh.colors = coloUrs.ToArray(); + yourSkinnedMeshRenderer.sharedMaterials = haveIKLines ? new Material[] { boneMaterial, ikMaterial } : new Material[] { boneMaterial }; + + yourSkinnedMeshRenderer.sharedMesh.RecalculateBounds(); + + AssetDatabase.CreateAsset(yourSkinnedMeshRenderer.sharedMesh, pathToGenerated + "/" + name + "_" + bonename + "_YourBones.asset"); + AssetDatabase.SaveAssets(); + + armatureObj = null; + } + } - yourSkinnedMeshRenderer.sharedMesh.vertices = vertices.ToArray(); + private HashSet collectDynamicBones(Transform transform) + { + HashSet results = new HashSet(); + collectDynamicBones(transform, results); + return results; + } - if (haveIKLines) - { - yourSkinnedMeshRenderer.sharedMesh.subMeshCount = 2; - int[] values = Enumerable.Range(0, yourSkinnedMeshRenderer.sharedMesh.vertexCount).ToArray(); - yourSkinnedMeshRenderer.sharedMesh.SetTriangles(values, 0); - values = Enumerable.Range(yourSkinnedMeshRenderer.sharedMesh.vertexCount - 12, 12).ToArray(); - yourSkinnedMeshRenderer.sharedMesh.SetTriangles(values, 1); - } + private void collectDynamicBones(Transform transform, HashSet results) + { + foreach (DynamicBone dynamicBone in transform.GetComponents()) + { + collectDynamicBonesForOneScript(dynamicBone.m_Root, dynamicBone.m_Exclusions, results); + } - yourSkinnedMeshRenderer.bones = bones.ToArray(); - yourSkinnedMeshRenderer.rootBone = bones[0]; - yourSkinnedMeshRenderer.sharedMesh.boneWeights = boneWeights.ToArray(); - yourSkinnedMeshRenderer.sharedMesh.bindposes = bindposes.ToArray(); - yourSkinnedMeshRenderer.sharedMesh.colors = coloUrs.ToArray(); - yourSkinnedMeshRenderer.sharedMaterials = haveIKLines ? new Material[] { boneMaterial, ikMaterial } : new Material[] { boneMaterial}; + for (int i = 0; i < transform.childCount; i++) + { + collectDynamicBones(transform.GetChild(i), results); + } + } - yourSkinnedMeshRenderer.sharedMesh.RecalculateBounds(); + private void collectDynamicBonesForOneScript(Transform transform, List exclusions, HashSet results) + { + if (exclusions.Contains(transform)) + { + return; + } - AssetDatabase.CreateAsset(yourSkinnedMeshRenderer.sharedMesh, "Assets/" + ani.name + "_YourBones.asset"); - AssetDatabase.SaveAssets(); + results.Add(transform); - armatureObj = null; - } + for (int i = 0; i < transform.childCount; i++) + { + collectDynamicBonesForOneScript(transform.GetChild(i), exclusions, results); + } } - //tranform1 = main - //tranform2 = child - private void recursiveShit(Transform transform, bool dynbone = false) + + private void recursiveShit(Transform transform, HashSet dynamicBones) { - if (transform.GetComponents().Length > 0) - { - dynbone = true; - } - for (int i = 0; i < transform.childCount; i++) + bool dynbone = dynamicBones.Contains(transform); + if (transform.gameObject.activeInHierarchy && bones.Contains(transform)) { - if (transform.gameObject.activeInHierarchy && bones.Contains(transform)) - { - addCapColl(transform, transform.GetChild(i), dynbone); - recursiveShit(transform.GetChild(i), dynbone); - } + for (int i = 0; i < transform.childCount; i++) + { + + if (transform.GetChild(i).gameObject.activeInHierarchy) + { + addCapColl(transform, transform.GetChild(i), dynbone); + } + + // Always recurse - can have dynamic bones under non-dynamic bones + recursiveShit(transform.GetChild(i), dynamicBones); + } } } + //tranform1 = main + //tranform2 = child private void addCapColl(Transform transform1, Transform transform2, bool dynbone) - { + { - GameObject boneSpawn = Instantiate(bone, transform1.position, transform1.rotation) as GameObject; - float dist = Vector3.Distance(transform1.position, transform2.position) * 0.5f; + GameObject boneSpawn = Instantiate(bone, transform1.position, transform1.rotation) as GameObject; + float dist = Vector3.Distance(transform1.position, transform2.position) * 0.5f; boneSpawn.name = transform1.name + " -> " + transform2.name; - boneSpawn.transform.localScale = new Vector3(dist, dist, dist); + boneSpawn.transform.localScale = new Vector3(dist, dist, dist); boneSpawn.transform.LookAt(transform2.position); boneSpawn.transform.rotation = Quaternion.Euler(boneSpawn.transform.rotation.eulerAngles + new Vector3(90f,0,0)); - bool isHumanoid = false; - foreach (HumanBodyBones bone in HumanBodyBones.GetValues(typeof(HumanBodyBones))) - { - if (ani.GetBoneTransform(bone) != null && ani.GetBoneTransform(bone).name == transform1.name) - { - isHumanoid = true; - break; - } - } + bool isHumanoid = false; + foreach (HumanBodyBones bone in HumanBodyBones.GetValues(typeof(HumanBodyBones))) + { + if (ani.GetBoneTransform(bone) != null && ani.GetBoneTransform(bone).name == transform1.name) + { + isHumanoid = true; + break; + } + } - InsertSMRToCombine(boneSpawn.GetComponentInChildren(), transform1.name, isHumanoid, dynbone); - DestroyImmediate(boneSpawn); + InsertSMRToCombine(boneSpawn.GetComponentInChildren(), transform1.name, isHumanoid, dynbone); + DestroyImmediate(boneSpawn); } - private void InsertSMRToCombine(MeshFilter smr, string bonename, bool hoomanoid, bool dynbone) - { + private void InsertSMRToCombine(MeshFilter smr, string bonename, bool hoomanoid, bool dynbone) + { - BoneWeight[] meshBoneweight = new BoneWeight[smr.sharedMesh.vertexCount]; + BoneWeight[] meshBoneweight = new BoneWeight[smr.sharedMesh.vertexCount]; - // remap bone weight bone indexes to the hashtable obtained from base object - foreach (BoneWeight bw in meshBoneweight) - { - BoneWeight bWeight = bw; - - if (bonesByHash[bonename] != null) - { - bWeight.boneIndex0 = (int)bonesByHash[bonename]; - bWeight.weight0 = 1; + // remap bone weight bone indexes to the hashtable obtained from base object + foreach (BoneWeight bw in meshBoneweight) + { + BoneWeight bWeight = bw; + + if (bonesByHash[bonename] != null) + { + bWeight.boneIndex0 = (int)bonesByHash[bonename]; + bWeight.weight0 = 1; + + boneWeights.Add(bWeight); + } + } - boneWeights.Add(bWeight); - } - } - - //add the smr to the combine list; also add to destroy list - CombineInstance ci = new CombineInstance(); - ci.mesh = smr.sharedMesh; - - ci.transform = smr.transform.localToWorldMatrix; - - Color colour = new Color(); - if (dynbone) - { - colour = Color.blue; - } else if (hoomanoid) - { - colour = Color.red; - } - - for (int i = 0; i < smr.sharedMesh.vertexCount; i++) - { - coloUrs.Add(colour); - } - combineInstances.Add(ci); - } - - private void IKLines(List vertices, HumanBodyBones upper, HumanBodyBones joint, HumanBodyBones lower) - { - Transform upperT = ani.GetBoneTransform(upper); - Transform jointT = ani.GetBoneTransform(joint); - Transform lowerT = ani.GetBoneTransform(lower); - - if (upperT == null) return; - if (jointT == null) return; - if (lowerT == null) return; - - BoneWeight[] _boneWeights = new BoneWeight[3]; - _boneWeights[0].boneIndex0 = (int)bonesByHash[upperT.name]; - _boneWeights[0].weight0 = 1; - _boneWeights[1].boneIndex0 = (int)bonesByHash[lowerT.name]; - _boneWeights[1].weight0 = 1; - _boneWeights[2].boneIndex0 = (int)bonesByHash[upperT.name]; - _boneWeights[2].weight0 = 1; - - boneWeights.Add(_boneWeights[0]); - boneWeights.Add(_boneWeights[1]); - boneWeights.Add(_boneWeights[2]); - - Vector3 scale = ani.transform.localScale; - - Vector3 upperV = upperT.position; - upperV.x *= scale.x; - upperV.y *= scale.y; - upperV.z *= scale.z; - vertices.Add(upperV); - - Vector3 jointV = jointT.position; - jointV.x *= scale.x; - jointV.y *= scale.y; - jointV.z *= scale.z; - vertices.Add(jointV); - - vertices.Add(upperV); - - coloUrs.Add(Color.black); - coloUrs.Add(Color.black); - coloUrs.Add(Color.black); - } + //add the smr to the combine list; also add to destroy list + CombineInstance ci = new CombineInstance(); + ci.mesh = smr.sharedMesh; + + ci.transform = smr.transform.localToWorldMatrix; + + Color colour = new Color(); + if (dynbone) + { + colour = Color.blue; + } else if (hoomanoid) + { + colour = Color.red; + } + + for (int i = 0; i < smr.sharedMesh.vertexCount; i++) + { + coloUrs.Add(colour); + } + combineInstances.Add(ci); + } + + private void IKLines(List vertices, HumanBodyBones upper, HumanBodyBones joint, HumanBodyBones lower) + { + Transform upperT = ani.GetBoneTransform(upper); + Transform jointT = ani.GetBoneTransform(joint); + Transform lowerT = ani.GetBoneTransform(lower); + + if (upperT == null) return; + if (jointT == null) return; + if (lowerT == null) return; + + BoneWeight[] _boneWeights = new BoneWeight[3]; + _boneWeights[0].boneIndex0 = (int)bonesByHash[upperT.name]; + _boneWeights[0].weight0 = 1; + _boneWeights[1].boneIndex0 = (int)bonesByHash[lowerT.name]; + _boneWeights[1].weight0 = 1; + _boneWeights[2].boneIndex0 = (int)bonesByHash[upperT.name]; + _boneWeights[2].weight0 = 1; + + boneWeights.Add(_boneWeights[0]); + boneWeights.Add(_boneWeights[1]); + boneWeights.Add(_boneWeights[2]); + + Vector3 scale = ani.transform.localScale; + + Vector3 upperV = upperT.position; + upperV.x *= scale.x; + upperV.y *= scale.y; + upperV.z *= scale.z; + upperV += ani.transform.position; + vertices.Add(upperV); + + Vector3 jointV = jointT.position; + jointV.x *= scale.x; + jointV.y *= scale.y; + jointV.z *= scale.z; + jointV += ani.transform.position; + vertices.Add(jointV); + + vertices.Add(upperV); + + coloUrs.Add(Color.black); + coloUrs.Add(Color.black); + coloUrs.Add(Color.black); + } } \ No newline at end of file diff --git a/XSBoner/Generated.meta b/XSBoner/Generated.meta new file mode 100644 index 0000000..46915a7 --- /dev/null +++ b/XSBoner/Generated.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3726d27e2a4aaff41bd8585c40dd2e7a +folderAsset: yes +timeCreated: 1538329754 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: