├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md ├── README.md └── images │ └── banner.png ├── .gitignore ├── Code.meta ├── Code ├── Editor.meta ├── Editor │ ├── Core.meta │ ├── Core │ │ ├── DeformableManagerEditor.cs │ │ └── DeformableManagerEditor.cs.meta │ ├── CreatorWindow.cs │ ├── CreatorWindow.cs.meta │ ├── CreditsWindow.cs │ ├── CreditsWindow.cs.meta │ ├── Data.meta │ ├── Data │ │ ├── ReorderableComponentElementList.cs │ │ └── ReorderableComponentElementList.cs.meta │ ├── DeformBuildPostProcessor.cs │ ├── DeformBuildPostProcessor.cs.meta │ ├── DeformEditor.asmdef │ ├── DeformEditor.asmdef.meta │ ├── DeformEditorGUIUtility.cs │ ├── DeformEditorGUIUtility.cs.meta │ ├── DeformEditorResources.cs │ ├── DeformEditorResources.cs.meta │ ├── DeformEditorSettings.cs │ ├── DeformEditorSettings.cs.meta │ ├── DeformEditorSettingsAsset.cs │ ├── DeformEditorSettingsAsset.cs.meta │ ├── DeformEditorSettingsAssetInspector.cs │ ├── DeformEditorSettingsAssetInspector.cs.meta │ ├── DeformHandles.cs │ ├── DeformHandles.cs.meta │ ├── DeformHandlesUtility.cs │ ├── DeformHandlesUtility.cs.meta │ ├── DeformModelPostProcessor.cs │ ├── DeformModelPostProcessor.cs.meta │ ├── DeformUnityObjectSelection.cs │ ├── DeformUnityObjectSelection.cs.meta │ ├── MenuItemActions.cs │ ├── MenuItemActions.cs.meta │ ├── Mesh.meta │ ├── Mesh │ │ ├── Data.meta │ │ ├── Data │ │ │ ├── VertexCacheCreator.cs │ │ │ ├── VertexCacheCreator.cs.meta │ │ │ ├── VertexCacheEditor.cs │ │ │ └── VertexCacheEditor.cs.meta │ │ ├── DeformableEditor.cs │ │ ├── DeformableEditor.cs.meta │ │ ├── DeformerEditor.cs │ │ ├── DeformerEditor.cs.meta │ │ ├── Deformers.meta │ │ ├── Deformers │ │ │ ├── BendDeformerEditor.cs │ │ │ ├── BendDeformerEditor.cs.meta │ │ │ ├── BlendDeformerEditor.cs │ │ │ ├── BlendDeformerEditor.cs.meta │ │ │ ├── BoundedBendDeformerEditor.cs │ │ │ ├── BoundedBendDeformerEditor.cs.meta │ │ │ ├── BulgeDeformerEditor.cs │ │ │ ├── BulgeDeformerEditor.cs.meta │ │ │ ├── CubifyDeformerEditor.cs │ │ │ ├── CubifyDeformerEditor.cs.meta │ │ │ ├── CurveDisplaceDeformerEditor.cs │ │ │ ├── CurveDisplaceDeformerEditor.cs.meta │ │ │ ├── CurveScaleDeformerEditor.cs │ │ │ ├── CurveScaleDeformerEditor.cs.meta │ │ │ ├── CylindrifyDeformerEditor.cs │ │ │ ├── CylindrifyDeformerEditor.cs.meta │ │ │ ├── InflateDeformerEditor.cs │ │ │ ├── InflateDeformerEditor.cs.meta │ │ │ ├── LatheDisplaceDeformerEditor.cs │ │ │ ├── LatheDisplaceDeformerEditor.cs.meta │ │ │ ├── LatticeDeformerEditor.cs │ │ │ ├── LatticeDeformerEditor.cs.meta │ │ │ ├── MagnetDeformerEditor.cs │ │ │ ├── MagnetDeformerEditor.cs.meta │ │ │ ├── Masking.meta │ │ │ ├── Masking │ │ │ │ ├── Masks.meta │ │ │ │ └── Masks │ │ │ │ │ ├── BoxMaskEditor.cs │ │ │ │ │ ├── BoxMaskEditor.cs.meta │ │ │ │ │ ├── SphereMaskEditor.cs │ │ │ │ │ ├── SphereMaskEditor.cs.meta │ │ │ │ │ ├── VertexColorMaskEditor.cs │ │ │ │ │ ├── VertexColorMaskEditor.cs.meta │ │ │ │ │ ├── VerticalGradientMaskEditor.cs │ │ │ │ │ └── VerticalGradientMaskEditor.cs.meta │ │ │ ├── MeltDeformerEditor.cs │ │ │ ├── MeltDeformerEditor.cs.meta │ │ │ ├── Noise.meta │ │ │ ├── Noise │ │ │ │ ├── CellularNoiseDeformerEditor.cs │ │ │ │ ├── CellularNoiseDeformerEditor.cs.meta │ │ │ │ ├── NoiseDeformerEditor.cs │ │ │ │ ├── NoiseDeformerEditor.cs.meta │ │ │ │ ├── PerlinNoiseDeformerEditor.cs │ │ │ │ ├── PerlinNoiseDeformerEditor.cs.meta │ │ │ │ ├── SimplexNoiseDeformerEditor.cs │ │ │ │ └── SimplexNoiseDeformerEditor.cs.meta │ │ │ ├── RadialCurveDeformerEditor.cs │ │ │ ├── RadialCurveDeformerEditor.cs.meta │ │ │ ├── RadialSkewDeformerEditor.cs │ │ │ ├── RadialSkewDeformerEditor.cs.meta │ │ │ ├── RippleDeformerEditor.cs │ │ │ ├── RippleDeformerEditor.cs.meta │ │ │ ├── ScaleDeformerEditor.cs │ │ │ ├── ScaleDeformerEditor.cs.meta │ │ │ ├── SineDeformerEditor.cs │ │ │ ├── SineDeformerEditor.cs.meta │ │ │ ├── SkewDeformerEditor.cs │ │ │ ├── SkewDeformerEditor.cs.meta │ │ │ ├── SpherifyDeformerEditor.cs │ │ │ ├── SpherifyDeformerEditor.cs.meta │ │ │ ├── SquashAndStretchDeformerEditor.cs │ │ │ ├── SquashAndStretchDeformerEditor.cs.meta │ │ │ ├── StarDeformerEditor.cs │ │ │ ├── StarDeformerEditor.cs.meta │ │ │ ├── TaperDeformerEditor.cs │ │ │ ├── TaperDeformerEditor.cs.meta │ │ │ ├── TextureDisplaceDeformerEditor.cs │ │ │ ├── TextureDisplaceDeformerEditor.cs.meta │ │ │ ├── TransformDeformerEditor.cs │ │ │ ├── TransformDeformerEditor.cs.meta │ │ │ ├── TransformOffsetDeformerEditor.cs │ │ │ ├── TransformOffsetDeformerEditor.cs.meta │ │ │ ├── TwirlDeformerEditor.cs │ │ │ ├── TwirlDeformerEditor.cs.meta │ │ │ ├── TwistDeformerEditor.cs │ │ │ ├── TwistDeformerEditor.cs.meta │ │ │ ├── UVOffsetDeformerEditor.cs │ │ │ ├── UVOffsetDeformerEditor.cs.meta │ │ │ ├── UVScaleDeformerEditor.cs │ │ │ ├── UVScaleDeformerEditor.cs.meta │ │ │ ├── Utility.meta │ │ │ ├── Utility │ │ │ │ ├── AutoGroupDeformerEditor.cs │ │ │ │ ├── AutoGroupDeformerEditor.cs.meta │ │ │ │ ├── GroupDeformerEditor.cs │ │ │ │ ├── GroupDeformerEditor.cs.meta │ │ │ │ ├── RepeaterDeformerEditor.cs │ │ │ │ └── RepeaterDeformerEditor.cs.meta │ │ │ ├── WaveDeformerEditor.cs │ │ │ └── WaveDeformerEditor.cs.meta │ │ ├── ElasticDeformableEditor.cs │ │ └── ElasticDeformableEditor.cs.meta │ ├── PropertyDrawers.meta │ └── PropertyDrawers │ │ ├── DeformerElementPropertyDrawer.cs │ │ ├── DeformerElementPropertyDrawer.cs.meta │ │ ├── DisplayNameDrawer.cs │ │ └── DisplayNameDrawer.cs.meta ├── External.meta ├── External │ ├── Common.meta │ └── Common │ │ ├── Beans.Unity.Collections.meta │ │ ├── Beans.Unity.Collections │ │ ├── Beans.Unity.Collections.asmdef │ │ ├── Beans.Unity.Collections.asmdef.meta │ │ ├── NativeArrayx.cs │ │ └── NativeArrayx.cs.meta │ │ ├── Beans.Unity.Editor.meta │ │ ├── Beans.Unity.Editor │ │ ├── Editor.meta │ │ └── Editor │ │ │ ├── Beans.Unity.Editor.asmdef │ │ │ ├── Beans.Unity.Editor.asmdef.meta │ │ │ ├── EditorChangeScope.cs │ │ │ ├── EditorChangeScope.cs.meta │ │ │ ├── EditorGUILayoutx.cs │ │ │ ├── EditorGUILayoutx.cs.meta │ │ │ ├── EditorGUIUtilityx.cs │ │ │ ├── EditorGUIUtilityx.cs.meta │ │ │ ├── EditorGUIx.cs │ │ │ ├── EditorGUIx.cs.meta │ │ │ ├── Editorx.cs │ │ │ ├── Editorx.cs.meta │ │ │ ├── Handles.meta │ │ │ └── Handles │ │ │ ├── VerticalBoundsHandle.cs │ │ │ └── VerticalBoundsHandle.cs.meta │ │ ├── Beans.Unity.Mathematics.meta │ │ └── Beans.Unity.Mathematics │ │ ├── Beans.Unity.Mathematics.asmdef │ │ ├── Beans.Unity.Mathematics.asmdef.meta │ │ ├── bounds.cs │ │ ├── bounds.cs.meta │ │ ├── mathx.cs │ │ └── mathx.cs.meta ├── Runtime.meta └── Runtime │ ├── Core.meta │ ├── Core │ ├── DeformableManager.cs │ ├── DeformableManager.cs.meta │ ├── DeformerAttribute.cs │ ├── DeformerAttribute.cs.meta │ ├── Interfaces.meta │ └── Interfaces │ │ ├── IData.cs │ │ ├── IData.cs.meta │ │ ├── IDeformable.cs │ │ ├── IDeformable.cs.meta │ │ ├── IDeformer.cs │ │ └── IDeformer.cs.meta │ ├── Data.meta │ ├── Data │ ├── CollapsibleSection.cs │ ├── CollapsibleSection.cs.meta │ ├── DisplayNameAttribute.cs │ ├── DisplayNameAttribute.cs.meta │ ├── Interfaces.meta │ ├── Interfaces │ │ ├── IComponentElement.cs │ │ └── IComponentElement.cs.meta │ ├── NativeCurve.cs │ ├── NativeCurve.cs.meta │ ├── NativeTexture2D.cs │ └── NativeTexture2D.cs.meta │ ├── Deform.asmdef │ ├── Deform.asmdef.meta │ ├── Enums.meta │ ├── Enums │ ├── Axis.cs │ ├── Axis.cs.meta │ ├── BoundsMode.cs │ ├── BoundsMode.cs.meta │ ├── BoundsRecalculation.cs │ ├── BoundsRecalculation.cs.meta │ ├── ColliderRecalculation.cs │ ├── ColliderRecalculation.cs.meta │ ├── CullingMode.cs │ ├── CullingMode.cs.meta │ ├── NoiseMode.cs │ ├── NoiseMode.cs.meta │ ├── NormalsRecalculation.cs │ ├── NormalsRecalculation.cs.meta │ ├── StripMode.cs │ ├── StripMode.cs.meta │ ├── TextureSampleSpace.cs │ ├── TextureSampleSpace.cs.meta │ ├── UpdateMode.cs │ └── UpdateMode.cs.meta │ ├── Mesh.meta │ └── Mesh │ ├── Data.meta │ ├── Data │ ├── DeformerElement.cs │ ├── DeformerElement.cs.meta │ ├── Enums.meta │ ├── Enums │ │ ├── ColorChannel.cs │ │ ├── ColorChannel.cs.meta │ │ ├── DataFlags.cs │ │ ├── DataFlags.cs.meta │ │ ├── UpdateFrequency.cs │ │ └── UpdateFrequency.cs.meta │ ├── ManagedMeshData.cs │ ├── ManagedMeshData.cs.meta │ ├── MeshData.cs │ ├── MeshData.cs.meta │ ├── MeshTarget.cs │ ├── MeshTarget.cs.meta │ ├── NativeMeshData.cs │ ├── NativeMeshData.cs.meta │ ├── VertexCache.cs │ └── VertexCache.cs.meta │ ├── Deformable.cs │ ├── Deformable.cs.meta │ ├── Deformer.cs │ ├── Deformer.cs.meta │ ├── Deformers.meta │ ├── Deformers │ ├── BendDeformer.cs │ ├── BendDeformer.cs.meta │ ├── BlendDeformer.cs │ ├── BlendDeformer.cs.meta │ ├── BoundedBendDeformer.cs │ ├── BoundedBendDeformer.cs.meta │ ├── BulgeDeformer.cs │ ├── BulgeDeformer.cs.meta │ ├── CubifyDeformer.cs │ ├── CubifyDeformer.cs.meta │ ├── CurveDisplaceDeformer.cs │ ├── CurveDisplaceDeformer.cs.meta │ ├── CurveScaleDeformer.cs │ ├── CurveScaleDeformer.cs.meta │ ├── CylindrifyDeformer.cs │ ├── CylindrifyDeformer.cs.meta │ ├── InflateDeformer.cs │ ├── InflateDeformer.cs.meta │ ├── Interfaces.meta │ ├── Interfaces │ │ ├── IFactor.cs │ │ └── IFactor.cs.meta │ ├── LatheDisplaceDeformer.cs │ ├── LatheDisplaceDeformer.cs.meta │ ├── LatticeDeformer.cs │ ├── LatticeDeformer.cs.meta │ ├── MagnetDeformer.cs │ ├── MagnetDeformer.cs.meta │ ├── Masking.meta │ ├── Masking │ │ ├── MaskState.cs │ │ ├── MaskState.cs.meta │ │ ├── Masks.meta │ │ └── Masks │ │ │ ├── BoxMask.cs │ │ │ ├── BoxMask.cs.meta │ │ │ ├── SphereMask.cs │ │ │ ├── SphereMask.cs.meta │ │ │ ├── VertexColorMask.cs │ │ │ ├── VertexColorMask.cs.meta │ │ │ ├── VerticalGradientMask.cs │ │ │ └── VerticalGradientMask.cs.meta │ ├── MeltDeformer.cs │ ├── MeltDeformer.cs.meta │ ├── Noise.meta │ ├── Noise │ │ ├── CellularNoiseDeformer.cs │ │ ├── CellularNoiseDeformer.cs.meta │ │ ├── NoiseDeformer.cs │ │ ├── NoiseDeformer.cs.meta │ │ ├── PerlinNoiseDeformer.cs │ │ ├── PerlinNoiseDeformer.cs.meta │ │ ├── SimplexNoiseDeformer.cs │ │ └── SimplexNoiseDeformer.cs.meta │ ├── RadialCurveDeformer.cs │ ├── RadialCurveDeformer.cs.meta │ ├── RadialSkewDeformer.cs │ ├── RadialSkewDeformer.cs.meta │ ├── RippleDeformer.cs │ ├── RippleDeformer.cs.meta │ ├── ScaleDeformer.cs │ ├── ScaleDeformer.cs.meta │ ├── SineDeformer.cs │ ├── SineDeformer.cs.meta │ ├── SkewDeformer.cs │ ├── SkewDeformer.cs.meta │ ├── SpherifyDeformer.cs │ ├── SpherifyDeformer.cs.meta │ ├── SquashAndStretchDeformer.cs │ ├── SquashAndStretchDeformer.cs.meta │ ├── StarDeformer.cs │ ├── StarDeformer.cs.meta │ ├── TaperDeformer.cs │ ├── TaperDeformer.cs.meta │ ├── TextureDisplaceDeformer.cs │ ├── TextureDisplaceDeformer.cs.meta │ ├── TransformDeformer.cs │ ├── TransformDeformer.cs.meta │ ├── TransformOffsetDeformer.cs │ ├── TransformOffsetDeformer.cs.meta │ ├── TwirlDeformer.cs │ ├── TwirlDeformer.cs.meta │ ├── TwistDeformer.cs │ ├── TwistDeformer.cs.meta │ ├── UVOffsetDeformer.cs │ ├── UVOffsetDeformer.cs.meta │ ├── UVScaleDeformer.cs │ ├── UVScaleDeformer.cs.meta │ ├── Utility.meta │ ├── Utility │ │ ├── AutoGroupDeformer.cs │ │ ├── AutoGroupDeformer.cs.meta │ │ ├── GroupDeformer.cs │ │ ├── GroupDeformer.cs.meta │ │ ├── RecalculateBoundsDeformer.cs │ │ ├── RecalculateBoundsDeformer.cs.meta │ │ ├── RecalculateNormalsDeformer.cs │ │ ├── RecalculateNormalsDeformer.cs.meta │ │ ├── RepeaterDeformer.cs │ │ └── RepeaterDeformer.cs.meta │ ├── WaveDeformer.cs │ └── WaveDeformer.cs.meta │ ├── ElasticDeformable.cs │ ├── ElasticDeformable.cs.meta │ ├── IO.meta │ ├── IO │ ├── ObjExporter.cs │ └── ObjExporter.cs.meta │ ├── Utility.meta │ └── Utility │ ├── DataUtils.cs │ ├── DataUtils.cs.meta │ ├── DeformerUtils.cs │ ├── DeformerUtils.cs.meta │ ├── Jobs.meta │ ├── Jobs │ ├── AddFloat3ToFloat3sJob.cs │ ├── AddFloat3ToFloat3sJob.cs.meta │ ├── AddTriangleNormalToNormalsJob.cs │ ├── AddTriangleNormalToNormalsJob.cs.meta │ ├── CopyFloat3sJob.cs │ ├── CopyFloat3sJob.cs.meta │ ├── ElasticPointsUpdateJob.cs │ ├── ElasticPointsUpdateJob.cs.meta │ ├── NormalizeNormalsJob.cs │ ├── NormalizeNormalsJob.cs.meta │ ├── RecalculateBoundsJob.cs │ ├── RecalculateBoundsJob.cs.meta │ ├── ResetNormalsJob.cs │ ├── ResetNormalsJob.cs.meta │ ├── TransformPointsFromJob.cs │ ├── TransformPointsFromJob.cs.meta │ ├── TransformPointsJob.cs │ └── TransformPointsJob.cs.meta │ ├── MeshUtils.cs │ └── MeshUtils.cs.meta ├── EditorResources.meta ├── EditorResources ├── DeformSettings.asset ├── DeformSettings.asset.meta ├── Materials.meta ├── Materials │ ├── DeformDefaultMaterial.mat │ └── DeformDefaultMaterial.mat.meta ├── Meshes.meta ├── Meshes │ ├── DeformDefaultMesh.fbx │ └── DeformDefaultMesh.fbx.meta ├── Styles.meta ├── Styles │ ├── DeformPersonal.guiskin │ ├── DeformPersonal.guiskin.meta │ ├── DeformProfessional.guiskin │ └── DeformProfessional.guiskin.meta ├── Textures.meta └── Textures │ ├── DeformDefaultTexture.png │ ├── DeformDefaultTexture.png.meta │ ├── External.meta │ ├── External │ ├── MaterialDesign.meta │ └── MaterialDesign │ │ ├── LICENSE.txt │ │ ├── LICENSE.txt.meta │ │ ├── VisibilityOffDark.png │ │ ├── VisibilityOffDark.png.meta │ │ ├── VisibilityOffLight.png │ │ ├── VisibilityOffLight.png.meta │ │ ├── VisibilityOnDark.png │ │ ├── VisibilityOnDark.png.meta │ │ ├── VisibilityOnLight.png │ │ └── VisibilityOnLight.png.meta │ ├── Styles.meta │ └── Styles │ ├── BoxDark.png │ ├── BoxDark.png.meta │ ├── BoxLight.png │ ├── BoxLight.png.meta │ ├── Record.png │ └── Record.png.meta ├── LICENSE.txt ├── LICENSE.txt.meta ├── README.txt ├── README.txt.meta ├── package.json └── package.json.meta /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | - OS: [e.g. Windows 10] 27 | - Unity: [e.g 2019.2.6] 28 | - Deform version: [e.g 1.0.3] 29 | 30 | **Additional context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /.github/images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/.github/images/banner.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Visual Studio cache directory 9 | .vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | *.opendb 26 | 27 | # Unity3D generated meta files 28 | *.pidb.meta 29 | *.pdb.meta 30 | 31 | # Unity3D Generated File On Crash Reports 32 | sysinfo.txt 33 | 34 | # Builds 35 | *.apk 36 | *.unitypackage 37 | *.DS_Store 38 | -------------------------------------------------------------------------------- /Code.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ab568e08c3af734bb361b708ac2694b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f629ac0587808274991790275ea8b414 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8e23bf4e78f9144787b0eef163a879b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Core/DeformableManagerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (DeformableManager)), CanEditMultipleObjects] 8 | public class DeformableManagerEditor : Editor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Update = new GUIContent (text: "Update", tooltip: "Should the manager update?"); 13 | } 14 | 15 | private class Properties 16 | { 17 | public SerializedProperty Update; 18 | 19 | public Properties (SerializedObject obj) 20 | { 21 | Update = obj.FindProperty ("update"); 22 | } 23 | } 24 | 25 | private Properties properties; 26 | 27 | private void OnEnable () 28 | { 29 | properties = new Properties (serializedObject); 30 | } 31 | 32 | public override void OnInspectorGUI () 33 | { 34 | serializedObject.UpdateIfRequiredOrScript (); 35 | 36 | EditorGUILayout.PropertyField (properties.Update, Content.Update); 37 | 38 | serializedObject.ApplyModifiedProperties (); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Code/Editor/Core/DeformableManagerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22fc03601b935444ca03c5307c6f62b7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/CreatorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4285705c990c5f745a348d44391c1cc4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/CreditsWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bd1a68bc6078e349b650922ad5da620 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2939bdacb2a307468383cbf20b9a98f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Data/ReorderableComponentElementList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62b049ab207776f47af1fb42c98d5020 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/DeformBuildPostProcessor.cs: -------------------------------------------------------------------------------- 1 | using Deform; 2 | using UnityEditor; 3 | using UnityEditor.Callbacks; 4 | using UnityEngine; 5 | 6 | namespace DeformEditor 7 | { 8 | public enum BuildStrippingMode 9 | { 10 | StripDeformInScenes, 11 | NoStripping, 12 | }; 13 | 14 | public class DeformBuildPostProcessor 15 | { 16 | [PostProcessScene] 17 | public static void OnPostprocessScene() 18 | { 19 | var deformables = Resources.FindObjectsOfTypeAll(); 20 | foreach (var deformable in deformables) 21 | { 22 | if (deformable.StripMode == StripMode.DontStrip) 23 | continue; 24 | 25 | deformable.assignOriginalMeshOnDisable = false; 26 | 27 | var go = deformable.gameObject; 28 | // Is it an ordinary scene object? 29 | if (!EditorUtility.IsPersistent(go.transform.root.gameObject) && !(go.hideFlags == HideFlags.NotEditable || go.hideFlags == HideFlags.HideAndDontSave)) 30 | { 31 | Object.DestroyImmediate(deformable); 32 | } 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Code/Editor/DeformBuildPostProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c592b547d084b92a5afccad88e33274 3 | timeCreated: 1613922158 -------------------------------------------------------------------------------- /Code/Editor/DeformEditor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DeformEditor", 3 | "references": [ 4 | "Beans.Unity.Editor", 5 | "Deform", 6 | "Unity.Mathematics" 7 | ], 8 | "optionalUnityReferences": [], 9 | "includePlatforms": [ 10 | "Editor" 11 | ], 12 | "excludePlatforms": [], 13 | "allowUnsafeCode": false, 14 | "overrideReferences": false, 15 | "precompiledReferences": [], 16 | "autoReferenced": true, 17 | "defineConstraints": [] 18 | } -------------------------------------------------------------------------------- /Code/Editor/DeformEditor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8eedebcb73101994492a80e4cc658d74 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Code/Editor/DeformEditorGUIUtility.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace DeformEditor 5 | { 6 | public static class DeformEditorGUIUtility 7 | { 8 | public static class Strings 9 | { 10 | public static readonly string AxisTooltip = "This is the transform that all the calculations will be relative local to. If left blank, the component's transform will be used.\n-\nAll vertices are converted to a space relative to this transform."; 11 | public static readonly string FactorTooltip = "Strength of the effect."; 12 | public static readonly string FalloffTooltip = "The sharpness of the effects' transition."; 13 | public static readonly string TopTooltip = "Any vertices above this will be unaffected."; 14 | public static readonly string BottomTooltip = "Any vertices below this will be unaffected."; 15 | public static readonly string SmoothTooltip = "Should the strength of this effect be smoothed near the bounds?"; 16 | } 17 | 18 | public static class DefaultContent 19 | { 20 | public static readonly GUIContent Axis = new GUIContent 21 | ( 22 | text: "Axis", 23 | tooltip: Strings.AxisTooltip 24 | ); 25 | public static readonly GUIContent Factor = new GUIContent 26 | ( 27 | text: "Factor", 28 | tooltip: Strings.FactorTooltip 29 | ); 30 | public static readonly GUIContent Falloff = new GUIContent 31 | ( 32 | text: "Falloff", 33 | tooltip: Strings.FalloffTooltip 34 | ); 35 | public static readonly GUIContent Top = new GUIContent 36 | ( 37 | text: "Top", 38 | tooltip: Strings.TopTooltip 39 | ); 40 | public static readonly GUIContent Bottom = new GUIContent 41 | ( 42 | text: "Bottom", 43 | tooltip: Strings.BottomTooltip 44 | ); 45 | public static readonly GUIContent Smooth = new GUIContent 46 | ( 47 | text: "Smooth", 48 | tooltip: Strings.SmoothTooltip 49 | ); 50 | } 51 | 52 | /// 53 | /// Convert a world position to a screen position to be used with GUI 54 | /// 55 | public static Vector3 WorldToGUIPoint(Camera sceneViewCamera, Vector3 worldPosition) 56 | { 57 | Vector3 screenPoint = sceneViewCamera.WorldToScreenPoint(worldPosition); 58 | 59 | // Flip the y position so it matches the rect coordinate space 60 | screenPoint.y = sceneViewCamera.pixelHeight - screenPoint.y; 61 | // Convert from pixels to points (e.g. on retina screens) 62 | screenPoint /= EditorGUIUtility.pixelsPerPoint; 63 | 64 | return screenPoint; 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /Code/Editor/DeformEditorGUIUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23cfd6dfadf5bc64182cdd633a333399 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/DeformEditorResources.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f52641e37ffbfee4bbf3640faf7cec5c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/DeformEditorSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6f41df97449ac244b3fb8df502a7cae 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/DeformEditorSettingsAsset.cs: -------------------------------------------------------------------------------- 1 | using Deform; 2 | using UnityEngine; 3 | 4 | namespace DeformEditor 5 | { 6 | public class DeformEditorSettingsAsset : ScriptableObject 7 | { 8 | [CollapsibleSection("Scene")] 9 | [DisplayName("Solid Color")] public Color solidHandleColor = new Color (1f, 0.4f, 0f, 1f); 10 | [DisplayName("Light Color")] public Color lightHandleColor = new Color (1f, 0.4f, 0f, 0.75f); 11 | [DisplayName("Recording Color")] public Color recordingHandleColor = new Color (1f, 0f, 0f, 0.9f); 12 | public float dottedLineSize = 5f; 13 | [DisplayName("Handle Size")] public float screenspaceHandleCapSize = 0.0275f; 14 | [DisplayName("Angle Handle Size")] public float screenspaceAngleHandleSize = 1.25f; 15 | [DisplayName("Lattice Handle Size")] public float screenspaceLatticeCapSize = 0.035f; 16 | 17 | [CollapsibleSection("Importer")] 18 | public bool modelsReadableByDefault = false; 19 | } 20 | } -------------------------------------------------------------------------------- /Code/Editor/DeformEditorSettingsAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84838e1060cbc4f45a2f463816b2d2fe 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/DeformEditorSettingsAssetInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 712fd566a2714796808abe8a1ff4681d 3 | timeCreated: 1613924572 -------------------------------------------------------------------------------- /Code/Editor/DeformHandles.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a618223751393864db9bdf7bea9bc2ce 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/DeformHandlesUtility.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Deform; 3 | 4 | namespace DeformEditor 5 | { 6 | public static class DeformHandlesUtility 7 | { 8 | /// 9 | /// Returns the distance between two points along a primary transform axis. 10 | /// 11 | public static float DistanceAlongAxis (Transform transform, Vector3 a, Vector3 b, Axis axis) 12 | { 13 | var delta = (Quaternion.Inverse (transform.rotation) * (b - a)); 14 | switch (axis) 15 | { 16 | default: 17 | return delta.x; 18 | case Axis.Y: 19 | return delta.y; 20 | case Axis.Z: 21 | return delta.z; 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Code/Editor/DeformHandlesUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13ebe39dcdce65d458379b1d82e36ddc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/DeformModelPostProcessor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | 3 | namespace DeformEditor 4 | { 5 | public class DeformModelPostProcessor : AssetPostprocessor 6 | { 7 | private void OnPreprocessModel() 8 | { 9 | if (DeformEditorSettings.ModelsReadableByDefault && assetImporter is ModelImporter m) 10 | { 11 | if (m.importSettingsMissing) 12 | m.isReadable = true; 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Code/Editor/DeformModelPostProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6a742a56a27f2d4da0c0b7f05536b4a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/DeformUnityObjectSelection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0d51f534bf242d6bbaa39e929a52cf5 3 | timeCreated: 1613253086 -------------------------------------------------------------------------------- /Code/Editor/MenuItemActions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f19a8e85e05eef488f714947b932d17 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5067e182e58efac4c85676f2ae9e0e0b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1d28bc6dc1df144f9da2141b27fdf54 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Data/VertexCacheCreator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | /// 8 | /// Handles creating vertex caches in the Editor. 9 | /// 10 | public static class VertexCacheCreator 11 | { 12 | /// 13 | /// Returns true if a mesh asset or GameObject is selected that a vertex cache can be created from. 14 | /// 15 | /// 16 | [MenuItem ("Assets/Create/Deform/Vertex Cache", true, 10000)] 17 | private static bool CanValidateVertexCache () 18 | { 19 | var selections = Selection.gameObjects; 20 | 21 | foreach (var selection in selections) 22 | { 23 | var meshFilters = selection.GetComponentsInChildren (); 24 | if (meshFilters != null && meshFilters.Length > 0) 25 | return true; 26 | 27 | var skinnedMeshRenderers = selection.GetComponentsInChildren (); 28 | if (skinnedMeshRenderers != null && skinnedMeshRenderers.Length > 0) 29 | return true; 30 | } 31 | 32 | return false; 33 | } 34 | 35 | /// 36 | /// Creates a vertex cache based on the currently selected mesh asset or gameobject. 37 | /// 38 | [MenuItem ("Assets/Create/Deform/Vertex Cache")] 39 | public static void CreateVertexCache () 40 | { 41 | var selections = Selection.gameObjects; 42 | 43 | foreach (var selection in selections) 44 | { 45 | var meshFilters = selection.GetComponentsInChildren (); 46 | var skinnedMeshRenderers = selection.GetComponentsInChildren (); 47 | 48 | foreach (var mf in meshFilters) 49 | { 50 | var cache = ScriptableObject.CreateInstance (); 51 | cache.Initialize (mf.sharedMesh); 52 | 53 | AssetDatabase.CreateAsset (cache, $"Assets/{mf.name}.asset"); 54 | } 55 | 56 | foreach (var smr in skinnedMeshRenderers) 57 | { 58 | var cache = ScriptableObject.CreateInstance (); 59 | cache.Initialize (smr.sharedMesh); 60 | 61 | AssetDatabase.CreateAsset (cache, $"Assets/{smr.name}.asset"); 62 | } 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Data/VertexCacheCreator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce30d4e52d83cf847839eaa3e9306b66 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Data/VertexCacheEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (VertexCache))] 8 | [CanEditMultipleObjects] 9 | public class VertexCacheEditor : Editor 10 | { 11 | public override void OnInspectorGUI () 12 | { 13 | base.OnInspectorGUI (); 14 | 15 | var firstVertexCache = target as VertexCache; 16 | 17 | var targetsHaveDifferentVertexCount = targets.Any (t => ((VertexCache)t).Data.Vertices.Length != firstVertexCache.Data.Vertices.Length); 18 | 19 | EditorGUI.showMixedValue = targetsHaveDifferentVertexCount; 20 | EditorGUILayout.LabelField ($"Vertex Count: {firstVertexCache.Data.Vertices.Length}"); 21 | EditorGUI.showMixedValue = false; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Data/VertexCacheEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1917b9cad20a82458917dfb09d51f08 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/DeformableEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea27e5d942c6b434a8195f27a7913f07 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/DeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (Deformer), false), CanEditMultipleObjects] 8 | public class DeformerEditor : Editor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Update = new GUIContent (text: "Update"); 13 | } 14 | 15 | private class Properties 16 | { 17 | public SerializedProperty Update; 18 | 19 | public Properties (SerializedObject obj) 20 | { 21 | Update = obj.FindProperty ("update"); 22 | } 23 | } 24 | 25 | private Properties properties; 26 | 27 | protected virtual void OnEnable () 28 | { 29 | properties = new Properties (serializedObject); 30 | } 31 | 32 | public override void OnInspectorGUI () 33 | { 34 | serializedObject.UpdateIfRequiredOrScript (); 35 | 36 | EditorGUILayout.PropertyField (properties.Update, Content.Update); 37 | 38 | serializedObject.ApplyModifiedProperties (); 39 | EditorApplication.QueuePlayerLoopUpdate (); 40 | } 41 | 42 | public virtual void OnSceneGUI () { } 43 | } 44 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/DeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3654d68a8756a0c49acf1b696d66bb97 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 259b58c482bab884f93dd0627d16beea 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/BendDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42b020e8b4018f248bb26e6fa52afc46 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/BlendDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | using Beans.Unity.Editor; 5 | 6 | namespace DeformEditor 7 | { 8 | [CustomEditor (typeof (BlendDeformer)), CanEditMultipleObjects] 9 | public class BlendDeformerEditor : DeformerEditor 10 | { 11 | private static class Content 12 | { 13 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 14 | public static readonly GUIContent Cache = new GUIContent (text: "Cache", tooltip: "The vertex cache to blend towards. It must have the same vertex count as the deformable."); 15 | } 16 | 17 | private class Properties 18 | { 19 | public SerializedProperty Factor; 20 | public SerializedProperty Cache; 21 | 22 | public Properties (SerializedObject obj) 23 | { 24 | Factor = obj.FindProperty ("factor"); 25 | Cache = obj.FindProperty ("cache"); 26 | } 27 | } 28 | 29 | Properties properties; 30 | 31 | protected override void OnEnable () 32 | { 33 | base.OnEnable (); 34 | properties = new Properties (serializedObject); 35 | } 36 | 37 | public override void OnInspectorGUI () 38 | { 39 | base.OnInspectorGUI (); 40 | 41 | serializedObject.UpdateIfRequiredOrScript (); 42 | 43 | UnityEditor.EditorGUILayout.Slider (properties.Factor, 0f, 1f, Content.Factor); 44 | 45 | using (var check = new UnityEditor.EditorGUI.ChangeCheckScope ()) 46 | { 47 | UnityEditor.EditorGUILayout.ObjectField (properties.Cache, Content.Cache); 48 | if (check.changed) 49 | { 50 | // need to apply properties early if the cache was changed so that cache's value change occurs before Initialize() 51 | serializedObject.ApplyModifiedProperties (); 52 | foreach (var t in targets) 53 | ((BlendDeformer)t).Initialize (); 54 | } 55 | } 56 | 57 | serializedObject.ApplyModifiedProperties (); 58 | 59 | EditorApplication.QueuePlayerLoopUpdate (); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/BlendDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11512545e091ff142bd5b986d85278ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/BoundedBendDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4562d8782226229409063ab4eed40058 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/BulgeDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 946b50fe2453b234f874645e88a269d7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/CubifyDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ee5282b793ce644199c8b7635a9e888 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/CurveDisplaceDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (CurveDisplaceDeformer)), CanEditMultipleObjects] 8 | public class CurveDisplaceDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 13 | public static readonly GUIContent Offset = new GUIContent (text: "Offset"); 14 | public static readonly GUIContent Curve = new GUIContent (text: "Curve"); 15 | public static readonly GUIContent Axis = DeformEditorGUIUtility.DefaultContent.Axis; 16 | } 17 | 18 | private class Properties 19 | { 20 | public SerializedProperty Factor; 21 | public SerializedProperty Offset; 22 | public SerializedProperty Curve; 23 | public SerializedProperty Axis; 24 | 25 | public Properties (SerializedObject obj) 26 | { 27 | Factor = obj.FindProperty ("factor"); 28 | Offset = obj.FindProperty ("offset"); 29 | Curve = obj.FindProperty ("curve"); 30 | Axis = obj.FindProperty ("axis"); 31 | } 32 | } 33 | 34 | private Properties properties; 35 | 36 | protected override void OnEnable () 37 | { 38 | base.OnEnable (); 39 | 40 | properties = new Properties (serializedObject); 41 | } 42 | 43 | public override void OnInspectorGUI () 44 | { 45 | base.OnInspectorGUI (); 46 | 47 | serializedObject.UpdateIfRequiredOrScript (); 48 | 49 | EditorGUILayout.PropertyField (properties.Factor, Content.Factor); 50 | EditorGUILayout.PropertyField (properties.Offset, Content.Offset); 51 | EditorGUILayout.PropertyField (properties.Curve, Content.Curve); 52 | EditorGUILayout.PropertyField (properties.Axis, Content.Axis); 53 | 54 | serializedObject.ApplyModifiedProperties (); 55 | 56 | EditorApplication.QueuePlayerLoopUpdate (); 57 | } 58 | 59 | public override void OnSceneGUI () 60 | { 61 | base.OnSceneGUI (); 62 | 63 | var curveDisplace = target as CurveDisplaceDeformer; 64 | 65 | if (curveDisplace.Curve == null || curveDisplace.Curve.length < 1) 66 | return; 67 | DeformHandles.Curve (curveDisplace.Curve, curveDisplace.Axis, curveDisplace.Factor, curveDisplace.Offset, 0f); 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/CurveDisplaceDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 854dbd972d4677246927ca411c9301f1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/CurveScaleDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (CurveScaleDeformer)), CanEditMultipleObjects] 8 | public class CurveScaleDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 13 | public static readonly GUIContent Bias = new GUIContent (text: "Bias"); 14 | public static readonly GUIContent Offset = new GUIContent (text: "Offset"); 15 | public static readonly GUIContent Curve = new GUIContent (text: "Curve"); 16 | public static readonly GUIContent Axis = DeformEditorGUIUtility.DefaultContent.Axis; 17 | } 18 | 19 | private class Properties 20 | { 21 | public SerializedProperty Factor; 22 | public SerializedProperty Bias; 23 | public SerializedProperty Offset; 24 | public SerializedProperty Curve; 25 | public SerializedProperty Axis; 26 | 27 | public Properties (SerializedObject obj) 28 | { 29 | Factor = obj.FindProperty ("factor"); 30 | Bias = obj.FindProperty ("bias"); 31 | Offset = obj.FindProperty ("offset"); 32 | Curve = obj.FindProperty ("curve"); 33 | Axis = obj.FindProperty ("axis"); 34 | } 35 | } 36 | 37 | private Properties properties; 38 | 39 | protected override void OnEnable () 40 | { 41 | base.OnEnable (); 42 | properties = new Properties (serializedObject); 43 | } 44 | 45 | public override void OnInspectorGUI () 46 | { 47 | base.OnInspectorGUI (); 48 | 49 | serializedObject.UpdateIfRequiredOrScript (); 50 | 51 | EditorGUILayout.PropertyField (properties.Factor, Content.Factor); 52 | EditorGUILayout.PropertyField (properties.Bias, Content.Bias); 53 | EditorGUILayout.PropertyField (properties.Offset, Content.Offset); 54 | EditorGUILayout.PropertyField (properties.Curve, Content.Curve); 55 | EditorGUILayout.PropertyField (properties.Axis, Content.Axis); 56 | 57 | serializedObject.ApplyModifiedProperties (); 58 | 59 | EditorApplication.QueuePlayerLoopUpdate (); 60 | } 61 | 62 | public override void OnSceneGUI () 63 | { 64 | base.OnSceneGUI (); 65 | 66 | var curveScale = target as CurveScaleDeformer; 67 | 68 | var handleScale = new Vector3 (1f, 1f, curveScale.Axis.lossyScale.z); 69 | DeformHandles.Curve (curveScale.Curve, curveScale.Axis.position, curveScale.Axis.rotation, handleScale, curveScale.Factor * 0.5f, curveScale.Offset, curveScale.Bias * 0.5f); 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/CurveScaleDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20c761f71d931364793c4a2fa75566c7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/CylindrifyDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 458db85642e33fe488853d3393b4a919 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/InflateDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (InflateDeformer)), CanEditMultipleObjects] 8 | public class InflateDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 13 | public static readonly GUIContent UseUpdatedNormals = new GUIContent (text: "Use Updated Normals", tooltip: "When true, the normals will be recalculated before the vertices are inflated. This is an expensive operation and will result in a split where adjacent triangles don't share vertices."); 14 | } 15 | 16 | private class Properties 17 | { 18 | public SerializedProperty Factor; 19 | public SerializedProperty UseUpdatedNormals; 20 | 21 | public Properties (SerializedObject obj) 22 | { 23 | Factor = obj.FindProperty ("factor"); 24 | UseUpdatedNormals = obj.FindProperty ("useUpdatedNormals"); 25 | } 26 | } 27 | 28 | private Properties properties; 29 | 30 | protected override void OnEnable () 31 | { 32 | base.OnEnable (); 33 | properties = new Properties (serializedObject); 34 | } 35 | 36 | public override void OnInspectorGUI () 37 | { 38 | base.OnInspectorGUI (); 39 | 40 | serializedObject.UpdateIfRequiredOrScript (); 41 | 42 | EditorGUILayout.PropertyField (properties.Factor, Content.Factor); 43 | EditorGUILayout.PropertyField (properties.UseUpdatedNormals, Content.UseUpdatedNormals); 44 | 45 | serializedObject.ApplyModifiedProperties (); 46 | 47 | EditorApplication.QueuePlayerLoopUpdate (); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/InflateDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aef144dabdb2f9b4cb1571fcd6cbcfb1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/LatheDisplaceDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (LatheDisplaceDeformer)), CanEditMultipleObjects] 8 | public class LatheDisplaceDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 13 | public static readonly GUIContent Bias = new GUIContent (text: "Bias"); 14 | public static readonly GUIContent Offset = new GUIContent (text: "Offset"); 15 | public static readonly GUIContent Curve = new GUIContent (text: "Curve"); 16 | public static readonly GUIContent Axis = DeformEditorGUIUtility.DefaultContent.Axis; 17 | } 18 | 19 | private class Properties 20 | { 21 | public SerializedProperty Factor; 22 | public SerializedProperty Bias; 23 | public SerializedProperty Offset; 24 | public SerializedProperty Curve; 25 | public SerializedProperty Axis; 26 | 27 | public Properties (SerializedObject obj) 28 | { 29 | Factor = obj.FindProperty ("factor"); 30 | Bias = obj.FindProperty ("bias"); 31 | Offset = obj.FindProperty ("offset"); 32 | Curve = obj.FindProperty ("curve"); 33 | Axis = obj.FindProperty ("axis"); 34 | } 35 | } 36 | 37 | private Properties properties; 38 | 39 | protected override void OnEnable () 40 | { 41 | base.OnEnable (); 42 | properties = new Properties (serializedObject); 43 | } 44 | 45 | public override void OnInspectorGUI () 46 | { 47 | base.OnInspectorGUI (); 48 | 49 | serializedObject.UpdateIfRequiredOrScript (); 50 | 51 | EditorGUILayout.PropertyField (properties.Factor, Content.Factor); 52 | EditorGUILayout.PropertyField (properties.Bias, Content.Bias); 53 | EditorGUILayout.PropertyField (properties.Offset, Content.Offset); 54 | EditorGUILayout.PropertyField (properties.Curve, Content.Curve); 55 | EditorGUILayout.PropertyField (properties.Axis, Content.Axis); 56 | 57 | serializedObject.ApplyModifiedProperties (); 58 | 59 | EditorApplication.QueuePlayerLoopUpdate (); 60 | } 61 | 62 | public override void OnSceneGUI () 63 | { 64 | base.OnSceneGUI (); 65 | 66 | var lathe = target as LatheDisplaceDeformer; 67 | 68 | DeformHandles.Curve (lathe.Curve, lathe.Axis, lathe.Factor * 0.5f, lathe.Offset, lathe.Bias * 0.5f); 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/LatheDisplaceDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95a0f8b3c2326a44391c0a318983fc3c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/LatticeDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b77dcb044ea84a9f9407ca0f2b9a15a3 3 | timeCreated: 1611788559 -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/MagnetDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Beans.Unity.Editor; 4 | using Deform; 5 | 6 | namespace DeformEditor 7 | { 8 | [CustomEditor (typeof (MagnetDeformer)), CanEditMultipleObjects] 9 | public class MagnetDeformerEditor : DeformerEditor 10 | { 11 | private static class Content 12 | { 13 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 14 | public static readonly GUIContent Falloff = new GUIContent (text: "Falloff", tooltip: "The sharpness of the effect's transition."); 15 | public static readonly GUIContent Center = new GUIContent (text: "Center", tooltip:DeformEditorGUIUtility.Strings.AxisTooltip); 16 | } 17 | 18 | private class Properties 19 | { 20 | public SerializedProperty Factor; 21 | public SerializedProperty Falloff; 22 | public SerializedProperty Center; 23 | 24 | public Properties (SerializedObject obj) 25 | { 26 | Factor = obj.FindProperty ("factor"); 27 | Falloff = obj.FindProperty ("falloff"); 28 | Center = obj.FindProperty ("center"); 29 | } 30 | } 31 | 32 | private Properties properties; 33 | 34 | protected override void OnEnable () 35 | { 36 | base.OnEnable (); 37 | properties = new Properties (serializedObject); 38 | } 39 | 40 | public override void OnInspectorGUI () 41 | { 42 | base.OnInspectorGUI (); 43 | 44 | serializedObject.UpdateIfRequiredOrScript (); 45 | 46 | EditorGUILayout.PropertyField (properties.Factor, Content.Factor); 47 | EditorGUILayoutx.MinField (properties.Falloff, 0f, Content.Falloff); 48 | EditorGUILayout.PropertyField (properties.Center, Content.Center); 49 | 50 | serializedObject.ApplyModifiedProperties (); 51 | 52 | EditorApplication.QueuePlayerLoopUpdate (); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/MagnetDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f365de2e47265484199408d9917665b5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Masking.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd89931157130e44882090cb6e512eae 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Masking/Masks.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d964228ca463c664cafab531da60a547 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Masking/Masks/BoxMaskEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07641f8e2fa04264883561cf714676b9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Masking/Masks/SphereMaskEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e91177af36100140b5b9aa283e38403 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Masking/Masks/VertexColorMaskEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Beans.Unity.Editor; 4 | using Deform.Masking; 5 | 6 | namespace DeformEditor.Masking 7 | { 8 | [CustomEditor (typeof (VertexColorMask)), CanEditMultipleObjects] 9 | public class VertexColorMaskEditor : DeformerEditor 10 | { 11 | private static class Content 12 | { 13 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 14 | public static readonly GUIContent Falloff = DeformEditorGUIUtility.DefaultContent.Falloff; 15 | public static readonly GUIContent Invert = new GUIContent (text: "Invert"); 16 | public static readonly GUIContent Channel = new GUIContent (text: "Channel"); 17 | } 18 | 19 | private class Properties 20 | { 21 | public SerializedProperty Factor; 22 | public SerializedProperty Falloff; 23 | public SerializedProperty Invert; 24 | public SerializedProperty Channel; 25 | 26 | public Properties (SerializedObject obj) 27 | { 28 | Factor = obj.FindProperty ("factor"); 29 | Falloff = obj.FindProperty ("falloff"); 30 | Invert = obj.FindProperty ("invert"); 31 | Channel = obj.FindProperty ("channel"); 32 | } 33 | } 34 | 35 | private Properties properties; 36 | 37 | protected override void OnEnable () 38 | { 39 | base.OnEnable (); 40 | properties = new Properties (serializedObject); 41 | } 42 | 43 | public override void OnInspectorGUI () 44 | { 45 | base.OnInspectorGUI (); 46 | 47 | serializedObject.UpdateIfRequiredOrScript (); 48 | 49 | EditorGUILayout.Slider (properties.Factor, 0f, 1f, Content.Factor); 50 | EditorGUILayoutx.MinField (properties.Falloff, 0f, Content.Falloff); 51 | EditorGUILayout.PropertyField (properties.Invert, Content.Invert); 52 | EditorGUILayout.PropertyField (properties.Channel, Content.Channel); 53 | 54 | serializedObject.ApplyModifiedProperties (); 55 | 56 | EditorApplication.QueuePlayerLoopUpdate (); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Masking/Masks/VertexColorMaskEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de9725ecc0cd4994abba096f58f0d9fa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Masking/Masks/VerticalGradientMaskEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Beans.Unity.Editor; 4 | using Deform.Masking; 5 | 6 | namespace DeformEditor.Masking 7 | { 8 | [CustomEditor (typeof (VerticalGradientMask)), CanEditMultipleObjects] 9 | public class VerticalGradientMaskEditor : DeformerEditor 10 | { 11 | private static class Content 12 | { 13 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 14 | public static readonly GUIContent Falloff = DeformEditorGUIUtility.DefaultContent.Falloff; 15 | public static readonly GUIContent Invert = new GUIContent (text: "Invert"); 16 | public static readonly GUIContent Axis = DeformEditorGUIUtility.DefaultContent.Axis; 17 | } 18 | 19 | private class Properties 20 | { 21 | public SerializedProperty Factor; 22 | public SerializedProperty Falloff; 23 | public SerializedProperty Invert; 24 | public SerializedProperty Axis; 25 | 26 | public Properties (SerializedObject obj) 27 | { 28 | Factor = obj.FindProperty ("factor"); 29 | Falloff = obj.FindProperty ("falloff"); 30 | Invert = obj.FindProperty ("invert"); 31 | Axis = obj.FindProperty ("axis"); 32 | } 33 | } 34 | 35 | private Properties properties; 36 | 37 | protected override void OnEnable () 38 | { 39 | base.OnEnable (); 40 | properties = new Properties (serializedObject); 41 | } 42 | 43 | public override void OnInspectorGUI () 44 | { 45 | base.OnInspectorGUI (); 46 | 47 | serializedObject.UpdateIfRequiredOrScript (); 48 | 49 | EditorGUILayout.Slider (properties.Factor, 0f, 1f, Content.Factor); 50 | EditorGUILayoutx.MinField (properties.Falloff, 0f, Content.Falloff); 51 | EditorGUILayout.PropertyField (properties.Invert, Content.Invert); 52 | EditorGUILayout.PropertyField (properties.Axis, Content.Axis); 53 | 54 | serializedObject.ApplyModifiedProperties (); 55 | 56 | EditorApplication.QueuePlayerLoopUpdate (); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Masking/Masks/VerticalGradientMaskEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e107b5e56e2a15e4ebb14971bbb13b06 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/MeltDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 601f0ed525cf9b340a5ec6e1d7538755 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Noise.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79beb0e2ea584794a90e89bd7105bdf8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Noise/CellularNoiseDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (CellularNoiseDeformer)), CanEditMultipleObjects] 8 | public class CellularNoiseDeformerEditor : NoiseDeformerEditor 9 | { 10 | protected override void OnEnable () 11 | { 12 | base.OnEnable (); 13 | 14 | drawOffsetVectorOverride = DrawVector4PropertyAsVector3; 15 | drawOffsetSpeedVectorOverride = DrawVector4PropertyAsVector3; 16 | } 17 | 18 | public override void OnInspectorGUI () 19 | { 20 | base.OnInspectorGUI (); 21 | } 22 | 23 | private void DrawVector4PropertyAsVector3 (SerializedProperty property, GUIContent defaultContent) 24 | { 25 | using (var check = new EditorGUI.ChangeCheckScope ()) 26 | { 27 | var newVector = EditorGUILayout.Vector3Field (defaultContent, property.vector4Value); 28 | if (check.changed) 29 | property.vector4Value = newVector; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Noise/CellularNoiseDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 099c71d011d4b294883ba1358d5a992a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Noise/NoiseDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fb8c7c2e10780f4e8435e47e9df61b0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Noise/PerlinNoiseDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using Deform; 3 | 4 | namespace DeformEditor 5 | { 6 | [CustomEditor (typeof (PerlinNoiseDeformer)), CanEditMultipleObjects] 7 | public class PerlinNoiseDeformerEditor : NoiseDeformerEditor 8 | { 9 | public override void OnInspectorGUI () => base.OnInspectorGUI (); 10 | } 11 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Noise/PerlinNoiseDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf958626218e2a043b96bdf5ac42a02c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Noise/SimplexNoiseDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using Deform; 3 | 4 | namespace DeformEditor 5 | { 6 | [CustomEditor (typeof (SimplexNoiseDeformer)), CanEditMultipleObjects] 7 | public class SimplexNoiseDeformerEditor : NoiseDeformerEditor 8 | { 9 | public override void OnInspectorGUI () => base.OnInspectorGUI (); 10 | } 11 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Noise/SimplexNoiseDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1974a47593151f43bdfa38ca88aa3ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/RadialCurveDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Beans.Unity.Editor; 4 | using Deform; 5 | 6 | namespace DeformEditor 7 | { 8 | [CustomEditor (typeof (RadialCurveDeformer)), CanEditMultipleObjects] 9 | public class RadialCurveDeformerEditor : DeformerEditor 10 | { 11 | private static class Content 12 | { 13 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 14 | public static readonly GUIContent Offset = new GUIContent (text: "Offset"); 15 | public static readonly GUIContent Falloff = DeformEditorGUIUtility.DefaultContent.Falloff; 16 | public static readonly GUIContent Curve = new GUIContent (text: "Curve"); 17 | public static readonly GUIContent Axis = DeformEditorGUIUtility.DefaultContent.Axis; 18 | } 19 | 20 | private class Properties 21 | { 22 | public SerializedProperty Factor; 23 | public SerializedProperty Offset; 24 | public SerializedProperty Falloff; 25 | public SerializedProperty Curve; 26 | public SerializedProperty Axis; 27 | 28 | public Properties (SerializedObject obj) 29 | { 30 | Factor = obj.FindProperty ("factor"); 31 | Offset = obj.FindProperty ("offset"); 32 | Falloff = obj.FindProperty ("falloff"); 33 | Curve = obj.FindProperty ("curve"); 34 | Axis = obj.FindProperty ("axis"); 35 | } 36 | } 37 | 38 | private Properties properties; 39 | 40 | protected override void OnEnable () 41 | { 42 | base.OnEnable (); 43 | properties = new Properties (serializedObject); 44 | } 45 | 46 | public override void OnInspectorGUI () 47 | { 48 | base.OnInspectorGUI (); 49 | 50 | serializedObject.UpdateIfRequiredOrScript (); 51 | 52 | EditorGUILayout.PropertyField (properties.Factor, Content.Factor); 53 | EditorGUILayout.PropertyField (properties.Offset, Content.Offset); 54 | EditorGUILayoutx.MinField (properties.Falloff, 0f, Content.Falloff); 55 | EditorGUILayout.PropertyField (properties.Curve, Content.Curve); 56 | EditorGUILayout.PropertyField (properties.Axis, Content.Axis); 57 | 58 | serializedObject.ApplyModifiedProperties (); 59 | 60 | EditorApplication.QueuePlayerLoopUpdate (); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/RadialCurveDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27a7eb8a387d31949b0027ad45eac311 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/RadialSkewDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd90e8a45a2946b4cba99967d1c530e5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/RippleDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e19269ad081089144b1b61541685062d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/ScaleDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (ScaleDeformer))] 8 | public class ScaleDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Axis = DeformEditorGUIUtility.DefaultContent.Axis; 13 | } 14 | 15 | private class Properties 16 | { 17 | public SerializedProperty Axis; 18 | 19 | public Properties (SerializedObject obj) 20 | { 21 | Axis = obj.FindProperty ("axis"); 22 | } 23 | } 24 | 25 | private Properties properties; 26 | 27 | protected override void OnEnable () 28 | { 29 | base.OnEnable (); 30 | properties = new Properties (serializedObject); 31 | } 32 | 33 | public override void OnInspectorGUI () 34 | { 35 | base.OnInspectorGUI (); 36 | 37 | serializedObject.UpdateIfRequiredOrScript (); 38 | 39 | EditorGUILayout.PropertyField (properties.Axis, Content.Axis); 40 | 41 | serializedObject.ApplyModifiedProperties (); 42 | 43 | EditorApplication.QueuePlayerLoopUpdate (); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/ScaleDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dbd6a90ffcd0eaf4d8a0707769ec9d66 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/SineDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 847ec53de1be9344780fafbcbe084981 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/SkewDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 640e374c3b19007478e39961a75572a2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/SpherifyDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77510b7b5ef6fb04698aa0ff5655febe 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/SquashAndStretchDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b9c9c2a61010c148b1f0937b005105f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/StarDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (StarDeformer)), CanEditMultipleObjects] 8 | public class StarDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Frequency = new GUIContent (text: "Frequency", tooltip: "Number of crests and troughs per unit."); 13 | public static readonly GUIContent Magnitude = new GUIContent (text: "Magnitude", tooltip: "The strength of the wave."); 14 | public static readonly GUIContent Offset = new GUIContent (text: "Offset", tooltip: "The phase shift of the wave."); 15 | public static readonly GUIContent Speed = new GUIContent (text: "Speed", tooltip: "How much the phase shift changes per second."); 16 | public static readonly GUIContent Axis = DeformEditorGUIUtility.DefaultContent.Axis; 17 | } 18 | 19 | private class Properties 20 | { 21 | public SerializedProperty Frequency; 22 | public SerializedProperty Magnitude; 23 | public SerializedProperty Offset; 24 | public SerializedProperty Speed; 25 | public SerializedProperty Axis; 26 | 27 | public Properties (SerializedObject obj) 28 | { 29 | Frequency = obj.FindProperty ("frequency"); 30 | Magnitude = obj.FindProperty ("magnitude"); 31 | Offset = obj.FindProperty ("offset"); 32 | Speed = obj.FindProperty ("speed"); 33 | Axis = obj.FindProperty ("axis"); 34 | } 35 | } 36 | 37 | private Properties properties; 38 | 39 | protected override void OnEnable () 40 | { 41 | base.OnEnable (); 42 | properties = new Properties (serializedObject); 43 | } 44 | 45 | public override void OnInspectorGUI () 46 | { 47 | base.OnInspectorGUI (); 48 | 49 | serializedObject.UpdateIfRequiredOrScript (); 50 | 51 | EditorGUILayout.PropertyField (properties.Frequency, Content.Frequency); 52 | EditorGUILayout.PropertyField (properties.Magnitude, Content.Magnitude); 53 | EditorGUILayout.PropertyField (properties.Offset, Content.Offset); 54 | EditorGUILayout.PropertyField (properties.Speed, Content.Speed); 55 | EditorGUILayout.PropertyField (properties.Axis, Content.Axis); 56 | 57 | serializedObject.ApplyModifiedProperties (); 58 | 59 | EditorApplication.QueuePlayerLoopUpdate (); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/StarDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0a8becc7558d75489eaf29021eaecb6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/TaperDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93a12d51ba13f134db224866bf91de20 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/TextureDisplaceDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 792d6b5132f69d24687aa5a48400ad02 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/TransformDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (TransformDeformer)), CanEditMultipleObjects] 8 | public class TransformDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Target = new GUIContent (text: "Target", tooltip: "The target transform will basically replace the mesh transform. This is handy for changing the pivot of the mesh."); 13 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 14 | } 15 | 16 | private class Properties 17 | { 18 | public SerializedProperty Target; 19 | public SerializedProperty Factor; 20 | 21 | public Properties (SerializedObject obj) 22 | { 23 | Target = obj.FindProperty ("target"); 24 | Factor = obj.FindProperty("factor"); 25 | } 26 | } 27 | 28 | private Properties properties; 29 | 30 | protected override void OnEnable () 31 | { 32 | base.OnEnable (); 33 | properties = new Properties (serializedObject); 34 | } 35 | 36 | public override void OnInspectorGUI () 37 | { 38 | base.OnInspectorGUI (); 39 | 40 | serializedObject.UpdateIfRequiredOrScript (); 41 | 42 | EditorGUILayout.PropertyField (properties.Target, Content.Target); 43 | EditorGUILayout.PropertyField(properties.Factor, Content.Factor); 44 | 45 | serializedObject.ApplyModifiedProperties (); 46 | 47 | EditorApplication.QueuePlayerLoopUpdate (); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/TransformDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa0c60e82c10d8d4fa9a4470b42a4fe0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/TransformOffsetDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (TransformOffsetDeformer)), CanEditMultipleObjects] 8 | public class TransformOffsetDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Target = new GUIContent (text: "Target", tooltip: "The target transform's position, rotation and scale will be added to the deformable's mesh."); 13 | } 14 | 15 | private class Properties 16 | { 17 | public SerializedProperty Target; 18 | 19 | public Properties (SerializedObject obj) 20 | { 21 | Target = obj.FindProperty ("target"); 22 | } 23 | } 24 | 25 | private Properties properties; 26 | 27 | protected override void OnEnable () 28 | { 29 | base.OnEnable (); 30 | properties = new Properties (serializedObject); 31 | } 32 | 33 | public override void OnInspectorGUI () 34 | { 35 | base.OnInspectorGUI (); 36 | 37 | serializedObject.UpdateIfRequiredOrScript (); 38 | 39 | EditorGUILayout.PropertyField (properties.Target, Content.Target); 40 | 41 | serializedObject.ApplyModifiedProperties (); 42 | 43 | EditorApplication.QueuePlayerLoopUpdate (); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/TransformOffsetDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d480360d3bfe05240aba2d3e4597e2b3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/TwirlDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37fd0b71592e07f42b2329fe9801af16 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/TwistDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c77044d1951ae3448a79cae4a85b7c8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/UVOffsetDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (UVOffsetDeformer)), CanEditMultipleObjects] 8 | public class UVOffsetDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Offset = new GUIContent (text: "Offset"); 13 | } 14 | 15 | private class Properties 16 | { 17 | public SerializedProperty Offset; 18 | 19 | public Properties (SerializedObject obj) 20 | { 21 | Offset = obj.FindProperty ("offset"); 22 | } 23 | } 24 | 25 | private Properties properties; 26 | 27 | protected override void OnEnable () 28 | { 29 | base.OnEnable (); 30 | properties = new Properties (serializedObject); 31 | } 32 | 33 | public override void OnInspectorGUI () 34 | { 35 | base.OnInspectorGUI (); 36 | 37 | serializedObject.UpdateIfRequiredOrScript (); 38 | 39 | EditorGUILayout.PropertyField (properties.Offset, Content.Offset); 40 | 41 | serializedObject.ApplyModifiedProperties (); 42 | 43 | EditorApplication.QueuePlayerLoopUpdate (); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/UVOffsetDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c9a4c9523ee24146ac226c166b1b065 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/UVScaleDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomEditor (typeof (UVScaleDeformer)), CanEditMultipleObjects] 8 | public class UVScaleDeformerEditor : DeformerEditor 9 | { 10 | private static class Content 11 | { 12 | public static readonly GUIContent Factor = DeformEditorGUIUtility.DefaultContent.Factor; 13 | public static readonly GUIContent Scale = new GUIContent (text: "Scale"); 14 | } 15 | 16 | private class Properties 17 | { 18 | public SerializedProperty Factor; 19 | public SerializedProperty Scale; 20 | 21 | public Properties (SerializedObject obj) 22 | { 23 | Factor = obj.FindProperty ("factor"); 24 | Scale = obj.FindProperty ("scale"); 25 | } 26 | } 27 | 28 | private Properties properties; 29 | 30 | protected override void OnEnable () 31 | { 32 | base.OnEnable (); 33 | properties = new Properties (serializedObject); 34 | } 35 | 36 | public override void OnInspectorGUI () 37 | { 38 | base.OnInspectorGUI (); 39 | 40 | serializedObject.UpdateIfRequiredOrScript (); 41 | 42 | EditorGUILayout.PropertyField (properties.Factor, Content.Factor); 43 | EditorGUILayout.PropertyField (properties.Scale, Content.Scale); 44 | 45 | serializedObject.ApplyModifiedProperties (); 46 | 47 | EditorApplication.QueuePlayerLoopUpdate (); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/UVScaleDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 350f8295d569e764f915a84007333880 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5db4b21c98621a644a9cca94fab0a151 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Utility/AutoGroupDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEngine; 3 | using UnityEditor; 4 | using Deform; 5 | 6 | namespace DeformEditor 7 | { 8 | [CustomEditor (typeof (AutoGroupDeformer)), CanEditMultipleObjects] 9 | public class AutoGroupDeformerEditor : DeformerEditor 10 | { 11 | 12 | private static class Content 13 | { 14 | public static readonly string MixedValue = "-"; 15 | public static readonly GUIContent RefreshGroup = new GUIContent 16 | ( 17 | text: "Refresh Group", 18 | tooltip: "Should child deformers be found every time this deformer updates?\n-\nFor improved performance, set this to false when you know child deformers haven't been added or removed." 19 | ); 20 | } 21 | 22 | private class Properties 23 | { 24 | public SerializedProperty RefreshGroup; 25 | 26 | public Properties (SerializedObject obj) 27 | { 28 | RefreshGroup = obj.FindProperty ("refreshGroup"); 29 | } 30 | } 31 | 32 | private Properties properties; 33 | 34 | protected override void OnEnable () 35 | { 36 | base.OnEnable (); 37 | properties = new Properties (serializedObject); 38 | } 39 | 40 | public override void OnInspectorGUI () 41 | { 42 | base.OnInspectorGUI (); 43 | 44 | serializedObject.UpdateIfRequiredOrScript (); 45 | 46 | EditorGUILayout.PropertyField (properties.RefreshGroup, Content.RefreshGroup); 47 | 48 | serializedObject.ApplyModifiedProperties (); 49 | 50 | var targetsHaveDifferentGroupSize = targets.Any (t => ((AutoGroupDeformer)t).GetGroupSize () != ((AutoGroupDeformer)target).GetGroupSize ()); 51 | 52 | var firstGroup = (AutoGroupDeformer)target; 53 | EditorGUILayout.LabelField ($"Deformer Count: {(targetsHaveDifferentGroupSize ? Content.MixedValue : firstGroup.GetGroupSize ().ToString ())}", EditorStyles.miniLabel); 54 | if (!targetsHaveDifferentGroupSize && firstGroup.GetGroupSize () == 0) 55 | EditorGUILayout.HelpBox ("Add deformers to child game objects for this deformer to have an effect.", MessageType.Info); 56 | 57 | EditorApplication.QueuePlayerLoopUpdate (); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Utility/AutoGroupDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cfa6699aae95934d9261f538129b4f8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Utility/GroupDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df2b98bafc1c92842bb0d58ef153661c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/Utility/RepeaterDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f7fb59f10f464d48a1feba7a5e6df1b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/WaveDeformerEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | using Beans.Unity.Editor; 5 | 6 | namespace DeformEditor 7 | { 8 | [CustomEditor (typeof (WaveDeformer)), CanEditMultipleObjects] 9 | public class WaveDeformerEditor : DeformerEditor 10 | { 11 | private static class Content 12 | { 13 | public static readonly GUIContent WaveLength = new GUIContent (text: "Wave Length", tooltip: "The period and magnitude of the wave."); 14 | public static readonly GUIContent Steepness = new GUIContent (text: "Steepness", tooltip: "The sharpness and height of the wave peaks."); 15 | public static readonly GUIContent Speed = new GUIContent (text: "Speed", tooltip: "The amount of change in the phase offset per second."); 16 | public static readonly GUIContent Offset = new GUIContent (text: "Offset", tooltip: "The wave's phase offset."); 17 | public static readonly GUIContent Axis = DeformEditorGUIUtility.DefaultContent.Axis; 18 | } 19 | 20 | private class Properties 21 | { 22 | public SerializedProperty WaveLength; 23 | public SerializedProperty Steepness; 24 | public SerializedProperty Speed; 25 | public SerializedProperty Offset; 26 | public SerializedProperty Axis; 27 | 28 | public Properties (SerializedObject obj) 29 | { 30 | WaveLength = obj.FindProperty ("waveLength"); 31 | Steepness = obj.FindProperty ("steepness"); 32 | Speed = obj.FindProperty ("speed"); 33 | Offset = obj.FindProperty ("offset"); 34 | Axis = obj.FindProperty ("axis"); 35 | } 36 | } 37 | 38 | private Properties properties; 39 | 40 | protected override void OnEnable () 41 | { 42 | base.OnEnable (); 43 | properties = new Properties (serializedObject); 44 | } 45 | 46 | public override void OnInspectorGUI () 47 | { 48 | base.OnInspectorGUI (); 49 | 50 | serializedObject.UpdateIfRequiredOrScript (); 51 | 52 | EditorGUILayoutx.MinField (properties.WaveLength, 0f, Content.WaveLength); 53 | EditorGUILayout.Slider (properties.Steepness, 0f, 1f, Content.Steepness); 54 | EditorGUILayout.PropertyField (properties.Speed, Content.Speed); 55 | EditorGUILayout.PropertyField (properties.Offset, Content.Offset); 56 | EditorGUILayout.PropertyField (properties.Axis, Content.Axis); 57 | 58 | serializedObject.ApplyModifiedProperties (); 59 | 60 | EditorGUILayoutx.WIPAlert (); 61 | 62 | EditorApplication.QueuePlayerLoopUpdate (); 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /Code/Editor/Mesh/Deformers/WaveDeformerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55a59844beb98d442b957d6a02370373 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/Mesh/ElasticDeformableEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d875b3ad5341754899398f089d821af 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/PropertyDrawers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49960c7fef49226408f87c1bcc86e2aa 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Editor/PropertyDrawers/DeformerElementPropertyDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Deform; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomPropertyDrawer (typeof (DeformerElement))] 8 | public class DeformerElementPropertyDrawer : PropertyDrawer 9 | { 10 | private static class Content 11 | { 12 | public const int Padding = 5; 13 | 14 | public static readonly GUIStyle Toggle = DeformEditorResources.GetStyle ("Visibility Toggle"); 15 | } 16 | 17 | public override void OnGUI (Rect rect, SerializedProperty property, GUIContent label) 18 | { 19 | using (new EditorGUI.PropertyScope (rect, label, property)) 20 | { 21 | var activeProperty = property.FindPropertyRelative ("active"); 22 | var componentProperty = property.FindPropertyRelative ("component"); 23 | 24 | var toggleRect = new Rect (rect); 25 | toggleRect.xMax = toggleRect.xMin + EditorGUIUtility.singleLineHeight; 26 | 27 | using (new EditorGUI.DisabledScope (componentProperty.objectReferenceValue == null)) 28 | activeProperty.boolValue = GUI.Toggle (toggleRect, activeProperty.boolValue, GUIContent.none, Content.Toggle); 29 | 30 | var componentRect = new Rect (rect); 31 | // While the toggle rect needs to be indented manually, the object field rect is indented within the supplied rect. 32 | // For the left of the object field rect to actually be flush to the right side of the toggle rect, we need to find the size of the indent. 33 | var indentDelta = EditorGUI.IndentedRect (rect).xMin - rect.xMin; 34 | componentRect.xMin = toggleRect.xMax + Content.Padding - indentDelta; 35 | 36 | EditorGUI.ObjectField (componentRect, componentProperty, GUIContent.none); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Code/Editor/PropertyDrawers/DeformerElementPropertyDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 985a69c2136d9f54c87601036645ab79 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Editor/PropertyDrawers/DisplayNameDrawer.cs: -------------------------------------------------------------------------------- 1 | using Deform; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace DeformEditor 6 | { 7 | [CustomPropertyDrawer(typeof(DisplayNameAttribute))] 8 | public class DisplayNameDrawer : PropertyDrawer 9 | { 10 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 11 | { 12 | EditorGUI.PropertyField(position, property, ((DisplayNameAttribute) attribute).GUIContent); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Code/Editor/PropertyDrawers/DisplayNameDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71d700410365435b8cf0325a29250c71 3 | timeCreated: 1613924302 -------------------------------------------------------------------------------- /Code/External.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26dad68835ae73646b3c6e180670ffd8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/External/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9d2f77f3f879c443bce8dbd8887f07c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Collections.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe9ab4e60f9d0804886e846a85217d57 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Collections/Beans.Unity.Collections.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Beans.Unity.Collections", 3 | "references": [ 4 | "Unity.Mathematics" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": true, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [], 14 | "versionDefines": [] 15 | } -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Collections/Beans.Unity.Collections.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00832059fce5839469e2c8e80af54186 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Collections/NativeArrayx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19d83d074eb438546b92ad83fddb2d04 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff6fad93ecfe50e43b48a93ba2a5254d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18b9ce6d07bd175428732b156bec48d8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/Beans.Unity.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Beans.Unity.Editor", 3 | "references": [], 4 | "optionalUnityReferences": [], 5 | "includePlatforms": [ 6 | "Editor" 7 | ], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [] 14 | } -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/Beans.Unity.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3cbe1929280364419e9fff898b73f76 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/EditorChangeScope.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEditor; 4 | 5 | namespace Beans.Unity.Editor 6 | { 7 | using Editor = UnityEditor.Editor; 8 | 9 | public struct EditorChangeScope : IDisposable 10 | { 11 | private readonly Editor editor; 12 | 13 | /// 14 | /// Creates a scope that updates the serialized object when constructed and applies modified properties when disposed. 15 | /// 16 | public EditorChangeScope(Editor editor) 17 | { 18 | this.editor = editor; 19 | if (editor) 20 | editor.serializedObject.UpdateIfRequiredOrScript(); 21 | } 22 | public void Dispose() 23 | { 24 | if (editor) 25 | editor.serializedObject.ApplyModifiedProperties(); 26 | else 27 | Debug.LogWarning($"{nameof(EditorChangeScope)} created without assigning editor when constructed. This does nothing."); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/EditorChangeScope.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 976bebb7c18974d46ad4b50338634c88 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/EditorGUILayoutx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5735777fff2c5554e9519cde288b7dd5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/EditorGUIUtilityx.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Beans.Unity.Editor 4 | { 5 | public static class EditorGUIUtilityx 6 | { 7 | public static Color BackgroundColor => UnityEditor.EditorGUIUtility.isProSkin ? new Color32 (56, 56, 56, 255) : new Color32 (194, 194, 194, 255); 8 | public static Color HighlightColor => UnityEditor.EditorGUIUtility.isProSkin ? new Color32 (91, 91, 91, 255) : new Color32 (222, 222, 222, 255); 9 | public static Color LowlightColor => UnityEditor.EditorGUIUtility.isProSkin ? new Color32 (30, 30, 30, 255) : new Color32 (153, 153, 153, 255); 10 | public static Color SelectedBlueColor => new Color32 (62, 125, 231, 255); 11 | } 12 | } -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/EditorGUIUtilityx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa35ed041c8f3674c8bc6445c42d3829 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/EditorGUIx.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Beans.Unity.Editor 4 | { 5 | public static class EditorGUIx 6 | { 7 | public static void DrawOutlineRect (Rect rect, Color color, int width = 1, bool inner = false) 8 | { 9 | var leftSide = new Rect (rect); 10 | var rightSide = new Rect (rect); 11 | var bottomSide = new Rect (rect); 12 | var topSide = new Rect (rect); 13 | 14 | if (inner) 15 | { 16 | leftSide.xMax = leftSide.xMin + width; 17 | rightSide.xMin = rightSide.xMax - width; 18 | bottomSide.yMax = bottomSide.yMin + width; 19 | topSide.yMin = topSide.yMax - width; 20 | } 21 | else 22 | { 23 | leftSide.xMax = leftSide.xMin; 24 | leftSide.xMin -= width; 25 | 26 | rightSide.xMin = rightSide.xMax; 27 | rightSide.xMax += width; 28 | 29 | bottomSide.xMin -= width; 30 | bottomSide.xMax += width; 31 | bottomSide.yMax = bottomSide.yMin; 32 | bottomSide.yMin -= width; 33 | 34 | topSide.xMin -= width; 35 | topSide.xMax += width; 36 | topSide.yMin = topSide.yMax; 37 | topSide.yMax += width; 38 | } 39 | 40 | UnityEditor.EditorGUI.DrawRect (leftSide, color); 41 | UnityEditor.EditorGUI.DrawRect (rightSide, color); 42 | UnityEditor.EditorGUI.DrawRect (bottomSide, color); 43 | UnityEditor.EditorGUI.DrawRect (topSide, color); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/EditorGUIx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 013bc20e8b9be26498471f3bdf9e77aa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/Editorx.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using UnityEngine; 3 | using UnityEditor; 4 | 5 | namespace Beans.Unity.Editor 6 | { 7 | using Editor = UnityEditor.Editor; 8 | 9 | public static class Editorx 10 | { 11 | /// 12 | /// 13 | /// 14 | /// The editor whose serialized properties will be automatically assigned 15 | /// Should a warning be logged if a serialized property is not found? 16 | public static void FindSerializedProperties(this Editor editor, bool logWarningForUnfoundProperties = true) 17 | { 18 | FieldInfo[] fields = editor.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | 19 | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.IgnoreCase); 20 | foreach (var field in fields) 21 | { 22 | if (field.FieldType == typeof(SerializedProperty)) 23 | { 24 | string propertyName = field.Name; 25 | 26 | if (propertyName.EndsWith("Property")) 27 | propertyName = propertyName.Remove(propertyName.Length - 8); 28 | if (propertyName.EndsWith("Prop")) 29 | propertyName = propertyName.Remove(propertyName.Length - 4); 30 | 31 | SerializedProperty property = editor.serializedObject.FindProperty(propertyName); 32 | if (logWarningForUnfoundProperties && property == null) 33 | Debug.LogWarning($"Could not find serialized property for the {editor.GetType().Name}.{propertyName} field.", editor.target); 34 | else 35 | field.SetValue(editor, property); 36 | } 37 | } 38 | } 39 | 40 | public static string Nicify(this string name) 41 | { 42 | return ObjectNames.NicifyVariableName(name); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/Editorx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ce5c6786bf6f0247aef936dd81e59a8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/Handles.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7dfd9551855209a4f967c9ff7866b771 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Editor/Editor/Handles/VerticalBoundsHandle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d55810b156d98f844a6757b605e09e2d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Mathematics.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c2829b16b60e624fb4e07b86ae8cf1b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Mathematics/Beans.Unity.Mathematics.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Beans.Unity.Mathematics", 3 | "references": [ 4 | "Unity.Mathematics" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [] 14 | } -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Mathematics/Beans.Unity.Mathematics.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0964dac71e47e04796f03c63f3bf046 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Mathematics/bounds.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc5fdfbd584723d41913a862ac3c3c91 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/External/Common/Beans.Unity.Mathematics/mathx.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e89869283504ca44c86931d88d2009ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ad0975484376984291f3e5a346f4d92 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7251aad65ee89e748b2c05ae919a5d25 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Core/DeformableManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b1869e2fda51114d95d8a3a821403ea 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: -16100 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Core/DeformerAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Deform 4 | { 5 | public enum Category 6 | { 7 | Normal, 8 | Noise, 9 | Mask, 10 | Utility, 11 | WIP 12 | } 13 | 14 | /// 15 | /// Add this attribute to deformers to have them recognised by the deformer creation window. 16 | /// 17 | [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 18 | public class DeformerAttribute : Attribute 19 | { 20 | public string Name; 21 | public string Description; 22 | public Category Category; 23 | public Type Type; 24 | public float XRotation; 25 | public float YRotation; 26 | public float ZRotation; 27 | } 28 | } -------------------------------------------------------------------------------- /Code/Runtime/Core/DeformerAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d8f7804abc0c034490e0efc33214f1c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Core/Interfaces.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cf3b34eabc1c904fb12378fc49dd89d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Core/Interfaces/IData.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | /// 4 | /// Holds the data that a Deformer will process. 5 | /// 6 | public interface IData 7 | { 8 | /// 9 | /// Resets data back to it's unmodified state. 10 | /// 11 | void ResetData (DataFlags dataFlags); 12 | /// 13 | /// Sends current data to target. (MeshFilter, SkinnedMeshRenderer etc) 14 | /// 15 | void ApplyData (DataFlags dataFlags); 16 | /// 17 | /// Deletes any data and frees its memory. 18 | /// 19 | void Dispose (); 20 | } 21 | } -------------------------------------------------------------------------------- /Code/Runtime/Core/Interfaces/IData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 978d1226fc1eaaf4987de3c1d79f9f25 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Core/Interfaces/IDeformable.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | 3 | namespace Deform 4 | { 5 | /// 6 | /// Manages deformers and the data they process. 7 | /// 8 | public interface IDeformable 9 | { 10 | UpdateFrequency UpdateFrequency { get; } 11 | 12 | /// 13 | /// Called before all other Deformables with the same DeformableManager have Schedule called. 14 | /// 15 | void PreSchedule (); 16 | 17 | /// 18 | /// Creates a job chain linking each deformer. 19 | /// 20 | JobHandle Schedule (JobHandle dependency = default); 21 | 22 | /// 23 | /// Force the scheduled work to finish. 24 | /// 25 | void Complete (); 26 | 27 | /// 28 | /// Applies current data to target. 29 | /// 30 | void ApplyData (); 31 | 32 | void ForceImmediateUpdate(); 33 | 34 | /// 35 | /// Returns true if this deformable should be processed. 36 | /// 37 | bool CanUpdate (); 38 | } 39 | } -------------------------------------------------------------------------------- /Code/Runtime/Core/Interfaces/IDeformable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 495e43d5f3429c847a01d6309186e27a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Core/Interfaces/IDeformer.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | 3 | namespace Deform 4 | { 5 | /// 6 | /// Processes data. 7 | /// 8 | /// The type of data that is processed. 9 | public interface IDeformer where TData : IData 10 | { 11 | /// 12 | /// Called before Process. 13 | /// 14 | void PreProcess (); 15 | 16 | /// 17 | /// Returns a scheduled job that operated on the data. 18 | /// 19 | /// The data to be operated on in the job. 20 | /// The scheduled job. 21 | JobHandle Process (TData data, JobHandle dependency = default (JobHandle)); 22 | 23 | /// 24 | /// Returns true if this Deformer should process data. 25 | /// 26 | bool CanProcess (); 27 | } 28 | } -------------------------------------------------------------------------------- /Code/Runtime/Core/Interfaces/IDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d14a6c5ededca414988def4dd74990ac 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bb71d010de714847a16a9ef452b637f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Data/CollapsibleSection.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Deform 4 | { 5 | public class CollapsibleSection : PropertyAttribute 6 | { 7 | public readonly string Title; 8 | public CollapsibleSection(string title) 9 | { 10 | this.Title = title; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Code/Runtime/Data/CollapsibleSection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8236330f25974322b113beffd4d8fe78 3 | timeCreated: 1613930615 -------------------------------------------------------------------------------- /Code/Runtime/Data/DisplayNameAttribute.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Deform 4 | { 5 | /// 6 | /// Add this to a field to override its display name in the inspector, also optionally takes a tooltip which can be 7 | /// used instead of [Tooltip] 8 | /// 9 | public class DisplayNameAttribute : PropertyAttribute 10 | { 11 | public readonly GUIContent GUIContent; 12 | 13 | public DisplayNameAttribute(string displayName, string tooltip = "") 14 | { 15 | GUIContent = new GUIContent(displayName, tooltip); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Code/Runtime/Data/DisplayNameAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7cce35f6049454fa51eaa2f33f53d9d 3 | timeCreated: 1613924236 -------------------------------------------------------------------------------- /Code/Runtime/Data/Interfaces.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56a92610d45cded4388a9244a4255478 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Data/Interfaces/IComponentElement.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Deform 4 | { 5 | public interface IComponentElement where T : Component 6 | { 7 | T Component { get; set; } 8 | bool Active { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /Code/Runtime/Data/Interfaces/IComponentElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45f1857074c12d940b3e8a49afef0d6b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Data/NativeCurve.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 359e6288b087835489ed78a3f803f778 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Data/NativeTexture2D.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using UnityEngine; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | using static Unity.Mathematics.math; 7 | using Beans.Unity.Mathematics; 8 | 9 | namespace Beans.Unity.Collections 10 | { 11 | public struct NativeTexture2D : IDisposable 12 | { 13 | public bool IsCreated => nativePixels.IsCreated; 14 | 15 | public int width { get; private set; } 16 | public int height { get; private set; } 17 | 18 | private NativeArray nativePixels; 19 | 20 | private void InitializeNativeData (Color32[] managedPixels) 21 | { 22 | if (nativePixels.IsCreated) 23 | nativePixels.Dispose (); 24 | nativePixels = new NativeArray (managedPixels, Allocator.Persistent); 25 | } 26 | 27 | public void Update (Color32[] managedPixels, int width, int height) 28 | { 29 | if (!nativePixels.IsCreated || nativePixels.Length != managedPixels.Length) 30 | InitializeNativeData (managedPixels); 31 | else 32 | nativePixels.CopyFrom (managedPixels); 33 | this.width = width; 34 | this.height = height; 35 | } 36 | 37 | [MethodImpl (MethodImplOptions.AggressiveInlining)] 38 | public Color32 GetPixel (int x, int y) 39 | { 40 | return nativePixels[x + y * width]; 41 | } 42 | 43 | [MethodImpl (MethodImplOptions.AggressiveInlining)] 44 | public Color32 GetPixelBilinear (float x, float y) 45 | { 46 | x = mathx.repeat (x, 1f); 47 | y = mathx.repeat (y, 1f); 48 | 49 | var xMin = mathx.repeat ((int)(x * width), width); 50 | var yMin = mathx.repeat ((int)(y * height), height); 51 | var xMax = mathx.repeat ((int)((x + 1) * width), width); 52 | var yMax = mathx.repeat ((int)((y + 1) * height), height); 53 | 54 | var bottomLeft = GetPixel (xMin, yMin); 55 | var bottomRight = GetPixel (xMax, yMin); 56 | var topLeft = GetPixel (xMin, yMax); 57 | var topRight = GetPixel (xMax, yMax); 58 | 59 | var xt = (x * width) - xMin; 60 | var yt = (y * height) - yMin; 61 | 62 | var leftColor = Color32.Lerp (bottomLeft, topLeft, yt); 63 | var rightColor = Color32.Lerp (bottomRight, topRight, yt); 64 | 65 | return Color32.Lerp (leftColor, rightColor, xt); 66 | } 67 | 68 | public void Dispose () 69 | { 70 | nativePixels.Dispose (); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Code/Runtime/Data/NativeTexture2D.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9674dde8727bab74eb29372fce7564a7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Deform.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Deform", 3 | "references": [ 4 | "Unity.Burst", 5 | "Unity.Mathematics", 6 | "Beans.Unity.Mathematics", 7 | "Beans.Unity.Collections" 8 | ], 9 | "optionalUnityReferences": [], 10 | "includePlatforms": [], 11 | "excludePlatforms": [], 12 | "allowUnsafeCode": false, 13 | "overrideReferences": false, 14 | "precompiledReferences": [], 15 | "autoReferenced": true, 16 | "defineConstraints": [] 17 | } -------------------------------------------------------------------------------- /Code/Runtime/Deform.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb26fc9ad9756c346b786dbef47679fb 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Code/Runtime/Enums.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 708618f162330f54eba9ff820a50bdb4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/Axis.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | public enum Axis 4 | { 5 | X, 6 | Y, 7 | Z 8 | } 9 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/Axis.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07df9bfc3f77a0e48aa6d69ffd6b34bf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/BoundsMode.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | /// 4 | /// Used by deformers to determine the extent of their deformation. 5 | /// 6 | public enum BoundsMode 7 | { 8 | Unlimited, 9 | Limited, 10 | } 11 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/BoundsMode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15f0c83ff8e32594894946aa5d8585a4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/BoundsRecalculation.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | /// 4 | /// Auto: Bounds are recalculated if a deformer requires it, and at the very end. 5 | /// Never: Bounds are never recalculated. 6 | /// OnceAtTheEnd: Deformers requests for updated bounds are ignored and the bounds are only updated once all deformers finish. 7 | /// 8 | public enum BoundsRecalculation 9 | { 10 | Auto, 11 | Never, 12 | OnceAtTheEnd, 13 | Custom 14 | } 15 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/BoundsRecalculation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b52b9f7dd9475b44bbb9498c76644907 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/ColliderRecalculation.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | /// 4 | /// Holds different options for the recalculation of mesh colliders. 5 | /// 6 | public enum ColliderRecalculation 7 | { 8 | None = 0, 9 | Auto = 1 10 | } 11 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/ColliderRecalculation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc3f9bcfb240cf74f9b140dfb6af725d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/CullingMode.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | public enum CullingMode 4 | { 5 | AlwaysUpdate, 6 | DontUpdate, 7 | } 8 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/CullingMode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08ab2df06e6e2704cb445ccdfaba7882 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/NoiseMode.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | /// 4 | /// Holds different modes and spaces for noise to be applied in. 5 | /// 6 | public enum NoiseMode 7 | { 8 | _3D, 9 | Directional, 10 | Normal, 11 | Spherical, 12 | Color 13 | } 14 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/NoiseMode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03e2450676612c64cb156d2b7143d51c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/NormalsRecalculation.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | /// 4 | /// None: Normals aren't touched. 5 | /// Auto: Normals will be overwritten with auto-calculated normals after all deformers complete. 6 | /// 7 | public enum NormalsRecalculation 8 | { 9 | Auto, 10 | None 11 | } 12 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/NormalsRecalculation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f89a45a3f1ddb748ac2b0a8856ac242 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/StripMode.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | public enum StripMode 4 | { 5 | Strip, 6 | [DisplayName("Don't Strip")] 7 | DontStrip 8 | } 9 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/StripMode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87218f6084f44bbfb1093b85f3bc9f83 3 | timeCreated: 1671487122 -------------------------------------------------------------------------------- /Code/Runtime/Enums/TextureSampleSpace.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | /// 4 | /// Holds different modes and spaces for a texture to be sampled in. 5 | /// 6 | public enum TextureSampleSpace 7 | { 8 | World, 9 | UV 10 | } 11 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/TextureSampleSpace.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a9c5b72d77281943b64cf84fbcbd9c8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Enums/UpdateMode.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | /// 4 | /// Holds different update modes. 5 | /// Auto: Gets updated by a manager. 6 | /// Pause: Never updated or reset. 7 | /// Stop: Mesh is reverted to it's undeformed state until mode is switched. 8 | /// Custom: Allows updates, but not from a Deformable Manager. 9 | /// 10 | public enum UpdateMode 11 | { 12 | Auto, 13 | Pause, 14 | Stop, 15 | Custom 16 | } 17 | } -------------------------------------------------------------------------------- /Code/Runtime/Enums/UpdateMode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 332c056e325c83b4b8305aeb266cdc36 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d46c9de2777fa914bad543e23835936a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52ca12d8f77670b409b589dd6b4554a0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/DeformerElement.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Deform 4 | { 5 | /// 6 | /// Contains a reference to a deformer, and a bool, Active, that determines if the deformer should be allowed to process data. 7 | /// 8 | [System.Serializable] 9 | public class DeformerElement : IComponentElement 10 | { 11 | public Deformer Component { get => component; set => component = value; } 12 | public bool Active { get => active; set => active = value; } 13 | 14 | [SerializeField] private Deformer component; 15 | [SerializeField] private bool active = true; 16 | 17 | public DeformerElement () : this (null, true) { } 18 | public DeformerElement (Deformer component, bool active = true) 19 | { 20 | this.component = component; 21 | this.active = active; 22 | } 23 | 24 | public bool CanProcess () 25 | { 26 | return Active && Component != null && Component.CanProcess (); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/DeformerElement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4a1f53294ffd49409f80fdf2643f0a6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/Enums.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bded81ae4908a49428bd5be31ec82b55 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/Enums/ColorChannel.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | public enum ColorChannel 4 | { 5 | R = 0, 6 | G = 1, 7 | B = 2, 8 | A = 3 9 | } 10 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/Enums/ColorChannel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd2a1a9d988144f4b943f5ebd31f62ae 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/Enums/DataFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Deform 4 | { 5 | [Flags] 6 | public enum DataFlags 7 | { 8 | None = 0, 9 | Vertices = 1 << 0, 10 | Normals = 1 << 1, 11 | Tangents = 1 << 2, 12 | UVs = 1 << 3, 13 | Colors = 1 << 4, 14 | Triangles = 1 << 5, 15 | MaskVertices = 1 << 6, 16 | Bounds = 1 << 7, 17 | All = ~0 18 | } 19 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/Enums/DataFlags.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f7f09701b7b5ac41b7a5fe033dbde76 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/Enums/UpdateFrequency.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | public enum UpdateFrequency 4 | { 5 | // Starts in Update and finishes in Update on the next frame 6 | Default, 7 | // Starts and finishes in LateUpdate 8 | Immediate 9 | } 10 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/Enums/UpdateFrequency.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e90dd3179ea2f3641b4984ca9f2de996 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/ManagedMeshData.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Deform 4 | { 5 | /// 6 | /// Stores managed mesh data. This the middle-man between NativeMeshData and the actual mesh. 7 | /// 8 | [System.Serializable] 9 | public class ManagedMeshData 10 | { 11 | public Vector3[] Vertices; 12 | public Vector3[] Normals; 13 | public Vector4[] Tangents; 14 | public Vector2[] UVs; 15 | public Color[] Colors; 16 | public int[] Triangles; 17 | public Bounds Bounds; 18 | 19 | public ManagedMeshData () 20 | { 21 | Vertices = new Vector3[0]; 22 | Normals = new Vector3[0]; 23 | Tangents = new Vector4[0]; 24 | UVs = new Vector2[0]; 25 | Colors = new Color[0]; 26 | Triangles = new int[0]; 27 | } 28 | 29 | public ManagedMeshData (Mesh mesh) 30 | { 31 | Vertices = mesh.vertices; 32 | Normals = mesh.normals; 33 | Tangents = mesh.tangents; 34 | UVs = mesh.uv; 35 | Colors = mesh.colors; 36 | Triangles = mesh.triangles; 37 | Bounds = mesh.bounds; 38 | 39 | if (Normals == null || Normals.Length != mesh.vertexCount) 40 | Normals = new Vector3[mesh.vertexCount]; 41 | if (Tangents == null || Tangents.Length != mesh.vertexCount) 42 | Tangents = new Vector4[mesh.vertexCount]; 43 | if (UVs == null || UVs.Length != mesh.vertexCount) 44 | UVs = new Vector2[mesh.vertexCount]; 45 | if (Colors == null || Colors.Length != mesh.vertexCount) 46 | Colors = new Color[mesh.vertexCount]; 47 | } 48 | 49 | /// 50 | /// Returns true if all the data arrays aren't null. 51 | /// 52 | public bool HasValidData () 53 | { 54 | return 55 | Vertices != null && Normals != null && Tangents != null && UVs != null && Colors != null && Triangles != null && 56 | Vertices.Length == Normals.Length && Normals.Length == Tangents.Length && Tangents.Length == UVs.Length && UVs.Length == Colors.Length; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/ManagedMeshData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c642f8e458fbd474abcf3cc2831e7af1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/MeshData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f432c560dc40074f97a8ccf40fdc4b6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/MeshTarget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93058c81890bdb84da7c7f913a07b65d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/NativeMeshData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ae4c2850b3fd4b4f99d8e699fe66f60 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/VertexCache.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Deform 4 | { 5 | /// 6 | /// Stores managed mesh data. 7 | /// 8 | [ExecuteAlways] 9 | public class VertexCache : ScriptableObject 10 | { 11 | [SerializeField, HideInInspector] 12 | public ManagedMeshData Data = new ManagedMeshData (); 13 | 14 | public void Initialize (Mesh mesh) 15 | { 16 | Data = new ManagedMeshData (mesh); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Data/VertexCache.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd6bf40d30d028f4e9d0c411d5b381b1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85212d1b13358614ca54e74ba56f93ef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | 4 | namespace Deform 5 | { 6 | /// 7 | /// The base class for mesh deformation. 8 | /// 9 | public abstract class Deformer : MonoBehaviour, IDeformer 10 | { 11 | public const bool COMPILE_SYNCHRONOUSLY = true; 12 | public const int DEFAULT_BATCH_COUNT = 64; 13 | 14 | /// 15 | /// If false, this deformer will be ignored by Deformables. 16 | /// 17 | public bool update = true; 18 | /// 19 | /// If true, bounds will be recalculated before this deformer is sent data to process. 20 | /// 21 | public virtual bool RequiresUpdatedBounds { get; } = false; 22 | 23 | /// 24 | /// Override this to tell the Deformable what data you are changing so that it knows to copy it over to the mesh. 25 | /// 26 | public abstract DataFlags DataFlags { get; } 27 | 28 | /// 29 | /// Is called before Process is called on any deformers used by the same deformable. 30 | /// 31 | public virtual void PreProcess () { } 32 | /// 33 | /// Schedules a job to process the data which should be depend on dependency and returns its handle. 34 | /// 35 | /// The data to process. 36 | /// The end of the dependency chain that this job should be appended to. 37 | /// The new end of the dependency chain. 38 | public abstract JobHandle Process (MeshData data, JobHandle dependency = default); 39 | 40 | public virtual bool CanProcess () 41 | { 42 | return update && gameObject.activeInHierarchy && enabled; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2be784bc41617094fb58d907991896e8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae825a1165d63a34a990ab07e3622f9b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/BendDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 596018e53e94bfb4d9de7a811cb67477 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/BlendDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e395330b9cf9f041967903d69693875 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/BoundedBendDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1af459629702eec47b3e29895526d7fa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/BulgeDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31cc9606f5ae2c6419582850b06a38c9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/CubifyDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82d0382989b63d64a865a7d27cbad201 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/CurveDisplaceDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37598fa690cd5084d900647169df36ec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/CurveScaleDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 950f41f1c16a84b4187ebed0a0a86042 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/CylindrifyDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | using static Unity.Mathematics.math; 7 | 8 | namespace Deform 9 | { 10 | [Deformer (Name = "Cylindrify", Description = "Blends mesh into a cylinder", XRotation = -90f, Type = typeof (CylindrifyDeformer))] 11 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/CylindrifyDeformer")] 12 | public class CylindrifyDeformer : Deformer, IFactor 13 | { 14 | public float Factor 15 | { 16 | get => factor; 17 | set => factor = Mathf.Clamp01 (value); 18 | } 19 | public float Radius 20 | { 21 | get => radius; 22 | set => radius = value; 23 | } 24 | public Transform Axis 25 | { 26 | get 27 | { 28 | if (axis == null) 29 | axis = transform; 30 | return axis; 31 | } 32 | set => axis = value; 33 | } 34 | 35 | [SerializeField, HideInInspector] private float factor = 0f; 36 | [SerializeField, HideInInspector] private float radius = 1f; 37 | [SerializeField, HideInInspector] private Transform axis; 38 | 39 | public override DataFlags DataFlags => DataFlags.Vertices; 40 | 41 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 42 | { 43 | if (Mathf.Approximately (Factor, 0f)) 44 | return dependency; 45 | 46 | var meshToAxis = DeformerUtils.GetMeshToAxisSpace (Axis, data.Target.GetTransform ()); 47 | 48 | return new CylindrifyJob 49 | { 50 | factor = Factor, 51 | radius = Radius, 52 | meshToAxis = meshToAxis, 53 | axisToMesh = meshToAxis.inverse, 54 | vertices = data.DynamicNative.VertexBuffer 55 | }.Schedule (data.Length, DEFAULT_BATCH_COUNT, dependency); 56 | } 57 | 58 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 59 | public struct CylindrifyJob : IJobParallelFor 60 | { 61 | public float factor; 62 | public float radius; 63 | public float4x4 meshToAxis; 64 | public float4x4 axisToMesh; 65 | public NativeArray vertices; 66 | 67 | public void Execute (int index) 68 | { 69 | var point = mul (meshToAxis, float4 (vertices[index], 1f)); 70 | 71 | var goalRadius = normalize (point.xy) * radius; 72 | 73 | point.xy = lerp (point.xy, goalRadius, factor); 74 | 75 | vertices[index] = mul (axisToMesh, point).xyz; 76 | } 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/CylindrifyDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4444a259de86ca34683e363b3f0a9a46 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/InflateDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | 7 | namespace Deform 8 | { 9 | [Deformer (Name = "Inflate", Description = "Moves vertices along normals", Type = typeof (InflateDeformer))] 10 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/InflateDeformer")] 11 | public class InflateDeformer : Deformer, IFactor 12 | { 13 | public float Factor 14 | { 15 | get => factor; 16 | set => factor = value; 17 | } 18 | public bool UseUpdatedNormals 19 | { 20 | get => useUpdatedNormals; 21 | set => useUpdatedNormals = value; 22 | } 23 | 24 | [SerializeField, HideInInspector] private float factor = 0f; 25 | [SerializeField, HideInInspector] private bool useUpdatedNormals; 26 | 27 | public override DataFlags DataFlags => DataFlags.Vertices; 28 | 29 | public override JobHandle Process (MeshData data, JobHandle dependency = default (JobHandle)) 30 | { 31 | if (Factor == 0f) 32 | return dependency; 33 | 34 | if (UseUpdatedNormals) 35 | dependency = MeshUtils.RecalculateNormals (data.DynamicNative, dependency); 36 | 37 | return new InflateJob 38 | { 39 | factor = Factor, 40 | vertices = data.DynamicNative.VertexBuffer, 41 | normals = data.DynamicNative.NormalBuffer, 42 | }.Schedule (data.Length, DEFAULT_BATCH_COUNT, dependency); 43 | } 44 | 45 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 46 | public struct InflateJob : IJobParallelFor 47 | { 48 | public float factor; 49 | public NativeArray vertices; 50 | public NativeArray normals; 51 | 52 | public void Execute (int index) 53 | { 54 | vertices[index] += normals[index] * factor; 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/InflateDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acdd962eebcfa2e46b666901259e730f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Interfaces.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e353d9a0bd11a0848ab70dd05200e357 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Interfaces/IFactor.cs: -------------------------------------------------------------------------------- 1 | namespace Deform 2 | { 3 | public interface IFactor 4 | { 5 | float Factor { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Interfaces/IFactor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa3939417689d51418e2ee8ccd769154 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/LatheDisplaceDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ff50badd927c474c9972605e7300aea 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/LatticeDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 164951b62cfd417ea4992d9635407735 3 | timeCreated: 1611788438 -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/MagnetDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | using static Unity.Mathematics.math; 7 | 8 | namespace Deform 9 | { 10 | [Deformer (Name = "Magnet", Description = "Attracts or repels vertices from a point", Type = typeof (MagnetDeformer))] 11 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/MagnetDeformer")] 12 | public class MagnetDeformer : Deformer, IFactor 13 | { 14 | public float Factor 15 | { 16 | get => factor; 17 | set => factor = value; 18 | } 19 | public float Falloff 20 | { 21 | get => falloff; 22 | set => falloff = Mathf.Max (value, 0f); 23 | } 24 | public Transform Center 25 | { 26 | get 27 | { 28 | if (center == null) 29 | center = transform; 30 | return center; 31 | } 32 | set => center = value; 33 | } 34 | 35 | [SerializeField, HideInInspector] private float factor = 0f; 36 | [SerializeField, HideInInspector] private float falloff = 2f; 37 | [SerializeField, HideInInspector] private Transform center; 38 | 39 | public override DataFlags DataFlags => DataFlags.Vertices; 40 | 41 | public override JobHandle Process (MeshData data, JobHandle dependency = default (JobHandle)) 42 | { 43 | if (Mathf.Approximately (Factor, 0f)) 44 | return dependency; 45 | 46 | var meshToAxis = DeformerUtils.GetMeshToAxisSpace (Center, data.Target.GetTransform ()); 47 | 48 | return new MagnetJob 49 | { 50 | factor = Factor, 51 | falloff = Falloff, 52 | meshToAxis = meshToAxis, 53 | axisToMesh = meshToAxis.inverse, 54 | vertices = data.DynamicNative.VertexBuffer 55 | }.Schedule (data.Length, DEFAULT_BATCH_COUNT, dependency); 56 | } 57 | 58 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 59 | public struct MagnetJob : IJobParallelFor 60 | { 61 | public float factor; 62 | public float falloff; 63 | public float4x4 meshToAxis; 64 | public float4x4 axisToMesh; 65 | public NativeArray vertices; 66 | 67 | public void Execute (int index) 68 | { 69 | var point = mul (meshToAxis, float4 (vertices[index], 1f)).xyz; 70 | 71 | var dist = pow (length (point), 2f) / factor; 72 | if (dist == 0f) 73 | return; 74 | var t = factor * (1f / (pow (abs (dist), falloff))); 75 | var ut = clamp (t, float.MinValue, 1f); 76 | point = lerp (point, float3 (0), ut); 77 | 78 | vertices[index] = mul (axisToMesh, float4 (point, 1f)).xyz; 79 | } 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/MagnetDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed3b0ca782ac90447977ba1eb2b74c7a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Masking.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ec2c4b28e9061a45acb7c2ed32e1679 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Masking/MaskState.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | 7 | namespace Deform.Masking 8 | { 9 | [Deformer (Name = "Mask State", Description = "Stores the current state of the mesh for masks to interpolate towards.", Type = typeof (MaskState), Category = Category.Mask)] 10 | [HelpURL ("https://github.com/keenanwoodall/Deform/wiki/MaskState")] 11 | public class MaskState : Deformer 12 | { 13 | public override DataFlags DataFlags => DataFlags.Vertices | DataFlags.MaskVertices; 14 | 15 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 16 | { 17 | return new MaskStateJob 18 | { 19 | currentVertices = data.DynamicNative.VertexBuffer, 20 | maskVertices = data.DynamicNative.MaskVertexBuffer 21 | }.Schedule (data.Length, 256, dependency); 22 | } 23 | 24 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 25 | public struct MaskStateJob : IJobParallelFor 26 | { 27 | [ReadOnly] 28 | public NativeArray currentVertices; 29 | [WriteOnly] 30 | public NativeArray maskVertices; 31 | 32 | public void Execute (int index) 33 | { 34 | maskVertices[index] = currentVertices[index]; 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Masking/MaskState.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d25f77772eaf6c40a2f57768ad9bf62 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Masking/Masks.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74923e6f66a73724a88e96b2de681668 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Masking/Masks/BoxMask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a4430943d655634da255993a0703e5a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Masking/Masks/SphereMask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b285007e8d49b734daa0804aaaec7375 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Masking/Masks/VertexColorMask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0cdb07022a79aef498a55d9fb8d3b32e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Masking/Masks/VerticalGradientMask.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f83174a89ed707445a52e2ad7dba0ad5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/MeltDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: feaf6a21652998b4d992fcf65d881d35 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Noise.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69f177eb471ebe844a034283afcb39ce 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Noise/CellularNoiseDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9565c40fea3565b4b8eeccfcec5a2112 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Noise/NoiseDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19e6b07966ed66543b626a297452e4cf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Noise/PerlinNoiseDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf7c8b14c36b67d41b7c0ca8bb4c9d25 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Noise/SimplexNoiseDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e3653249357fd5468801be5371a7ea4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/RadialCurveDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7bf4e1e223a9774998e558fe298cca3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/RadialSkewDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab99a0dd7a7804e42a5a6e6e28cfa87f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/RippleDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da8c1a6b83746ac4fa56f9f529c1adb8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/ScaleDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | using static Unity.Mathematics.math; 7 | 8 | namespace Deform 9 | { 10 | [Deformer (Name = "Scale", Description = "Scales the mesh along an arbitrary axis", Type = typeof (ScaleDeformer), Category = Category.Normal)] 11 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/ScaleDeformer")] 12 | public class ScaleDeformer : Deformer 13 | { 14 | public Transform Axis 15 | { 16 | get 17 | { 18 | if (axis == null) 19 | axis = transform; 20 | return axis; 21 | } 22 | set { axis = value; } 23 | } 24 | 25 | [SerializeField, HideInInspector] private Transform axis; 26 | 27 | public override DataFlags DataFlags => DataFlags.Vertices; 28 | 29 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 30 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 31 | { 32 | var meshToAxis = DeformerUtils.GetMeshToAxisSpace (Axis, data.Target.GetTransform ()); 33 | 34 | return new ScaleJob 35 | { 36 | scale = Axis.localScale, 37 | meshToAxis = meshToAxis, 38 | axisToMesh = meshToAxis.inverse, 39 | vertices = data.DynamicNative.VertexBuffer 40 | }.Schedule (data.Length, DEFAULT_BATCH_COUNT, dependency); 41 | } 42 | 43 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 44 | public struct ScaleJob : IJobParallelFor 45 | { 46 | public float3 scale; 47 | public float4x4 meshToAxis; 48 | public float4x4 axisToMesh; 49 | public NativeArray vertices; 50 | 51 | public void Execute (int index) 52 | { 53 | var point = mul (meshToAxis, float4 (vertices[index], 1f)); 54 | 55 | point *= float4 (scale, 1f); 56 | 57 | vertices[index] = mul (axisToMesh, point).xyz; 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/ScaleDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52700621f4ff4e040b59281033c4d699 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/SineDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 539e0e200eedc414490864f0aef76f31 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/SkewDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc251f4126fb2034f9ca62dcf231d638 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/SpherifyDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34d36a2efdcec6340a30c114dea9615f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/SquashAndStretchDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78ed453254255cb409bad7ea6d0a427c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/StarDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bf328e538290e34ebded6aefa5d3211 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/TaperDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff95348e66c127a44911878f6490439c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/TextureDisplaceDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53d0afe58c907604bb9ba26c30e7edcf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/TransformDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | using static Unity.Mathematics.math; 7 | 8 | namespace Deform 9 | { 10 | [Deformer (Name = "Transform", Description = "Gives the mesh a new position, rotation and scale", Type = typeof (TransformDeformer))] 11 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/TransformDeformer")] 12 | public class TransformDeformer : Deformer, IFactor 13 | { 14 | public Transform Target 15 | { 16 | get 17 | { 18 | if (target == null) 19 | target = transform; 20 | return target; 21 | } 22 | set => target = value; 23 | } 24 | public float Factor 25 | { 26 | get => factor; 27 | set => factor = value; 28 | } 29 | 30 | [SerializeField, HideInInspector] 31 | private Transform target; 32 | [SerializeField, HideInInspector] 33 | private float factor = 1f; 34 | 35 | public override DataFlags DataFlags => DataFlags.Vertices; 36 | 37 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 38 | { 39 | Factor = Mathf.Clamp(Factor, 0f, 1f); 40 | if (Factor == 0f) 41 | return dependency; 42 | var dataTargetTransform = data.Target.GetTransform (); 43 | Matrix4x4 matrix = new Matrix4x4(); 44 | matrix.SetTRS( 45 | Vector3.Lerp(dataTargetTransform.position, Target.position, Factor), 46 | Quaternion.Lerp(dataTargetTransform.rotation, Target.rotation, Factor), 47 | Vector3.Lerp(dataTargetTransform.localScale, Target.localScale, Factor) 48 | ); 49 | matrix = dataTargetTransform.worldToLocalMatrix * matrix; 50 | return new TransformJob 51 | { 52 | matrix = matrix, 53 | vertices = data.DynamicNative.VertexBuffer 54 | }.Schedule (data.Length, 256, dependency); 55 | } 56 | 57 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 58 | public struct TransformJob : IJobParallelFor 59 | { 60 | public float4x4 matrix; 61 | public NativeArray vertices; 62 | 63 | public void Execute (int index) 64 | { 65 | vertices[index] = mul (matrix, float4 (vertices[index], 1f)).xyz; 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/TransformDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14852b84446997747a13435ca89db189 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/TransformOffsetDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | using static Unity.Mathematics.math; 7 | 8 | namespace Deform 9 | { 10 | [Deformer (Name = "Transform Offset", Description = "Offsets the position, rotation and scale of a mesh", Type = typeof (TransformOffsetDeformer))] 11 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/TransformOffsetDeformer")] 12 | public class TransformOffsetDeformer : Deformer 13 | { 14 | public Transform Target 15 | { 16 | get 17 | { 18 | if (target == null) 19 | target = transform; 20 | return target; 21 | } 22 | set => target = value; 23 | } 24 | 25 | [SerializeField, HideInInspector] 26 | private Transform target; 27 | 28 | public override DataFlags DataFlags => DataFlags.Vertices; 29 | 30 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 31 | { 32 | var dataTargetTransform = data.Target.GetTransform (); 33 | var matrix = Matrix4x4.TRS (Target.position, Target.rotation, Target.lossyScale); 34 | return new TransformOffsetJob 35 | { 36 | matrix = matrix, 37 | vertices = data.DynamicNative.VertexBuffer 38 | }.Schedule (data.Length, 256, dependency); 39 | } 40 | 41 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 42 | public struct TransformOffsetJob : IJobParallelFor 43 | { 44 | public float4x4 matrix; 45 | public NativeArray vertices; 46 | 47 | public void Execute (int index) 48 | { 49 | vertices[index] = mul (matrix, float4 (vertices[index], 1f)).xyz; 50 | } 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/TransformOffsetDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 358b046d7c0176544a558f4a9c929001 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/TwirlDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c810b6e889701bc4a88b8aad76a8bea9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/TwistDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2708e78dd60ea648ac0f9a73306e122 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/UVOffsetDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | 7 | namespace Deform 8 | { 9 | [Deformer (Name = "UV Offset", Description = "Offsets the mesh's UVs", Type = typeof (UVOffsetDeformer), Category = Category.Normal)] 10 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/UVOffsetDeformer")] 11 | public class UVOffsetDeformer : Deformer 12 | { 13 | public Vector2 Offset 14 | { 15 | get => offset; 16 | set => offset = value; 17 | } 18 | 19 | [SerializeField, HideInInspector] private Vector2 offset; 20 | 21 | public override DataFlags DataFlags => DataFlags.UVs; 22 | 23 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 24 | { 25 | return new UVOffsetJob 26 | { 27 | offset = offset, 28 | uvs = data.DynamicNative.UVBuffer 29 | }.Schedule (data.Length, DEFAULT_BATCH_COUNT, dependency); 30 | } 31 | 32 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 33 | public struct UVOffsetJob : IJobParallelFor 34 | { 35 | public float2 offset; 36 | public NativeArray uvs; 37 | 38 | public void Execute (int index) 39 | { 40 | uvs[index] += offset; 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/UVOffsetDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97cfa3fadda69aa42af8bc90b7128fcb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/UVScaleDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | 7 | namespace Deform 8 | { 9 | [Deformer (Name = "UV Scale", Description = "Scales the mesh's UVs", Type = typeof (UVScaleDeformer), Category = Category.Normal)] 10 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/UVScaleDeformer")] 11 | public class UVScaleDeformer : Deformer, IFactor 12 | { 13 | public float Factor 14 | { 15 | get => factor; 16 | set => factor = value; 17 | } 18 | public Vector2 Scale 19 | { 20 | get => scale; 21 | set => scale = value; 22 | } 23 | 24 | [SerializeField, HideInInspector] private float factor = 1f; 25 | [SerializeField, HideInInspector] private Vector2 scale = Vector2.one; 26 | 27 | public override DataFlags DataFlags => DataFlags.UVs; 28 | 29 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 30 | { 31 | return new UVScaleJob 32 | { 33 | scale = Scale * Factor, 34 | uvs = data.DynamicNative.UVBuffer 35 | }.Schedule (data.Length, DEFAULT_BATCH_COUNT, dependency); 36 | } 37 | 38 | [BurstCompile (CompileSynchronously = COMPILE_SYNCHRONOUSLY)] 39 | public struct UVScaleJob : IJobParallelFor 40 | { 41 | public float2 scale; 42 | public NativeArray uvs; 43 | 44 | public void Execute (int index) 45 | { 46 | uvs[index] *= scale; 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/UVScaleDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b53d269228d793e43ac56ca8133325bf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49fc12ea106742345bb34163cf7995f8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/AutoGroupDeformer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using Unity.Jobs; 4 | using Deform.Masking; 5 | 6 | namespace Deform 7 | { 8 | [ExecuteAlways] 9 | [Deformer (Name = "Auto Group", Description = "Delegates deformation to deformers on child game objects", Type = typeof (AutoGroupDeformer), Category = Category.Utility)] 10 | [HelpURL ("https://github.com/keenanwoodall/Deform/wiki/AutoGroupDeformer")] 11 | public class AutoGroupDeformer : Deformer 12 | { 13 | public bool RefreshGroup 14 | { 15 | get => refreshGroup; 16 | set => refreshGroup = value; 17 | } 18 | 19 | [SerializeField, HideInInspector] private bool refreshGroup = true; 20 | [SerializeField, HideInInspector] private List deformers = new List (); 21 | 22 | private DataFlags dataFlags = DataFlags.None; 23 | 24 | public override DataFlags DataFlags => dataFlags; 25 | 26 | 27 | private void OnEnable () 28 | { 29 | if (RefreshGroup) 30 | Refresh (); 31 | } 32 | private void Update () 33 | { 34 | if (RefreshGroup) 35 | Refresh (); 36 | } 37 | 38 | public void Refresh () 39 | { 40 | GetComponentsInChildren (deformers); 41 | deformers.Remove (this); 42 | } 43 | public int GetGroupSize () 44 | { 45 | if (deformers == null) 46 | return 0; 47 | return deformers.Count; 48 | } 49 | 50 | public override void PreProcess () 51 | { 52 | foreach (var deformer in deformers) 53 | if (deformer != null && deformer.CanProcess ()) 54 | deformer.PreProcess (); 55 | } 56 | 57 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 58 | { 59 | dataFlags = DataFlags.None; 60 | 61 | if (deformers == null) 62 | return dependency; 63 | 64 | foreach (var deformer in deformers) 65 | { 66 | if (deformer != null && deformer != this && deformer.CanProcess ()) 67 | { 68 | dependency = deformer.Process (data, dependency); 69 | dataFlags |= deformer.DataFlags; 70 | } 71 | } 72 | 73 | return dependency; 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/AutoGroupDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83b9d9308299813479bf0d4304e5e6cb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/GroupDeformer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using Unity.Jobs; 4 | 5 | namespace Deform 6 | { 7 | [Deformer (Name = "Group", Description = "Combines deformers into a group", Type = typeof (GroupDeformer), Category = Category.Utility)] 8 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/GroupDeformer")] 9 | public class GroupDeformer : Deformer 10 | { 11 | public List DeformerElements 12 | { 13 | get => deformerElements; 14 | set => deformerElements = value; 15 | } 16 | 17 | [SerializeField, HideInInspector] 18 | private List deformerElements = new List (); 19 | 20 | private DataFlags dataFlags = DataFlags.None; 21 | 22 | public override DataFlags DataFlags => dataFlags; 23 | 24 | public override void PreProcess () 25 | { 26 | foreach (var element in deformerElements) 27 | if (element.CanProcess ()) 28 | element.Component.PreProcess (); 29 | } 30 | 31 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 32 | { 33 | dataFlags = DataFlags.None; 34 | 35 | foreach (var element in deformerElements) 36 | { 37 | #if UNITY_EDITOR 38 | if (element.Component == this) 39 | { 40 | Debug.LogError ("Group Deformer cannot reference itself as this will create an infinite loop. Please fix this now as it will not be checked at runtime."); 41 | continue; 42 | } 43 | #endif 44 | if (element.CanProcess ()) 45 | { 46 | var deformer = element.Component; 47 | dependency = deformer.Process (data, dependency); 48 | dataFlags |= deformer.DataFlags; 49 | } 50 | } 51 | 52 | return dependency; 53 | } 54 | 55 | public void AddDeformer (Deformer deformer, bool active = true) 56 | { 57 | DeformerElements.Add (new DeformerElement (deformer, active)); 58 | } 59 | 60 | public void RemoveDeformer (Deformer deformer) 61 | { 62 | for (int i = 0; i < DeformerElements.Count; i++) 63 | { 64 | var element = DeformerElements[i]; 65 | if (element.Component == deformer) 66 | { 67 | DeformerElements.RemoveAt (i); 68 | i--; 69 | } 70 | } 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/GroupDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1b40265afce7b8438e35763b205996d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/RecalculateBoundsDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | 4 | namespace Deform 5 | { 6 | [Deformer (Name = "Recalculate Bounds", Description = "Recalculates the bounds", Type = typeof (RecalculateBoundsDeformer), Category = Category.Utility)] 7 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/RecalculateBoundsDeformer")] 8 | public class RecalculateBoundsDeformer : Deformer 9 | { 10 | public override DataFlags DataFlags => DataFlags.Bounds; 11 | 12 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 13 | { 14 | return MeshUtils.RecalculateBounds (data.DynamicNative, dependency); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/RecalculateBoundsDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da6061ae8dc830848a0b798f14d86ce9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/RecalculateNormalsDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | 4 | namespace Deform 5 | { 6 | [Deformer (Name = "Recalculate Normals", Description = "Recalculates the normals", Type = typeof (RecalculateNormalsDeformer), Category = Category.Utility)] 7 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/RecalculateNormalsDeformer")] 8 | public class RecalculateNormalsDeformer : Deformer 9 | { 10 | public override DataFlags DataFlags => DataFlags.Normals; 11 | 12 | public override JobHandle Process (MeshData data, JobHandle dependency = default) 13 | { 14 | return MeshUtils.RecalculateNormals (data.DynamicNative, dependency); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/RecalculateNormalsDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56e33ea981c5a424eb327f58494a1445 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/RepeaterDeformer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | 4 | namespace Deform 5 | { 6 | [Deformer (Name = "Repeater", Description = "Applies the same deformer multiple times", Type = typeof (RepeaterDeformer), Category = Category.Utility)] 7 | [HelpURL("https://github.com/keenanwoodall/Deform/wiki/RepeaterDeformer")] 8 | public class RepeaterDeformer : Deformer 9 | { 10 | public int Iterations 11 | { 12 | get => iterations; 13 | set => iterations = Mathf.Max (0, value); 14 | } 15 | public DeformerElement DeformerElement 16 | { 17 | get => deformerElement; 18 | set => deformerElement = value; 19 | } 20 | 21 | [SerializeField, HideInInspector] private int iterations = 1; 22 | [SerializeField, HideInInspector] private DeformerElement deformerElement = new DeformerElement (null); 23 | 24 | private DataFlags dataFlags = DataFlags.None; 25 | 26 | public override DataFlags DataFlags => dataFlags; 27 | 28 | public override JobHandle Process (MeshData data, JobHandle dependency = default (JobHandle)) 29 | { 30 | dataFlags = DataFlags.None; 31 | 32 | var deformer = DeformerElement.Component; 33 | 34 | #if UNITY_EDITOR 35 | if (deformer == this) 36 | { 37 | Debug.LogError ("Repeater Deformer cannot reference itself as this will create an infinite loop. Please fix this now as it will not be checked at runtime."); 38 | return dependency; 39 | } 40 | #endif 41 | 42 | if (deformer == null || !DeformerElement.CanProcess ()) 43 | return dependency; 44 | 45 | dataFlags |= deformer.DataFlags; 46 | 47 | for (int i = 0; i < Iterations; i++) 48 | dependency = deformer.Process (data, dependency); 49 | 50 | return dependency; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/Utility/RepeaterDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da4bbab8a8312b24aa890edd99475a48 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Deformers/WaveDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2fcf505b302dac45959bd67e47bd784 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/ElasticDeformable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28b9e154136439741967b20aad7a9bf7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/IO.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d048471c9e04a34ea90629d12cf0a17 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/IO/ObjExporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d3ef6ecb504f2e4aacaacc4e06a0aea 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e92b702081f3bca4a8fc0750aa5041ae 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/DataUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 221118db1d44ad7488f4fef0b9f8dc91 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/DeformerUtils.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Deform 4 | { 5 | /// 6 | /// Contains utility methods for calculations commonly done by deformers. 7 | /// 8 | public static class DeformerUtils 9 | { 10 | /// 11 | /// Returns a matrix that transform a mesh from local space to a space relative to the axis transform. 12 | /// 13 | public static Matrix4x4 GetMeshToAxisSpace (Transform axis, Transform mesh) 14 | { 15 | return axis.worldToLocalMatrix * mesh.transform.localToWorldMatrix; 16 | } 17 | 18 | /// 19 | /// Get an axis transform's position relative to a mesh transform. 20 | /// 21 | public static Vector3 GetAxisPositionRelativeToMesh (Transform axis, Transform mesh) 22 | { 23 | return mesh.worldToLocalMatrix.MultiplyPoint3x4 (axis.position); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/DeformerUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 131ead6987652604b8be8212e15ae618 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b7e1750ee3c317448c49a960b8a1048 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/AddFloat3ToFloat3sJob.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | 6 | namespace Deform 7 | { 8 | public struct AddFloat3ToFloat3sJob : IJobParallelFor 9 | { 10 | public float3 value; 11 | public NativeArray values; 12 | 13 | public void Execute(int index) 14 | { 15 | values[index] += value; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/AddFloat3ToFloat3sJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d06fe6a6235f33947aea330c2c2de40f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/AddTriangleNormalToNormalsJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | using Unity.Burst; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | using static Unity.Mathematics.math; 6 | 7 | namespace Deform 8 | { 9 | /// 10 | /// Adds the normal of every triangle to each vertex that it consists of. 11 | /// 12 | [BurstCompile (CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 13 | public struct AddTriangleNormalToNormalsJob : IJob 14 | { 15 | public NativeArray triangles; 16 | public NativeArray vertices; 17 | public NativeArray normals; 18 | 19 | public void Execute () 20 | { 21 | // Loop through each triangle. 22 | for (int i = 0; i < triangles.Length; i += 3) 23 | { 24 | // Get indices of the three vertices that make the current triangle. 25 | var t0 = triangles[i]; 26 | var t1 = triangles[i + 1]; 27 | var t2 = triangles[i + 2]; 28 | // Get each vertice of the current triangle. 29 | var v0 = vertices[t0]; 30 | var v1 = vertices[t1]; 31 | var v2 = vertices[t2]; 32 | // Calculate the triangle normal. 33 | var n = float3 34 | ( 35 | v0.y * v1.z - v0.y * v2.z - v1.y * v0.z + v1.y * v2.z + v2.y * v0.z - v2.y * v1.z, 36 | -v0.x * v1.z + v0.x * v2.z + v1.x * v0.z - v1.x * v2.z - v2.x * v0.z + v2.x * v1.z, 37 | v0.x * v1.y - v0.x * v2.y - v1.x * v0.y + v1.x * v2.y + v2.x * v0.y - v2.x * v1.y 38 | ); 39 | // Add the normal of the triangle to each of its vertices. 40 | normals[t0] += n; 41 | normals[t1] += n; 42 | normals[t2] += n; 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/AddTriangleNormalToNormalsJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ae4926164b17f44eb01e9e889ba9b42 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/CopyFloat3sJob.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Jobs; 3 | using Unity.Burst; 4 | using Unity.Collections; 5 | using Unity.Mathematics; 6 | 7 | namespace Deform 8 | { 9 | [BurstCompile(CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 10 | public struct CopyFloat3sJob : IJobParallelFor 11 | { 12 | public NativeArray from; 13 | public NativeArray to; 14 | 15 | public void Execute(int index) 16 | { 17 | to[index] = from[index]; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/CopyFloat3sJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4de8639d1a5298a4c8713328aff7a113 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/ElasticPointsUpdateJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Burst; 2 | using Unity.Jobs; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | using static Unity.Mathematics.math; 6 | using static Beans.Unity.Mathematics.mathx; 7 | 8 | namespace Deform 9 | { 10 | [BurstCompile(CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 11 | public struct ElasticPointsUpdateJob : IJobParallelFor 12 | { 13 | public float dampingRatio, angularFrequency, deltaTime; 14 | 15 | public NativeArray velocities; 16 | public NativeArray currentPoints; 17 | [ReadOnly] 18 | public NativeArray targetPoints; 19 | 20 | public void Execute(int index) 21 | { 22 | var currentPoint = currentPoints[index]; 23 | var targetPoint = targetPoints[index]; 24 | var velocity = velocities[index]; 25 | 26 | spring(ref currentPoint, ref velocity, targetPoint, dampingRatio, angularFrequency, deltaTime); 27 | 28 | currentPoints[index] = currentPoint; 29 | velocities[index] = velocity; 30 | } 31 | } 32 | [BurstCompile(CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 33 | public struct MaskedElasticPointsUpdateJob : IJobParallelFor 34 | { 35 | public float unmaskedDampingRatio, unmaskedAngularFrequency, maskedDampingRatio, maskedAngularFrequency, deltaTime; 36 | public int maskIndex; 37 | 38 | public NativeArray velocities; 39 | public NativeArray currentPoints; 40 | [ReadOnly] 41 | public NativeArray targetPoints; 42 | [ReadOnly] 43 | public NativeArray colors; 44 | 45 | public void Execute(int index) 46 | { 47 | var currentPoint = currentPoints[index]; 48 | var targetPoint = targetPoints[index]; 49 | var velocity = velocities[index]; 50 | 51 | var mask = colors[index][maskIndex]; 52 | 53 | var dampingRatio = lerp(maskedDampingRatio, unmaskedDampingRatio, mask); 54 | var angularFrequency = lerp(maskedAngularFrequency, unmaskedAngularFrequency, mask); 55 | 56 | spring(ref currentPoint, ref velocity, targetPoint, dampingRatio, angularFrequency, deltaTime); 57 | 58 | currentPoints[index] = currentPoint; 59 | velocities[index] = velocity; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/ElasticPointsUpdateJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6dee34a9daf07094c974e187670d330e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/NormalizeNormalsJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | using Unity.Burst; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | using static Unity.Mathematics.math; 6 | 7 | namespace Deform 8 | { 9 | /// 10 | /// Normalized every normal in the NativeMeshData. 11 | /// 12 | [BurstCompile (CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 13 | public struct NormalizeNormalsJob : IJobParallelFor 14 | { 15 | public NativeArray normals; 16 | 17 | public void Execute (int index) 18 | { 19 | normals[index] = normalize (normals[index]); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/NormalizeNormalsJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: caf04f817cd20e743a58ccbb4ba8621f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/RecalculateBoundsJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | using Unity.Burst; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | using static Unity.Mathematics.math; 6 | using Beans.Unity.Mathematics; 7 | 8 | namespace Deform 9 | { 10 | /// 11 | /// Calculates the bounds of an array of float3s. 12 | /// 13 | [BurstCompile (CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 14 | public struct RecalculateBoundsJob : IJob 15 | { 16 | public NativeArray bounds; 17 | public NativeArray vertices; 18 | 19 | public void Execute () 20 | { 21 | var xmin = float.PositiveInfinity; 22 | var ymin = float.PositiveInfinity; 23 | var zmin = float.PositiveInfinity; 24 | var xmax = float.NegativeInfinity; 25 | var ymax = float.NegativeInfinity; 26 | var zmax = float.NegativeInfinity; 27 | 28 | var length = vertices.Length; 29 | for (int i = 0; i < length; i++) 30 | { 31 | var p = vertices[i]; 32 | 33 | if (p.x < xmin) 34 | xmin = p.x; 35 | if (p.y < ymin) 36 | ymin = p.y; 37 | if (p.z < zmin) 38 | zmin = p.z; 39 | 40 | if (p.x > xmax) 41 | xmax = p.x; 42 | if (p.y > ymax) 43 | ymax = p.y; 44 | if (p.z > zmax) 45 | zmax = p.z; 46 | } 47 | 48 | var b = new bounds (); 49 | b.min = float3 (xmin, ymin, zmin); 50 | b.max = float3 (xmax, ymax, zmax); 51 | 52 | bounds[0] = b; 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/RecalculateBoundsJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a674b091f7a44b42953773585b73e20 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/ResetNormalsJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | using Unity.Burst; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | using static Unity.Mathematics.math; 6 | 7 | namespace Deform 8 | { 9 | /// 10 | /// Sets every normal in the NativeMeshData to 'float3 (0f, 0f, 0f).' 11 | /// 12 | [BurstCompile (CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 13 | public struct ResetNormalsJob : IJobParallelFor 14 | { 15 | public NativeArray normals; 16 | 17 | public void Execute (int index) 18 | { 19 | normals[index] = float3 (0f, 0f, 0f); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/ResetNormalsJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f3e0100f1881844ca825e842cc945d7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/TransformPointsFromJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | using Unity.Burst; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | using static Unity.Mathematics.math; 6 | 7 | namespace Deform 8 | { 9 | [BurstCompile(CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 10 | public struct TransformPointsFromJob : IJobParallelFor 11 | { 12 | [ReadOnly] 13 | public NativeArray from; 14 | [WriteOnly] 15 | public NativeArray to; 16 | 17 | public float4x4 matrix; 18 | 19 | public void Execute(int index) 20 | { 21 | to[index] = mul(matrix, float4(from[index], 1f)).xyz; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/TransformPointsFromJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31ca3dc5b3e04ae46b66ea6f26c229c5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/TransformPointsJob.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | using Unity.Burst; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | using static Unity.Mathematics.math; 6 | 7 | namespace Deform 8 | { 9 | [BurstCompile(CompileSynchronously = Deformer.COMPILE_SYNCHRONOUSLY)] 10 | public struct TransformPointsJob : IJobParallelFor 11 | { 12 | public NativeArray points; 13 | public float4x4 matrix; 14 | 15 | public void Execute(int index) 16 | { 17 | points[index] = mul(matrix, float4(points[index], 1f)).xyz; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/Jobs/TransformPointsJob.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ede7a7f33f3324240b48da164bd0cdae 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/MeshUtils.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | 3 | namespace Deform 4 | { 5 | /// 6 | /// Contains utility methods for common mesh job operations. 7 | /// 8 | public static class MeshUtils 9 | { 10 | /// 11 | /// Returns a job chain that will recalculate the normals of the native data. 12 | /// 13 | public static JobHandle RecalculateNormals (NativeMeshData data, JobHandle dependency = default) 14 | { 15 | var length = data.NormalBuffer.Length; 16 | 17 | dependency = new ResetNormalsJob 18 | { 19 | normals = data.NormalBuffer 20 | }.Schedule (length, 256, dependency); 21 | dependency = new AddTriangleNormalToNormalsJob 22 | { 23 | triangles = data.IndexBuffer, 24 | vertices = data.VertexBuffer, 25 | normals = data.NormalBuffer 26 | }.Schedule (dependency); 27 | dependency = new NormalizeNormalsJob 28 | { 29 | normals = data.NormalBuffer 30 | }.Schedule (length, 256, dependency); 31 | 32 | return dependency; 33 | } 34 | 35 | /// 36 | /// Returns a job chain that will recalculate the bounds of the native data. 37 | /// 38 | public static JobHandle RecalculateBounds (NativeMeshData data, JobHandle dependency = default) 39 | { 40 | return new RecalculateBoundsJob 41 | { 42 | bounds = data.Bounds, 43 | vertices = data.VertexBuffer 44 | }.Schedule (dependency); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Code/Runtime/Mesh/Utility/MeshUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3da1326ebee5283409e134934bca022c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /EditorResources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddd5e62d7c0381247b2b266e0b2ec57c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/DeformSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 84838e1060cbc4f45a2f463816b2d2fe, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | solidHandleColor: {r: 1, g: 0.4, b: 0, a: 1} 16 | lightHandleColor: {r: 1, g: 0.4, b: 0, a: 0.75} 17 | recordingHandleColor: {r: 1, g: 0, b: 0, a: 0.9} 18 | dottedLineSize: 5 19 | screenspaceHandleCapSize: 0.0275 20 | screenspaceAngleHandleSize: 1.25 21 | screenspaceLatticeCapSize: 0.035 22 | modelsReadableByDefault: 0 23 | buildStripping: 1 24 | -------------------------------------------------------------------------------- /EditorResources/DeformSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa786115b5aa3dd4eba208e687fd6a98 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32028325234d01543bf8914cf58a46b6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Materials/DeformDefaultMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: DeformDefaultMaterial 11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 2800000, guid: 0678da6412530714fa92685c0aa0f2e2, type: 3} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /EditorResources/Materials/DeformDefaultMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df664111665904340a251d27120182e2 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Meshes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6c6c6a633aa20f45af10f9d9e616902 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Meshes/DeformDefaultMesh.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Meshes/DeformDefaultMesh.fbx -------------------------------------------------------------------------------- /EditorResources/Styles.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eee4ce1c35b87454f998b4d912363f71 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Styles/DeformPersonal.guiskin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b29598d9faa1bdb45bda7feb355884b8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Styles/DeformProfessional.guiskin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6cd5bf6bcde01e34c9d83eb8ea05314c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d8e7a1ee0e34c94cb08f1ed750b7104 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Textures/DeformDefaultTexture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Textures/DeformDefaultTexture.png -------------------------------------------------------------------------------- /EditorResources/Textures/External.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b263c7faec16ce48a1b70f50af93dc8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Textures/External/MaterialDesign.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d59a7981d7b8f8b418471fb90897d609 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Textures/External/MaterialDesign/LICENSE.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0dab79fbeefa31f42b766a4bb9c81892 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /EditorResources/Textures/External/MaterialDesign/VisibilityOffDark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Textures/External/MaterialDesign/VisibilityOffDark.png -------------------------------------------------------------------------------- /EditorResources/Textures/External/MaterialDesign/VisibilityOffLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Textures/External/MaterialDesign/VisibilityOffLight.png -------------------------------------------------------------------------------- /EditorResources/Textures/External/MaterialDesign/VisibilityOnDark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Textures/External/MaterialDesign/VisibilityOnDark.png -------------------------------------------------------------------------------- /EditorResources/Textures/External/MaterialDesign/VisibilityOnLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Textures/External/MaterialDesign/VisibilityOnLight.png -------------------------------------------------------------------------------- /EditorResources/Textures/Styles.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c9e3136026a1934b8b8f03cb009f7ca 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /EditorResources/Textures/Styles/BoxDark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Textures/Styles/BoxDark.png -------------------------------------------------------------------------------- /EditorResources/Textures/Styles/BoxDark.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba38fd271dc90444b818c9c6bfbad458 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: 0 35 | aniso: 1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 2 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 32 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 32 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /EditorResources/Textures/Styles/BoxLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Textures/Styles/BoxLight.png -------------------------------------------------------------------------------- /EditorResources/Textures/Styles/Record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keenanwoodall/Deform/9e57dd3864ea6c742d819959724c99ca574a2f76/EditorResources/Textures/Styles/Record.png -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Keenan Woodall 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3588e2cd9e0ee7499aa51db63ca3c4f 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | DOCUMENTATION 2 | ---------------- 3 | More extensive documentation and written/video tutorials can be found on Deform's wiki: https://github.com/keenanwoodall/Deform/wiki 4 | 5 | 6 | INSTALLATION 7 | ---------------- 8 | Deform has dependencies on the Burst and Mathematics packages. These packages are referenced by Deform via asmdef files. 9 | If you install Deform from the Asset Store before installing its dependencies it may lose references to the packages. 10 | 11 | If you installed Deform before installing Burst and Mathematics install Burst and Mathematics from the Package Manager. 12 | The references to the packages should be fixed, but if they aren't go to the asmdef file under Deform/Code/Runtime and manually assign them. 13 | 14 | 15 | GETTING STARTED 16 | ---------------- 17 | After installing, the first thing you'll probably want to do is deform a mesh. Every mesh that you want to deform must have a Deformable component added to it. 18 | This component is a little manager for the mesh. Once your mesh has a Deformable component you can add Deformer components to the Deformable's list of deformers to modify the mesh. 19 | 20 | You can create these components like any other component (from the "Add Component" button in the Inspector), but an alternative way is to use the Creator window. 21 | This window lets you create deformable meshes and add deformers much more efficiently. 22 | 23 | You can open the Creator window from either the Tools/Deform/Creator or Window/Deform/Creator menu item. 24 | 25 | Remember, almost every deformer operates in worldspace. Most deformers have a Transform property called Axis. If left blank, the deformer will use its own transform as the axis. 26 | This axis is used as the position, rotation and scale of the deformer i.e. all deformation will be relative to it. For example, the Magnet deformer will push/pull vertices from its axis' position. 27 | 28 | 29 | SUPPORT 30 | ---------------- 31 | If you run into any issues please submit them here https://github.com/keenanwoodall/Deform/issues/new 32 | If you any questions feel free to email me at keenanwoodall@gmail.com 33 | 34 | I'll do my best to respond and solve any issues but keep in mind that this is a free asset and I won't be able to dedicate all my time to supporting it. -------------------------------------------------------------------------------- /README.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee2f45d23ac76444d8f267eda49462e4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.beans.deform", 3 | "author": "Keenan Woodall", 4 | "displayName": "Deform", 5 | "version": "1.2.2", 6 | "unity": "2018.3", 7 | "description": "A framework for deforming meshes in the editor and at runtime.", 8 | "category": "Unity", 9 | "keywords": [ 10 | "burst", 11 | "mathematics", 12 | "mesh", 13 | "modifiers", 14 | "deformers" 15 | ], 16 | "dependencies": { 17 | "com.unity.burst": "1.4.8" 18 | } 19 | } -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf968d570f773094e8ac2cd0dd333591 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------