├── .gitattributes ├── .gitignore ├── Assets └── VRCFaceTracking │ └── Tools │ └── Binary Parameter Tool │ └── Editor │ ├── BinaryParameterFloatDriver.cs │ ├── BinaryParameterScript.cs │ ├── BinaryParameterWindow.cs │ └── ParameterGenerator.cs └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd 364 | /Assets/textures/Gradients 365 | /Assets/VRCAvatars3Tools 366 | /Assets/Unity Shaders/Cubeds-Unity-Shaders-master/Assets/Cubed's Unity Shaders/Shaders 367 | /Assets/Tiger's Bingo XD 368 | /Assets/Scenes 369 | /Assets/Lyuma/Av3Emulator 370 | /Assets/Kylin VRc 371 | /Assets/Inventory Inventor 372 | /Assets/Hirabiki/VRCLens 373 | /Assets/Gizmos/InventoryInventor/Preset 374 | /Assets/Face Tracking Setup 375 | /Assets/DynamicBone 376 | /Assets/DotTranquil/anim 377 | /Library 378 | /Assets/_PoiyomiShaders 379 | /Assets/WeFixUrProblem 380 | /Assets/VRLabs/Avatars 3.0 Manager 381 | /Assets/VRCSDK 382 | /Assets/VRChat Avatar Height Chart 383 | /Assets/Sit_Pose_By_Manish.anim 384 | /Assets/prefab-id-v1_avtr_f0d12a2e-f980-474b-a331-4c91a744673c_8517975691.prefab 385 | /Assets/prefab-id-v1_avtr_f0d12a2e-f980-474b-a331-4c91a744673c_7391243656.prefab 386 | /Thry 387 | /Temp 388 | /Resources 389 | /ProjectSettings 390 | /VRC.SDKBase.Editor.ShaderStripping.csproj 391 | /VRC.SDKBase.Editor.BuildPipeline.Player.csproj 392 | /VRC.SDKBase.Editor.BuildPipeline.csproj 393 | /UnityEngine.UI.Player.csproj 394 | /UnityEngine.UI.csproj 395 | /UnityEngine.TestRunner.Player.csproj 396 | /UnityEngine.TestRunner.csproj 397 | /UnityEditor.UI.csproj 398 | /UnityEditor.TestRunner.csproj 399 | /Unity.XR.Oculus.Editor.csproj 400 | /Unity.VSCode.Editor.csproj 401 | /Unity.VisualStudio.Editor.csproj 402 | /Unity.Timeline.Player.csproj 403 | /Unity.Timeline.Editor.csproj 404 | /Unity.Timeline.csproj 405 | /Unity.TextMeshPro.Player.csproj 406 | /Unity.TextMeshPro.Editor.csproj 407 | /Unity.TextMeshPro.csproj 408 | /Unity.Rider.Editor.csproj 409 | /Unity.PlasticSCM.Editor.csproj 410 | /Unity.CollabProxy.Editor.csproj 411 | /ThryAssemblyDefinition.csproj 412 | /Kylin Test.sln 413 | /Assembly-CSharp.Player.csproj 414 | /Assembly-CSharp.csproj 415 | /Assembly-CSharp-Editor.csproj 416 | /.vsconfig 417 | /Assets/VRCFaceTracking/Tools/Binary Parameter Tool/Editor/Test.controller 418 | /Assets/VRCFaceTracking/Tools/Binary Parameter Tool/Editor/AllParams.asset 419 | -------------------------------------------------------------------------------- /Assets/VRCFaceTracking/Tools/Binary Parameter Tool/Editor/BinaryParameterFloatDriver.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEditor; 4 | using UnityEditor.Animations; 5 | using UnityEngine; 6 | using System.IO; 7 | 8 | namespace VRCFaceTracking.EditorTools 9 | { 10 | public class BinaryParameterFloatDriver 11 | { 12 | public static AnimationClip CreateFloatDriverAnimation(string baseParamName, float parameterValue) 13 | { 14 | AnimationClip _animationClip = new AnimationClip(); 15 | 16 | AnimationCurve _curve = new AnimationCurve(new Keyframe(0.0f, parameterValue)); 17 | 18 | _animationClip.SetCurve("", typeof(Animator), baseParamName, _curve); 19 | 20 | if (!Directory.Exists("Assets/VRCFaceTracking/Generated/Anims/")) 21 | { 22 | Directory.CreateDirectory("Assets/VRCFaceTracking/Generated/Anims/"); 23 | } 24 | 25 | string[] guid = (AssetDatabase.FindAssets(baseParamName + parameterValue + "Float")); 26 | 27 | if (guid.Length == 0) 28 | { 29 | AssetDatabase.CreateAsset(_animationClip, "Assets/VRCFaceTracking/Generated/Anims/" + baseParamName + parameterValue + "Float.anim"); 30 | AssetDatabase.SaveAssets(); 31 | } 32 | 33 | else 34 | { 35 | _animationClip = (AnimationClip)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid[0]), typeof(AnimationClip)); 36 | } 37 | 38 | return _animationClip; 39 | } 40 | 41 | public static AnimationClip CreateFloatDriverAnimation(string baseParamName, string animName, float parameterValue) 42 | { 43 | AnimationClip _animationClip = new AnimationClip(); 44 | 45 | AnimationCurve _curve = new AnimationCurve(new Keyframe(0.0f, parameterValue)); 46 | 47 | _animationClip.SetCurve("", typeof(Animator), baseParamName, _curve); 48 | 49 | if (!Directory.Exists("Assets/VRCFaceTracking/Generated/Anims/")) 50 | { 51 | Directory.CreateDirectory("Assets/VRCFaceTracking/Generated/Anims/"); 52 | } 53 | 54 | string[] guid = (AssetDatabase.FindAssets(animName)); 55 | 56 | if (guid.Length == 0) 57 | { 58 | AssetDatabase.CreateAsset(_animationClip, "Assets/VRCFaceTracking/Generated/Anims/" + animName + ".anim"); 59 | AssetDatabase.SaveAssets(); 60 | } 61 | 62 | else 63 | { 64 | _animationClip = (AnimationClip)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid[0]), typeof(AnimationClip)); 65 | } 66 | 67 | return _animationClip; 68 | } 69 | 70 | public static AnimationClip[] CreateFloatSmootherAnimation(string baseParamName, float initThreshold = 0, float finalThreshold = 1) 71 | { 72 | AnimationClip _animationClip1 = new AnimationClip(); 73 | AnimationClip _animationClip2 = new AnimationClip(); 74 | 75 | AnimationCurve _curve1 = new AnimationCurve(new Keyframe(0.0f, initThreshold)); 76 | AnimationCurve _curve2 = new AnimationCurve(new Keyframe(0.0f, finalThreshold)); 77 | 78 | _animationClip1.SetCurve("", typeof(Animator), baseParamName, _curve1); 79 | _animationClip2.SetCurve("", typeof(Animator), baseParamName, _curve2); 80 | 81 | if (!Directory.Exists("Assets/VRCFaceTracking/Generated/Anims/")) 82 | { 83 | Directory.CreateDirectory("Assets/VRCFaceTracking/Generated/Anims/"); 84 | } 85 | 86 | string[] guid = (AssetDatabase.FindAssets(baseParamName + initThreshold + "Smoother.anim")); 87 | 88 | if (guid.Length == 0) 89 | { 90 | AssetDatabase.CreateAsset(_animationClip1, "Assets/VRCFaceTracking/Generated/Anims/"+ baseParamName + initThreshold + "Smoother.anim"); 91 | AssetDatabase.SaveAssets(); 92 | } 93 | 94 | else 95 | { 96 | _animationClip1 = (AnimationClip)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid[0]), typeof(AnimationClip)); 97 | } 98 | 99 | guid = (AssetDatabase.FindAssets(baseParamName + finalThreshold + "Smoother.anim")); 100 | 101 | if (guid.Length == 0) 102 | { 103 | AssetDatabase.CreateAsset(_animationClip2, "Assets/VRCFaceTracking/Generated/Anims/" + baseParamName + finalThreshold + "Smoother.anim"); 104 | AssetDatabase.SaveAssets(); 105 | } 106 | 107 | else 108 | { 109 | _animationClip2 = (AnimationClip)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid[0]), typeof(AnimationClip)); 110 | } 111 | 112 | return new AnimationClip[] { _animationClip1, _animationClip2 }; 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Assets/VRCFaceTracking/Tools/Binary Parameter Tool/Editor/BinaryParameterScript.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor.Animations; 3 | using UnityEditor; 4 | using System; 5 | 6 | namespace VRCFaceTracking.EditorTools 7 | { 8 | public class BinaryStateMachine 9 | { 10 | public AnimatorController animatorController; 11 | 12 | public AnimationClip initClip; 13 | public AnimationClip finalClip; 14 | public AnimationClip finalNegativeClip; 15 | 16 | public string baseParamName; 17 | 18 | public int binarySize; 19 | 20 | public float min; 21 | public float max; 22 | public float minNeg; 23 | public float maxNeg; 24 | public float duration; 25 | 26 | public bool nextStateInterrupt; 27 | public bool isCombined; 28 | public bool writeDefaults; 29 | 30 | public BinaryStateMachine() 31 | { 32 | animatorController = new AnimatorController(); 33 | 34 | initClip = new AnimationClip(); 35 | finalClip = new AnimationClip(); 36 | finalNegativeClip = new AnimationClip(); 37 | 38 | baseParamName = "BaseParam"; 39 | 40 | binarySize = 4; 41 | 42 | min = 0f; 43 | max = 1f; 44 | minNeg = 0f; 45 | maxNeg = 1f; 46 | duration = 0.1f; 47 | 48 | nextStateInterrupt = true; 49 | writeDefaults = true; 50 | } 51 | 52 | public void CreateBinaryLayer() 53 | { 54 | 55 | // Creating Parameters inside of the Animator Controller. 56 | CheckAndCreateBinaryParameters(baseParamName, animatorController, binarySize); 57 | 58 | // Create BinaryBlend parameter if it does not exist. Unity shenanaginsssss. 59 | ParameterTools.CheckAndCreateParameter("BinaryBlend", animatorController, 1); 60 | 61 | // Clear out existing ...Binary layers to make-way for an updated one 62 | for (int i = 0; i < animatorController.layers.Length; i++) 63 | if (animatorController.layers[i].name == baseParamName + " Binary") 64 | { 65 | animatorController.RemoveLayer(i); 66 | } 67 | 68 | // Creating a layer object since the default weight can not be assigned after creation. 69 | AnimatorControllerLayer layer = new AnimatorControllerLayer 70 | { 71 | name = baseParamName + " Binary", 72 | stateMachine = new AnimatorStateMachine 73 | { 74 | hideFlags = HideFlags.HideInHierarchy 75 | }, 76 | defaultWeight = 1f 77 | }; 78 | 79 | // Store Layer into Animator Controller, as creating a Layer object is not serialized unless we store it inside an asset. 80 | if (AssetDatabase.GetAssetPath(animatorController) != string.Empty) 81 | { 82 | AssetDatabase.AddObjectToAsset(layer.stateMachine, AssetDatabase.GetAssetPath(animatorController)); 83 | } 84 | 85 | animatorController.AddLayer(layer); 86 | 87 | var rootStateMachine = layer.stateMachine; 88 | 89 | /* IMPLEMENT IN NEXT UPDATE PLS LOL 90 | // Creating branching Binary State Machine 91 | CreateBranchingBinaryStatesInMachine(baseParamName, binarySize, rootStateMachine, initClip, finalClip, writeDefaults, duration, nextStateInterrupt, min, max); 92 | */ 93 | 94 | // Creating branching Binary State Machine 95 | CreateUniformBinaryStatesInMachine(baseParamName, binarySize, rootStateMachine, initClip, finalClip, writeDefaults, duration, nextStateInterrupt, min, max); 96 | } 97 | 98 | public void CreateCombinedBinaryLayer() 99 | { 100 | // Creating Parameters inside of the Animator Controller. Will be using a list to keep track of the tracking params for later. 101 | CheckAndCreateBinaryParameters(baseParamName, animatorController, binarySize); 102 | 103 | // Create BinaryBlend parameter if it does not exist. Unity shenanaginsssss. 104 | ParameterTools.CheckAndCreateParameter("BinaryBlend", animatorController, 1); 105 | 106 | // Create ...Negative parameter if it does not exist. 107 | ParameterTools.CheckAndCreateParameter(baseParamName + "Negative", animatorController, 4); 108 | 109 | // Clear out existing ...Binary layers to make-way for an updated one 110 | for (int i = 0; i < animatorController.layers.Length; i++) 111 | if (animatorController.layers[i].name == baseParamName + " Binary") 112 | { 113 | animatorController.RemoveLayer(i); 114 | } 115 | 116 | // Creating a layer object since the default weight can not be assigned after creation. 117 | AnimatorControllerLayer layer = new AnimatorControllerLayer 118 | { 119 | name = baseParamName + " Binary", 120 | stateMachine = new AnimatorStateMachine 121 | { 122 | hideFlags = HideFlags.HideInHierarchy 123 | }, 124 | defaultWeight = 1f 125 | }; 126 | 127 | // Store Layer into Animator Controller, as creating a Layer object is not serialized unless we store it inside an asset. 128 | if (AssetDatabase.GetAssetPath(animatorController) != string.Empty) 129 | { 130 | AssetDatabase.AddObjectToAsset(layer.stateMachine, AssetDatabase.GetAssetPath(animatorController)); 131 | } 132 | 133 | animatorController.AddLayer(layer); 134 | 135 | var rootStateMachine = layer.stateMachine; 136 | 137 | // Creating a Combined Binary State Machine 138 | CreateCombinedUniformBinaryStatesInMachine(baseParamName, binarySize, rootStateMachine, initClip, finalClip, finalNegativeClip, writeDefaults, duration, nextStateInterrupt, min, max, minNeg, maxNeg); 139 | } 140 | 141 | 142 | private static void CheckAndCreateBinaryParameters(string name, AnimatorController animatorController, int binarySize) 143 | { 144 | // Creating Parameters inside of the Animator Controller. Will be using a list to keep track of the tracking params for later. 145 | int binarySteps = (int)Mathf.Pow(2, binarySize); 146 | int binarySizeTemp = 1; 147 | 148 | bool _exists = false; 149 | for (int i = 1; i < binarySteps; i++) 150 | { 151 | if (i == binarySizeTemp) 152 | { 153 | for (int j = 0; j < animatorController.parameters.Length; j++) 154 | { 155 | 156 | if (animatorController.parameters[j].name == name + i) 157 | { 158 | _exists = true; 159 | break; 160 | } 161 | } 162 | 163 | if (_exists) 164 | { 165 | _exists = false; 166 | binarySizeTemp *= 2; 167 | continue; 168 | } 169 | 170 | animatorController.AddParameter(name + i, AnimatorControllerParameterType.Bool); 171 | 172 | binarySizeTemp *= 2; 173 | } 174 | } 175 | } 176 | 177 | private static void CreateCombinedUniformBinaryStatesInMachine(string name, int binarySize, AnimatorStateMachine stateMachine, AnimationClip initClip, AnimationClip finalClip, AnimationClip finalNegativeClip, bool writeDefaults, float duration, bool nextStateInterrupt, float min, float max, float minNeg, float maxNeg) 178 | { 179 | int negativeCount = 1; 180 | 181 | int binarySteps = (int)Mathf.Pow(2, binarySize); 182 | 183 | int minSteps = (int)((min + .05) * binarySteps); 184 | int maxSteps = (int)((max - .05) * binarySteps); 185 | int minNegSteps = (int)((minNeg + .05) * binarySteps); 186 | int maxNegSteps = (int)((maxNeg - .05) * binarySteps); 187 | 188 | AnimatorState[] states = new AnimatorState[binarySteps]; 189 | 190 | stateMachine.name = name + " Binary State Machine"; 191 | stateMachine.anyStatePosition = new Vector3(20, 0, 0); 192 | stateMachine.entryPosition = new Vector3 193 | ( 194 | 20, 195 | stateMachine.anyStatePosition.y - 5 - Mathf.Cos(0) * (150 + binarySteps * 4), 196 | 0 197 | ); 198 | 199 | var basisState = stateMachine.AddState(name + "0", new Vector3 200 | ( 201 | stateMachine.anyStatePosition.x - 20 - Mathf.Sin(0) * (200 + binarySteps * 8), 202 | stateMachine.anyStatePosition.y - 5 - Mathf.Cos(0) * (100 + binarySteps * 4), 203 | 0 204 | )); 205 | 206 | var _basisAnyStateTransition = stateMachine.AddAnyStateTransition(basisState); 207 | 208 | for (int j = 0; j < binarySize; j++) 209 | { 210 | _basisAnyStateTransition.AddCondition(AnimatorConditionMode.IfNot, 0, name + Mathf.Pow(2, j)); 211 | 212 | _basisAnyStateTransition.duration = duration; 213 | _basisAnyStateTransition.canTransitionToSelf = false; 214 | if (nextStateInterrupt) 215 | { 216 | _basisAnyStateTransition.interruptionSource = TransitionInterruptionSource.Destination; 217 | _basisAnyStateTransition.orderedInterruption = true; 218 | } 219 | 220 | 221 | } 222 | 223 | basisState.motion = initClip; 224 | basisState.writeDefaultValues = writeDefaults; 225 | 226 | while (negativeCount != 0) 227 | { 228 | // Creating all the binary states and transitions 229 | for (int i = 1; i < binarySteps; i++) 230 | { 231 | states[i] = stateMachine.AddState(name + i * negativeCount, new Vector3 232 | ( 233 | stateMachine.anyStatePosition.x - 20 - Mathf.Sin(((float)i / binarySteps) * Mathf.PI * (-1) * negativeCount) * (200 + binarySteps * 8), 234 | stateMachine.anyStatePosition.y - 5 - Mathf.Cos(((float)i / binarySteps) * Mathf.PI) * (100 + binarySteps * 4), 235 | 0 236 | )); 237 | 238 | var _anyStateTransition = stateMachine.AddAnyStateTransition(states[i]); 239 | 240 | for (int j = 0; j < binarySize; j++) 241 | { 242 | int _conditionSetTrue = (i >> j) & 1; 243 | 244 | if (_conditionSetTrue == 1) 245 | _anyStateTransition.AddCondition(AnimatorConditionMode.If, 0, name + Mathf.Pow(2, j)); 246 | else _anyStateTransition.AddCondition(AnimatorConditionMode.IfNot, 0, name + Mathf.Pow(2, j)); 247 | 248 | _anyStateTransition.duration = duration; 249 | _anyStateTransition.canTransitionToSelf = false; 250 | if (nextStateInterrupt) 251 | { 252 | _anyStateTransition.interruptionSource = TransitionInterruptionSource.Destination; 253 | _anyStateTransition.orderedInterruption = true; 254 | } 255 | } 256 | 257 | if (negativeCount == 1) 258 | _anyStateTransition.AddCondition(AnimatorConditionMode.IfNot, 0, name + "Negative"); 259 | else _anyStateTransition.AddCondition(AnimatorConditionMode.If, 0, name + "Negative"); 260 | 261 | BlendTree _blendTree = new BlendTree 262 | { 263 | blendType = BlendTreeType.Simple1D, 264 | hideFlags = HideFlags.HideInHierarchy, 265 | blendParameter = "BinaryBlend", 266 | name = name + (i * negativeCount), 267 | useAutomaticThresholds = false 268 | }; 269 | 270 | // Need this function to serialize the BlendTrees, otherwise they go byebye 271 | if (AssetDatabase.GetAssetPath(stateMachine) != string.Empty) 272 | { 273 | AssetDatabase.AddObjectToAsset(_blendTree, AssetDatabase.GetAssetPath(stateMachine)); 274 | } 275 | 276 | if (negativeCount == 1) 277 | { 278 | _blendTree.AddChild(initClip, minSteps + (int)((-1) * (i * (binarySteps) / (binarySteps - 1)))); 279 | _blendTree.AddChild(finalClip, maxSteps - i * (binarySteps) / (binarySteps - 1)); 280 | } 281 | 282 | if (negativeCount == -1) 283 | { 284 | _blendTree.AddChild(initClip, minNegSteps + (int)((-1) * (i * (binarySteps) / (binarySteps - 1)))); 285 | _blendTree.AddChild(finalNegativeClip, maxNegSteps - i * (binarySteps) / (binarySteps - 1)); 286 | } 287 | 288 | states[i].motion = _blendTree; 289 | states[i].writeDefaultValues = writeDefaults; 290 | } 291 | if (negativeCount == -1) 292 | negativeCount = 0; 293 | 294 | if (negativeCount == 1) 295 | negativeCount = -1; 296 | } 297 | } 298 | 299 | private static void CreateUniformBinaryStatesInMachine(string name, int binarySize, AnimatorStateMachine stateMachine, AnimationClip initClip, AnimationClip finalClip, bool writeDefaults, float duration, bool nextStateInterrupt, float min, float max) 300 | { 301 | int binarySteps = (int)Mathf.Pow(2, binarySize); 302 | 303 | int minSteps = (int)((min + .05) * binarySteps); 304 | int maxSteps = (int)((max - .05) * binarySteps); 305 | 306 | AnimatorState[] states = new AnimatorState[binarySteps]; 307 | 308 | for (int i = 0; i < binarySteps; i++) 309 | { 310 | 311 | stateMachine.name = name + " Binary State Machine"; 312 | stateMachine.anyStatePosition = new Vector3(20, 0, 0); 313 | stateMachine.entryPosition = new Vector3 314 | ( 315 | 20, 316 | stateMachine.anyStatePosition.y - 5 - Mathf.Cos(0) * (150 + binarySteps * 4), 317 | 0 318 | ); 319 | 320 | 321 | states[i] = stateMachine.AddState(name + i, new Vector3 322 | ( 323 | stateMachine.anyStatePosition.x - 20 - Mathf.Sin((i / (float)binarySteps) * Mathf.PI * 2f) * (200 + binarySteps * 8), 324 | stateMachine.anyStatePosition.y - 5 - Mathf.Cos((i / (float)binarySteps) * Mathf.PI * 2f) * (100 + binarySteps * 4), 325 | 0 326 | )); 327 | 328 | var _anyStateTransition = stateMachine.AddAnyStateTransition(states[i]); 329 | 330 | for (int j = 0; j < binarySize; j++) 331 | { 332 | int _conditionSetTrue = (i >> j) & 1; 333 | 334 | if (_conditionSetTrue == 1) 335 | _anyStateTransition.AddCondition(AnimatorConditionMode.If, 0, name + Mathf.Pow(2, j)); 336 | else _anyStateTransition.AddCondition(AnimatorConditionMode.IfNot, 0, name + Mathf.Pow(2, j)); 337 | 338 | _anyStateTransition.duration = duration; 339 | _anyStateTransition.canTransitionToSelf = false; 340 | if (nextStateInterrupt) 341 | { 342 | _anyStateTransition.interruptionSource = TransitionInterruptionSource.Destination; 343 | _anyStateTransition.orderedInterruption = true; 344 | } 345 | } 346 | 347 | BlendTree _blendTree = new BlendTree 348 | { 349 | blendType = BlendTreeType.Simple1D, 350 | hideFlags = HideFlags.HideInHierarchy, 351 | blendParameter = "BinaryBlend", 352 | name = name + i, 353 | useAutomaticThresholds = false, 354 | }; 355 | 356 | // Need this function to serialize the BlendTrees, otherwise they go byebye 357 | if (AssetDatabase.GetAssetPath(stateMachine) != string.Empty) 358 | { 359 | AssetDatabase.AddObjectToAsset(_blendTree, AssetDatabase.GetAssetPath(stateMachine)); 360 | } 361 | 362 | _blendTree.AddChild(initClip, minSteps + (int)((-1) * (i * (binarySteps) / (binarySteps)))); 363 | _blendTree.AddChild(finalClip, maxSteps - i * (binarySteps) / (binarySteps)); 364 | 365 | states[i].motion = _blendTree; 366 | states[i].writeDefaultValues = writeDefaults; 367 | } 368 | } 369 | 370 | private static void CreateBranchingBinaryStatesInMachine(string name, int binarySize, AnimatorStateMachine stateMachine, AnimationClip initClip, AnimationClip finalClip, bool writeDefaults, float duration, bool nextStateInterrupt, float min, float max, AnimationClip finalNegativeClip = null, float minNeg = 0, float maxNeg = 0) 371 | { 372 | // Skips creating the negative & positive branch 373 | bool skipNegative = false; 374 | if (finalNegativeClip == null) 375 | skipNegative = true; 376 | 377 | // How many steps in-between the minimum and maximum value. 378 | int binarySteps = (int)Mathf.Pow(2, binarySize); 379 | 380 | int minSteps = (int)((min + .05) * binarySteps); 381 | int maxSteps = (int)((max - .05) * binarySteps); 382 | 383 | stateMachine.name = name + " Binary State Machine"; 384 | stateMachine.entryPosition = new Vector3(0, 20, 0); 385 | stateMachine.anyStatePosition = new Vector3 386 | ( 387 | 20, 388 | stateMachine.entryPosition.x - 10 - Mathf.Cos(0) * (150 + binarySteps * 4), 389 | 0 390 | ); 391 | 392 | AnimatorState[] finalStates = new AnimatorState[binarySteps]; 393 | 394 | for (int i = 0; i < finalStates.Length; i++) 395 | { 396 | finalStates[i] = stateMachine.AddState("test"); 397 | } 398 | 399 | for (int i = 0; i < binarySteps; i++) 400 | { 401 | // Exit state conditions 402 | for (int j = 0; j < binarySize; j++) 403 | { 404 | AnimatorStateTransition _exitStateTransition = finalStates[i].AddExitTransition(); 405 | 406 | int _conditionSetTrue = (i >> j) & 1; 407 | 408 | if (_conditionSetTrue == 1) 409 | _exitStateTransition.AddCondition(AnimatorConditionMode.IfNot, 0, name + Mathf.Pow(2, j)); 410 | else _exitStateTransition.AddCondition(AnimatorConditionMode.If, 0, name + Mathf.Pow(2, j)); 411 | 412 | _exitStateTransition.duration = 0; 413 | } 414 | 415 | BlendTree _blendTree = new BlendTree 416 | { 417 | blendType = BlendTreeType.Simple1D, 418 | hideFlags = HideFlags.HideInHierarchy, 419 | blendParameter = "BinaryBlend", 420 | name = name + i, 421 | useAutomaticThresholds = false, 422 | }; 423 | 424 | // Need this function to serialize the BlendTrees, otherwise they go byebye 425 | if (AssetDatabase.GetAssetPath(stateMachine) != string.Empty) 426 | { 427 | AssetDatabase.AddObjectToAsset(_blendTree, AssetDatabase.GetAssetPath(stateMachine)); 428 | } 429 | 430 | _blendTree.AddChild(initClip, minSteps + (int)((-1) * (i * (binarySteps) / (binarySteps)))); 431 | _blendTree.AddChild(finalClip, maxSteps - i * (binarySteps) / (binarySteps)); 432 | 433 | finalStates[i].motion = _blendTree; 434 | finalStates[i].writeDefaultValues = writeDefaults; 435 | } 436 | 437 | ConvergeBinaryEndStates(finalStates, stateMachine, name); 438 | } 439 | 440 | private static void ConvergeBinaryEndStates(AnimatorState[] states, AnimatorStateMachine stateMachine, string name, int binaryIter = 1) 441 | { 442 | // Breaks out of recursion once there are 2 states left. 443 | if (states.Length == 2) 444 | { 445 | AnimatorState basisState = stateMachine.AddState("test"); 446 | 447 | AnimatorStateTransition[] basistransitions = new AnimatorStateTransition[2]; 448 | 449 | basistransitions[0] = basisState.AddTransition(states[0]); 450 | 451 | for (int i = 0; i < basistransitions.Length; i++) 452 | { 453 | basistransitions[i] = basisState.AddTransition(states[i]); 454 | basistransitions[i].duration = 0; 455 | basistransitions[i].exitTime = 0; 456 | } 457 | 458 | basistransitions[0].AddCondition(AnimatorConditionMode.IfNot, 0, name + binaryIter); 459 | basistransitions[1].AddCondition(AnimatorConditionMode.If, 0, name + binaryIter); 460 | 461 | return; 462 | } 463 | 464 | // Node states that are to be recursively sent until binary size is 1. 465 | AnimatorState[] nodeStates = new AnimatorState[states.Length / 2]; 466 | 467 | // Assigning the new nodes to the State Machine 468 | for (int i = 0; i < nodeStates.Length; i++) 469 | { 470 | nodeStates[i] = stateMachine.AddState("test"); 471 | } 472 | 473 | // Pair even/odd states and hook them to a node state. The node states will be half the number of binary states 474 | for (int i = 0; i < states.Length; i++) 475 | { 476 | int nodeIter = (int)(Math.Ceiling((i + .5) / 2) - 1); 477 | 478 | AnimatorStateTransition _transition = nodeStates[nodeIter].AddTransition(states[i]); 479 | 480 | if (i % 2 == 1) 481 | _transition.AddCondition(AnimatorConditionMode.If, 0, name + binaryIter); 482 | else 483 | { 484 | _transition.AddCondition(AnimatorConditionMode.IfNot, 0, name + binaryIter); 485 | } 486 | 487 | _transition.duration = 0; 488 | _transition.exitTime = 0; 489 | } 490 | 491 | ConvergeBinaryEndStates(nodeStates, stateMachine, name, binaryIter * 2); 492 | } 493 | 494 | public void CreateSmoothingLayer(float smoothness) 495 | { 496 | AnimatorControllerParameter smootherParam = ParameterTools.CheckAndCreateParameter(baseParamName + "Smoother", animatorController, 1, smoothness); 497 | ParameterTools.CheckAndCreateParameter(baseParamName + "Proxy", animatorController, 1); 498 | ParameterTools.CheckAndCreateParameter(baseParamName, animatorController, 1); 499 | 500 | // Clear out existing ...Binary layers to make-way for an updated one 501 | for (int i = 0; i < animatorController.layers.Length; i++) 502 | if (animatorController.layers[i].name == baseParamName + " Float Smoother") 503 | { 504 | animatorController.RemoveLayer(i); 505 | } 506 | 507 | // Creates an animation layer 508 | AnimatorControllerLayer layer = new AnimatorControllerLayer 509 | { 510 | name = baseParamName + " Float Smoother", 511 | stateMachine = new AnimatorStateMachine 512 | { 513 | hideFlags = HideFlags.HideInHierarchy 514 | }, 515 | defaultWeight = 1f 516 | }; 517 | 518 | // Store Layer into Animator Controller, as creating a Layer object is not serialized unless we store it inside an asset. 519 | if (AssetDatabase.GetAssetPath(animatorController) != string.Empty) 520 | { 521 | AssetDatabase.AddObjectToAsset(layer.stateMachine, AssetDatabase.GetAssetPath(animatorController)); 522 | } 523 | 524 | //Adds the Layer asset to the animator controller 525 | animatorController.AddLayer(layer); 526 | 527 | // Creating 3 blend trees to create the feedback loop 528 | BlendTree rootTree = new BlendTree 529 | { 530 | blendType = BlendTreeType.Simple1D, 531 | hideFlags = HideFlags.HideInHierarchy, 532 | blendParameter = baseParamName + "Smoother", 533 | name = "Root", 534 | useAutomaticThresholds = false 535 | }; 536 | BlendTree falseTree = new BlendTree 537 | { 538 | blendType = BlendTreeType.Simple1D, 539 | hideFlags = HideFlags.HideInHierarchy, 540 | blendParameter = baseParamName + "Proxy", 541 | name = "ProxyBlend", 542 | useAutomaticThresholds = false 543 | }; ; 544 | BlendTree trueTree = new BlendTree 545 | { 546 | blendType = BlendTreeType.Simple1D, 547 | hideFlags = HideFlags.HideInHierarchy, 548 | blendParameter = baseParamName, 549 | name = "TrueBlend", 550 | useAutomaticThresholds = false 551 | }; ; 552 | 553 | // Create smoothing anims 554 | AnimationClip[] driverAnims = BinaryParameterFloatDriver.CreateFloatSmootherAnimation(baseParamName, -1f); 555 | 556 | rootTree.AddChild(falseTree, 0); 557 | rootTree.AddChild(trueTree, 1); 558 | 559 | falseTree.AddChild(driverAnims[0], -1); 560 | falseTree.AddChild(driverAnims[1], 1); 561 | 562 | trueTree.AddChild(driverAnims[0], -1); 563 | trueTree.AddChild(driverAnims[1], 1); 564 | 565 | AssetDatabase.AddObjectToAsset(rootTree, AssetDatabase.GetAssetPath(layer.stateMachine)); 566 | AssetDatabase.AddObjectToAsset(falseTree, AssetDatabase.GetAssetPath(layer.stateMachine)); 567 | AssetDatabase.AddObjectToAsset(trueTree, AssetDatabase.GetAssetPath(layer.stateMachine)); 568 | 569 | AnimatorState state = layer.stateMachine.AddState("Smoother"); 570 | 571 | state.motion = rootTree; 572 | } 573 | 574 | } 575 | } 576 | -------------------------------------------------------------------------------- /Assets/VRCFaceTracking/Tools/Binary Parameter Tool/Editor/BinaryParameterWindow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using UnityEditor.Animations; 4 | using VRC.SDK3.Avatars.Components; 5 | using VRC.SDK3.Avatars.ScriptableObjects; 6 | using System.Collections.Generic; 7 | 8 | namespace VRCFaceTracking.EditorTools 9 | { 10 | public class BinaryParameterWindow : EditorWindow 11 | { 12 | private BinaryStateMachine _binaryStateMachine; 13 | private VRCAvatarDescriptor _avDescriptor; 14 | 15 | private AnimationClip _initClip; 16 | private AnimationClip _finalClip; 17 | private AnimationClip _finalNegativeClip; 18 | 19 | private AnimatorController _animatorController; 20 | private List _controllers; 21 | 22 | private bool _isCombined = false; 23 | private bool _nextStateInterrupt = true; 24 | private bool _writeDefaults = true; 25 | private bool _smooth = true; 26 | private bool _createParametersInDescriptor = true; 27 | 28 | private float _min = 0f; 29 | private float _max = 1f; 30 | private float _minNeg = 0f; 31 | private float _maxNeg = 1f; 32 | private float _duration = 0f; 33 | private float _smoothness = 0.9f; 34 | 35 | private int _binarySize; 36 | private int _binarySizeTemp; 37 | private int _layerSelect = 4; 38 | private int _tab; 39 | 40 | private string _baseParamName; 41 | 42 | readonly private string[] _binarySizeSelection = new string[] 43 | { 44 | "2","4","8","16","32" 45 | }; 46 | 47 | readonly private string[] _animatorSelection = new string[] 48 | { 49 | "Base","Additive","Gesture","Action","FX" 50 | }; 51 | 52 | [MenuItem("Tools/VRCFaceTracking/Binary Parameter Tool")] 53 | public static void ShowWindow() 54 | { 55 | EditorWindow.GetWindow("Binary Parameter Tool"); 56 | } 57 | 58 | private void OnGUI() 59 | { 60 | _binaryStateMachine = new BinaryStateMachine(); 61 | 62 | GUIStyle style = new GUIStyle 63 | { 64 | richText = true 65 | }; 66 | 67 | EditorGUILayout.LabelField("Avatar Properties", style); 68 | /* 69 | _animatorController = (AnimatorController)EditorGUILayout.ObjectField 70 | ( 71 | new GUIContent 72 | ( 73 | "Animator Controller", 74 | "Animator Controller that will have the parameters, animations, transitions, states, and layer added to." 75 | ), 76 | _animatorController, 77 | typeof(AnimatorController), 78 | true 79 | ); 80 | */ 81 | 82 | _avDescriptor = (VRCAvatarDescriptor)EditorGUILayout.ObjectField 83 | ( 84 | new GUIContent 85 | ( 86 | "Avatar", 87 | "The VRC Avatar that will have the Binary Parameters set up on. " + 88 | "The Avatar must have a VRCAvatarDescriptor to show up in this field." 89 | ), 90 | _avDescriptor, 91 | typeof(VRCAvatarDescriptor), 92 | true 93 | ); 94 | 95 | if (_avDescriptor != null) 96 | { 97 | _layerSelect = EditorGUILayout.Popup 98 | ( 99 | new GUIContent 100 | ( 101 | "Layer", 102 | "This selects what VRChat Playable Layer you would like to set up " + 103 | "the following Binary Animation Layer into. A layer must be populated " + 104 | "in order for the tool to properly set up an Animation Layer." 105 | ), 106 | _layerSelect, 107 | _animatorSelection 108 | ); 109 | 110 | _animatorController = AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(_avDescriptor.baseAnimationLayers[_layerSelect].animatorController)); 111 | 112 | _binaryStateMachine.animatorController = _animatorController; 113 | 114 | if (_binaryStateMachine.animatorController == null) 115 | { 116 | EditorGUILayout.HelpBox("This Playable Layer must have an Animator Controller in order for the Binary Parameter Tool to work with it.", MessageType.Warning, true); 117 | return; 118 | } 119 | 120 | EditorGUILayout.Space(); 121 | EditorGUILayout.LabelField("Parameter Properties", style); 122 | 123 | _baseParamName = EditorGUILayout.TextField 124 | ( 125 | new GUIContent 126 | ( 127 | "Parameter", 128 | "The name of the parameter to be converted into a Binary parameter. " + 129 | "These can be found on the VRCFaceTracking GitHub page. Make sure that " + 130 | "when using the same parameter to use the same Binary Resolution, otherwise " + 131 | "animations may have unintended behavior." 132 | ), 133 | _baseParamName); 134 | 135 | _binaryStateMachine.baseParamName = _baseParamName; 136 | 137 | _binarySizeTemp = EditorGUILayout.Popup 138 | ( 139 | new GUIContent 140 | ( 141 | "Binary Resolution", 142 | "How many steps a Binary Parameter can make. Higher values are more accurate, " + 143 | "while lower values are more economic for parameter space. Recommended to use a " + 144 | "Resolution of 16 or less for more space savings." 145 | ), 146 | _binarySizeTemp, 147 | _binarySizeSelection 148 | ); 149 | 150 | _binarySize = _binarySizeTemp + 1; 151 | 152 | _binaryStateMachine.binarySize = _binarySize; 153 | 154 | _isCombined = EditorGUILayout.Toggle 155 | ( 156 | new GUIContent 157 | ( 158 | "Combined Parameter", 159 | "Does this parameter go from positive to negative? " + 160 | "This option will add an extra bool to keep track of the " + 161 | "positive/negative of the parameter." 162 | ), 163 | _isCombined 164 | ); 165 | 166 | _binaryStateMachine.isCombined = _isCombined; 167 | 168 | _createParametersInDescriptor = EditorGUILayout.Toggle 169 | ( 170 | new GUIContent 171 | ( 172 | "Create Parameters", 173 | "Allow the tool to populate the Expressions Parameters " + 174 | "with the listed Binary parameters. Toggle this off if you " + 175 | "would like to be able to just create Binary animations only." 176 | ), 177 | _createParametersInDescriptor 178 | ); 179 | 180 | int _memoryUsage = (_binarySize + (_isCombined ? 1 : 0)); 181 | 182 | EditorGUILayout.HelpBox("Parameter Memory Usage: " + (_memoryUsage).ToString() + " bit" + (_memoryUsage > 1 ? "s" : ""), MessageType.Info, true); 183 | 184 | EditorGUILayout.Space(); 185 | EditorGUILayout.LabelField("Animation Properties", style); 186 | 187 | _tab = GUILayout.Toolbar(_tab, 188 | new GUIContent[] 189 | { 190 | new GUIContent 191 | ( 192 | "Float Parameter", 193 | "This Binary State Machine will drive the Float " + 194 | "parameter listed in the 'Parameter' field above " + 195 | "using Binary parameters. Useful for converting " + 196 | "existing animations that are using floats." 197 | ), 198 | new GUIContent 199 | ( 200 | "Direct Animation", 201 | "This mode creates a Binary State Machine that directly drives " + 202 | "any animations added to the Animation fields below " + 203 | "using Binary parameters." 204 | ) 205 | }); 206 | 207 | if (_tab == 1) 208 | { 209 | _initClip = (AnimationClip)EditorGUILayout.ObjectField 210 | ( 211 | new GUIContent 212 | ( 213 | "Initial Clip", 214 | "Animation Clip that represents when the parameter is at 0." 215 | ), 216 | _initClip, 217 | typeof(AnimationClip), 218 | true 219 | ); 220 | 221 | _binaryStateMachine.initClip = _initClip; 222 | 223 | _finalClip = (AnimationClip)EditorGUILayout.ObjectField 224 | ( 225 | new GUIContent 226 | ( 227 | "Final Clip", 228 | "Animation Clip that represents when the parameter is at 1." 229 | ), 230 | _finalClip, 231 | typeof(AnimationClip), 232 | true 233 | ); 234 | 235 | _binaryStateMachine.finalClip = _finalClip; 236 | 237 | // Min/Max threshold to use for adjusting animations to better fit faces (may become depricated if params get normalized properly on the face tracker) 238 | EditorGUILayout.BeginHorizontal(); 239 | _min = EditorGUILayout.FloatField 240 | ( 241 | new GUIContent 242 | ( 243 | "Min/Max Anim Thresholds", 244 | "When should the animation start/end? Values will be adjusted to " + 245 | "fit within the size of the Binary Parameter." 246 | ), 247 | _min 248 | ); 249 | 250 | _binaryStateMachine.min = _min; 251 | 252 | _max = EditorGUILayout.FloatField(_max); 253 | EditorGUILayout.EndHorizontal(); 254 | 255 | _binaryStateMachine.max = _max; 256 | 257 | if (_isCombined) 258 | { 259 | EditorGUILayout.Space(); 260 | 261 | _finalNegativeClip = (AnimationClip)EditorGUILayout.ObjectField 262 | ( 263 | new GUIContent 264 | ( 265 | "Final Negative Clip", 266 | "Animation Clip that represents when the parameter is at -1. Make sure that it " + 267 | "animates the same properties as the Initial Clip!" 268 | ), 269 | _finalNegativeClip, 270 | typeof(AnimationClip), 271 | true 272 | ); 273 | 274 | _binaryStateMachine.finalNegativeClip = _finalNegativeClip; 275 | 276 | EditorGUILayout.BeginHorizontal(); 277 | _minNeg = EditorGUILayout.FloatField 278 | ( 279 | new GUIContent 280 | ( 281 | "Min/Max Anim Thresholds", 282 | "When should the animation start/end? Values other than (0,1) " + 283 | "might not work as well or be as accurate on lower Binary Bit Resolutions" 284 | ), 285 | _minNeg 286 | ); 287 | 288 | _binaryStateMachine.minNeg = _minNeg; 289 | 290 | _maxNeg = EditorGUILayout.FloatField(_maxNeg); 291 | EditorGUILayout.EndHorizontal(); 292 | 293 | _binaryStateMachine.maxNeg = _maxNeg; 294 | } 295 | } 296 | 297 | if (_tab == 0) 298 | { 299 | _binaryStateMachine.min = 0f; 300 | 301 | _binaryStateMachine.max = 1f; 302 | 303 | if (_isCombined) 304 | { 305 | 306 | _binaryStateMachine.finalNegativeClip = _finalNegativeClip; 307 | 308 | _binaryStateMachine.minNeg = 0f; 309 | 310 | _binaryStateMachine.maxNeg = 1f; 311 | } 312 | } 313 | 314 | EditorGUILayout.Space(); 315 | 316 | if (_tab == 0) 317 | _smooth = EditorGUILayout.Toggle 318 | ( 319 | new GUIContent 320 | ( 321 | "Smoother Float Layer", 322 | "Creates an animation layer that smooths out " + 323 | "the driven float using a feedback loop." 324 | ), 325 | _smooth 326 | ); 327 | 328 | if (_tab == 0 && _smooth) 329 | _smoothness = EditorGUILayout.FloatField 330 | ( 331 | new GUIContent 332 | ( 333 | "Smoothness", 334 | "What percentage of the actual value gets multiplied with the " + 335 | "driven Float parameter. The higher the number the smoother the " + 336 | "parameter gets blended. Recommended 0.9" 337 | ), 338 | _smoothness 339 | ); 340 | 341 | if (!_smooth) 342 | { 343 | _duration = EditorGUILayout.FloatField 344 | ( 345 | new GUIContent 346 | ( 347 | "Transition Duration", 348 | "How long does it take to transition to the active step? Lower values " + 349 | "will be quicker but look more 'steppy', while higher values will look " + 350 | "smoother but may feel 'sluggish' A good middle ground is 0.1 for 8 " + 351 | "Resolution, more duration on less resolution and vice versa" 352 | ), 353 | _duration 354 | ); 355 | 356 | _binaryStateMachine.duration = _duration; 357 | 358 | _nextStateInterrupt = EditorGUILayout.Toggle 359 | ( 360 | new GUIContent 361 | ( 362 | "Next State Interrupt", 363 | "Cant the next state interrupt the current transition? Very " + 364 | "useful in making the animation states better connect with " + 365 | "the current parameter value (less delay)." 366 | ), 367 | _nextStateInterrupt 368 | ); 369 | 370 | _binaryStateMachine.nextStateInterrupt = _nextStateInterrupt; 371 | } 372 | 373 | else 374 | { 375 | _binaryStateMachine.duration = 0; 376 | _binaryStateMachine.nextStateInterrupt = false; 377 | } 378 | 379 | 380 | _writeDefaults = EditorGUILayout.Toggle 381 | ( 382 | new GUIContent 383 | ( 384 | "Write Defaults", 385 | "Can the Animations on this layer set unbound Animation Properties to their default " + 386 | "values? Recommended to keep this off to avoid blendshape animation conflicts. WARNING: " + 387 | "You will run into issues if you have Write Defaults enabled and disabled on different " + 388 | "animations, use a tool like AV3Manager to set Write Defaults to a universal enable/disable." 389 | 390 | ), 391 | _writeDefaults 392 | ); 393 | 394 | _binaryStateMachine.writeDefaults = _writeDefaults; 395 | 396 | EditorGUILayout.Space(); 397 | if (!_isCombined) 398 | { 399 | if (GUILayout.Button 400 | ( 401 | new GUIContent 402 | ( 403 | "Create Binary Parameter Layer", 404 | "Creates a new Layer in the selected Animator Controller as well as a set of states with " + 405 | "set animations, transitions, and parameters that handle the specified Binary Parameter." 406 | ))) 407 | { 408 | if (ParameterTools.AddVRCParameter(_avDescriptor, GenerateBinaryParams(_baseParamName, _binarySize, _isCombined)) | !_createParametersInDescriptor) 409 | { 410 | if (_tab == 0 && !_smooth) 411 | { 412 | ParameterTools.CheckAndCreateParameter(_baseParamName, _animatorController, 1); 413 | 414 | _binaryStateMachine.initClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName, 0f); 415 | _binaryStateMachine.finalClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName, 1f); 416 | } 417 | else if (_tab == 0) 418 | { 419 | ParameterTools.CheckAndCreateParameter(_baseParamName, _animatorController, 1); 420 | 421 | _binaryStateMachine.CreateSmoothingLayer(_smoothness); 422 | 423 | _binaryStateMachine.initClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName + "Proxy", 0f); 424 | _binaryStateMachine.finalClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName + "Proxy", 1f); 425 | } 426 | if (ParameterTools.AddVRCParameter(_avDescriptor, GenerateBinaryParams(_baseParamName, _binarySize, _isCombined))) 427 | { 428 | ParameterTools.RemoveVRCParameter(_avDescriptor, _baseParamName); 429 | _binaryStateMachine.CreateBinaryLayer(); 430 | } 431 | else 432 | EditorGUILayout.HelpBox("Parameters can not fit, or Expressions Parameters do not exist.", MessageType.Warning); 433 | } 434 | } 435 | } 436 | else if (GUILayout.Button 437 | ( 438 | new GUIContent 439 | ( 440 | "Create Combined Binary Parameter Layer", 441 | "Creates a new Layer in the selected Animator Controller as well as a set of states with " + 442 | "set animations, transitions, and parameters that handle the specified Combined Binary Parameter." 443 | ))) 444 | { 445 | if (ParameterTools.AddVRCParameter(_avDescriptor, GenerateBinaryParams(_baseParamName, _binarySize, _isCombined)) | !_createParametersInDescriptor) 446 | { 447 | if (_tab == 0 && !_smooth) 448 | { 449 | ParameterTools.RemoveVRCParameter(_avDescriptor, new VRCExpressionParameters.Parameter 450 | { 451 | name = _baseParamName, 452 | valueType = VRCExpressionParameters.ValueType.Float 453 | }); 454 | ParameterTools.CheckAndCreateParameter(_baseParamName, _animatorController, 1); 455 | 456 | _binaryStateMachine.initClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName, 0f); 457 | _binaryStateMachine.finalClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName, 1f); 458 | _binaryStateMachine.finalNegativeClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName, -1f); 459 | } 460 | else if (_tab == 0) 461 | { 462 | ParameterTools.RemoveVRCParameter(_avDescriptor, _baseParamName); 463 | ParameterTools.CheckAndCreateParameter(_baseParamName, _animatorController, 1); 464 | 465 | _binaryStateMachine.CreateSmoothingLayer(_smoothness); 466 | _binaryStateMachine.initClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName + "Proxy", 0f); 467 | _binaryStateMachine.finalClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName + "Proxy", 1f); 468 | _binaryStateMachine.finalNegativeClip = BinaryParameterFloatDriver.CreateFloatDriverAnimation(_baseParamName + "Proxy", -1f); 469 | } 470 | _binaryStateMachine.CreateCombinedBinaryLayer(); 471 | } 472 | else 473 | EditorGUILayout.HelpBox("Parameters can not fit, or Expressions Parameters do not exist.", MessageType.Warning); 474 | } 475 | EditorGUILayout.HelpBox("Parameters (" + _avDescriptor.expressionParameters.CalcTotalCost() + "/" + VRCExpressionParameters.MAX_PARAMETER_COST + "):" + GenerateParamNames(_baseParamName, _binarySize, _isCombined), MessageType.None); 476 | 477 | } 478 | } 479 | 480 | private string GenerateParamNames(string name, int binarySize, bool isCombined) 481 | { 482 | string paramString = ""; 483 | 484 | for (int i = 0; i < binarySize; i++) 485 | { 486 | paramString += "\n" + name + Mathf.Pow(2, i); 487 | } 488 | 489 | paramString += isCombined ? "\n" + name + "Negative" : ""; 490 | 491 | return paramString; 492 | } 493 | 494 | private List GenerateBinaryParams(string name, int binarySize, bool isCombined) 495 | { 496 | List param = new List(); 497 | 498 | for (int i = 0; i < binarySize; i++) 499 | { 500 | string paramString = name + Mathf.Pow(2, i); 501 | 502 | param.Add 503 | ( 504 | new VRCExpressionParameters.Parameter 505 | { 506 | name = paramString, 507 | valueType = VRCExpressionParameters.ValueType.Bool, 508 | saved = false 509 | } 510 | );; 511 | } 512 | 513 | if (isCombined) 514 | param.Add 515 | ( 516 | new VRCExpressionParameters.Parameter 517 | { 518 | name = _baseParamName + "Negative", 519 | valueType = VRCExpressionParameters.ValueType.Bool, 520 | saved = false 521 | } 522 | ); 523 | 524 | return param; 525 | } 526 | } 527 | } 528 | -------------------------------------------------------------------------------- /Assets/VRCFaceTracking/Tools/Binary Parameter Tool/Editor/ParameterGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEditor; 5 | using UnityEditor.Animations; 6 | using UnityEngine; 7 | using VRC.SDK3.Avatars.Components; 8 | using VRC.SDK3.Avatars.ScriptableObjects; 9 | 10 | namespace VRCFaceTracking.EditorTools 11 | { 12 | public class ParameterTools 13 | { 14 | public static bool AddVRCParameter(VRCAvatarDescriptor avatarDescriptor, List parameters) 15 | { 16 | // Metric to gauge additional Expression Parameter's storage cost 17 | int paramTotalCost = 0; 18 | int maxCost = VRCExpressionParameters.MAX_PARAMETER_COST; 19 | 20 | paramTotalCost += avatarDescriptor.expressionParameters.CalcTotalCost(); 21 | 22 | // Make sure Parameters aren't null 23 | if (avatarDescriptor.expressionParameters == null) 24 | { 25 | Debug.Log("ExpressionsParameters not found!"); 26 | return false; 27 | } 28 | 29 | // Checks to see if parameter already exists; calculate new total parameter cost 30 | foreach (VRCExpressionParameters.Parameter param in parameters) 31 | if (avatarDescriptor.expressionParameters.FindParameter(param.name) == null) 32 | paramTotalCost += (param.valueType == VRCExpressionParameters.ValueType.Bool ? 1 : 8); 33 | 34 | // exit if expected total parameter cost exceeds max of the parameters'`4 bits 35 | if (paramTotalCost > maxCost) 36 | { 37 | Debug.Log("Additional Expression Parameters exceed maximum storage. : " + paramTotalCost); 38 | return false; 39 | } 40 | 41 | // Instantiate and Save to Database 42 | VRCExpressionParameters newParameters = avatarDescriptor.expressionParameters; 43 | string assetPath = AssetDatabase.GetAssetPath(avatarDescriptor.expressionParameters); 44 | if (assetPath != String.Empty) 45 | { 46 | AssetDatabase.RemoveObjectFromAsset(avatarDescriptor.expressionParameters); 47 | AssetDatabase.CreateAsset(newParameters, assetPath); 48 | avatarDescriptor.expressionParameters = newParameters; 49 | } 50 | 51 | foreach (VRCExpressionParameters.Parameter parameter in parameters) 52 | { 53 | // Make sure the parameter doesn't already exist 54 | VRCExpressionParameters.Parameter foundParameter = newParameters.FindParameter(parameter.name); 55 | if (foundParameter == null || foundParameter.valueType != parameter.valueType) 56 | { 57 | // Add the parameter 58 | List betterParametersBecauseItsAListInstead = 59 | newParameters.parameters.ToList(); 60 | betterParametersBecauseItsAListInstead.Add(parameter); 61 | newParameters.parameters = betterParametersBecauseItsAListInstead.ToArray(); 62 | } 63 | } 64 | return true; 65 | } 66 | 67 | public static bool RemoveVRCParameter(VRCAvatarDescriptor avatarDescriptor, List parameters) 68 | { 69 | // Make sure Parameters aren't null 70 | if (avatarDescriptor.expressionParameters == null) 71 | { 72 | Debug.Log("ExpressionsParameters not found!"); 73 | return false; 74 | } 75 | 76 | // Instantiate and Save to Database 77 | VRCExpressionParameters newParameters = avatarDescriptor.expressionParameters; 78 | string assetPath = AssetDatabase.GetAssetPath(avatarDescriptor.expressionParameters); 79 | if (assetPath != String.Empty) 80 | { 81 | AssetDatabase.RemoveObjectFromAsset(avatarDescriptor.expressionParameters); 82 | AssetDatabase.CreateAsset(newParameters, assetPath); 83 | avatarDescriptor.expressionParameters = newParameters; 84 | } 85 | 86 | 87 | foreach (VRCExpressionParameters.Parameter parameter in parameters) 88 | { 89 | // Check and see if parameter exists 90 | VRCExpressionParameters.Parameter foundParameter = newParameters.FindParameter(parameter.name); 91 | if (foundParameter == null || foundParameter.valueType != parameter.valueType) 92 | { 93 | // Remove the parameter 94 | List betterParametersBecauseItsAListInstead = 95 | newParameters.parameters.ToList(); 96 | betterParametersBecauseItsAListInstead.Remove(foundParameter); 97 | newParameters.parameters = betterParametersBecauseItsAListInstead.ToArray(); 98 | } 99 | } 100 | return true; 101 | } 102 | 103 | public static bool RemoveVRCParameter(VRCAvatarDescriptor avatarDescriptor, VRCExpressionParameters.Parameter parameter) 104 | { 105 | // Make sure Parameters aren't null 106 | if (avatarDescriptor.expressionParameters == null) 107 | { 108 | Debug.Log("ExpressionsParameters not found!"); 109 | return false; 110 | } 111 | 112 | // Instantiate and Save to Database 113 | VRCExpressionParameters newParameters = avatarDescriptor.expressionParameters; 114 | string assetPath = AssetDatabase.GetAssetPath(avatarDescriptor.expressionParameters); 115 | if (assetPath != String.Empty) 116 | { 117 | AssetDatabase.RemoveObjectFromAsset(avatarDescriptor.expressionParameters); 118 | AssetDatabase.CreateAsset(newParameters, assetPath); 119 | avatarDescriptor.expressionParameters = newParameters; 120 | } 121 | 122 | // Check and see if parameter exists 123 | VRCExpressionParameters.Parameter foundParameter = newParameters.FindParameter(parameter.name); 124 | if (newParameters.FindParameter(parameter.name) != null) 125 | { 126 | // Remove the parameter 127 | List betterParametersBecauseItsAListInstead = 128 | newParameters.parameters.ToList(); 129 | betterParametersBecauseItsAListInstead.Remove(newParameters.FindParameter(parameter.name)); 130 | newParameters.parameters = betterParametersBecauseItsAListInstead.ToArray(); 131 | } 132 | return true; 133 | } 134 | 135 | public static AnimatorControllerParameter CheckAndCreateParameter(string paramName, AnimatorController animatorController, int type, double defaultVal = 0) 136 | { 137 | AnimatorControllerParameter param = new AnimatorControllerParameter(); 138 | 139 | param.name = paramName; 140 | param.type = (AnimatorControllerParameterType)type; 141 | param.defaultFloat = (float)defaultVal; 142 | param.defaultInt = (int)defaultVal; 143 | 144 | 145 | AnimatorControllerParameterType _typeEnum = (AnimatorControllerParameterType)type; 146 | 147 | if (animatorController.parameters.Length == 0) 148 | animatorController.AddParameter(paramName, _typeEnum); 149 | 150 | for (int j = 0; j <= animatorController.parameters.Length - 1; j++) 151 | { 152 | 153 | if (animatorController.parameters[j].name == paramName) 154 | { 155 | break; 156 | } 157 | 158 | if (animatorController.parameters.Length - 1 == j) 159 | animatorController.AddParameter(param); 160 | } 161 | 162 | return param; 163 | } 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NOTICE 2 | ### **Binary Parameter Tool is no longer maintained or supported.** 3 | 4 | The Binary animation conversion generated using this tool is 5 | very outdated and is superceeded by other projects. Please consider using 6 | these other projects as superior alternatives to Binary Parameter Tool. 7 | These other tools provide more stable and cleaner Binary parameter conversions 8 | for VRCFaceTracking. 9 | 10 | * [Razgriz's VRCFTGenerator](https://github.com/rrazgriz/VRCFTGenerator) (All-in-One VRCFT animation tool) 11 | * OSCmooth [Binary Parameters](https://github.com/Adjerry91/OSCmooth/releases/tag/V1.1.1-BETA) fork (Directly generates smoothed out Binary parameters). 12 | 13 | ### To further drive this point, I am taking down all releases of this tool. 14 | The source will still be available but 15 | seriously consider these other projects for Binary parameter implementations. 16 | 17 | ### Thank you for your support so far! 18 | This was one of my very first forrays into Unity tool development. I've learned a lot 19 | by making this tool. There is definitely a lot I can definitely improve upon, but I am happy with where this tool has 20 | lead me from a learning perspective. I hope to make more awesome stuff in the future! 21 | 22 | *** 23 | 24 | # **The rest of the README is for archival purposes.** 25 | Information below is no longer applicable or accurate. Please consider the linked above projects instead. 26 | 27 | *** 28 | 29 | # Binary Parameter Tool 30 | ### Simple Unity Editor tool that helps create Animation Layers that a Binary Parameter can interface with for the VRCFaceTracking Melonloader mod. 31 | 32 | ![binary parameter tool showcase](https://user-images.githubusercontent.com/74634856/148631235-9653f177-b818-4241-b13f-86892bfd6317.gif) 33 | 34 | # **Instructions** 35 | Simply install the included .unitypackage in your Unity project! This tool will be available on the toolbar under Tools / VRCFaceTracking. 36 | * Tooltips available on each setting that explain what to input or do! 37 | 38 | # **Features** 39 | ### Binary Parameter Tool comes with a few features, allowing quick and easy creation of Binary Parameter compatible Animation Layers. More is planned! 40 | 41 | * Automatically create a Binary Parameter compatible Animation Layer with a few user-defined settings 42 | * Configure the size of a Binary Parameter 43 | * Supports Combined Parameters 44 | * Tooltips on each setting. 45 | 46 | ### **Planned** 47 | * Automatically add Binary Parameters to the Parameter List on the VRC Avatar Descriptor. 48 | * Ability to configure multiple parameters at a time (currently only one parameter can be created at a time). 49 | * Potential support for saving and sharing Binary configurations with above feature. 50 | --------------------------------------------------------------------------------