Example #1
0
        public static void SetAllClipAnimationAvatarMask(ModelImporter importer, GetterIsActivatableTransform logic, int at = -1)
        {
            if (importer == null)
            {
                throw new ArgumentNullException("importer");
            }
            var mask = new AvatarMask();

            mask.transformCount = importer.transformPaths.Length;
            for (int i = 0; i < mask.transformCount; i++)
            {
                var path = importer.transformPaths[i];
                mask.SetTransformPath(i, path);
                mask.SetTransformActive(i, logic(path));
                //mask.SetTransformActive(i, (!System.IO.Path.GetFileName(path).StartsWith("AttachBone_") || Array.IndexOf(importer.humanDescription.skeleton, path) >= 0));
            }

            var so           = new SerializedObject(importer);
            var updateMethod = importer.GetType().GetMethod("UpdateTransformMask", BindingFlags.NonPublic | BindingFlags.Static);

            SetAllClipAnimationAvatarMask(so, mask, updateMethod, at);
            so.ApplyModifiedProperties();
            so.Dispose();
        }
Example #2
0
 public static void SetAllClipAnimationAvatarMask(string target, GetterIsActivatableTransform logic, int at = -1)
 {
     SetAllClipAnimationAvatarMask(AssetImporter.GetAtPath(target) as ModelImporter, logic, at);
 }