コード例 #1
0
    static void Init()
    {
        SkeletonTools window = (SkeletonTools)EditorWindow.GetWindow(typeof(SkeletonTools));

        window.Show();

        window.OnSelectionChange();
    }
コード例 #2
0
        public void ForceSkeleton()
        {
            forcedSlotBones = true;
            SkeletonTools.ForceSkeleton(RaceSMR, SlotSMR);
            ForceButton.gameObject.SetActive(false);
#if UNITY_EDITOR
            if (slotAssetPath.EndsWith(".fbx", System.StringComparison.InvariantCultureIgnoreCase))
            {
                PrefabUtility.CreatePrefab(AssetDatabase.GenerateUniqueAssetPath(slotAssetPath.Substring(0, slotAssetPath.Length - 4) + ".prefab"), SlotGO);
            }
#endif
        }
コード例 #3
0
    public Transform EditorFindOrCreateMountpoint()
    {
        Transform BoneTransform = SkeletonTools.RecursiveFindBone(avatar.gameObject.transform, BoneName);

        if (BoneTransform == null)
        {
            return(null);
        }
        foreach (Transform child in BoneTransform)
        {
            if (child.name == ID)
            {
                return(child);
            }
        }
        return(CreateMountpoint(BoneTransform, avatar.gameObject.layer));
    }
コード例 #4
0
    public void AddJiggle(UMAData umaData)
    {
        UMABoneCleaner cleaner  = umaData.gameObject.GetComponent <UMABoneCleaner>();
        Transform      rootBone = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, jiggleBoneName);

        AddBoneJiggle(umaData, rootBone, cleaner);
        if (AdditionalBones != null)
        {
            foreach (string s in AdditionalBones)
            {
                if (!string.IsNullOrEmpty(s))
                {
                    rootBone = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, s);
                    AddBoneJiggle(umaData, rootBone, cleaner);
                }
            }
        }
    }
コード例 #5
0
        private void PerformValidation()
        {
            string ValidateDescription;
            var    validateResult = SkeletonTools.ValidateSlot(RaceSMR, SlotSMR, out ValidateDescription);

            resultText.text = ValidateDescription;
            switch (validateResult)
            {
            case SkeletonTools.ValidateResult.InvalidScale:
                Selection.activeObject = slotAsset;
                ForceButton.gameObject.SetActive(false);
                break;

            case SkeletonTools.ValidateResult.Ok:
                ForceButton.gameObject.SetActive(false);
                break;

            case SkeletonTools.ValidateResult.SkeletonProblem:
                ForceButton.gameObject.SetActive(true);
                break;
            }
            SetPage(2);
        }
コード例 #6
0
    public void AddJiggle(UMAData umaData)
    {
        Transform        rootBone      = SkeletonTools.RecursiveFindBone(umaData.umaRoot.transform, jiggleBoneName);
        UMABoneCleaner   cleaner       = umaData.gameObject.GetComponent <UMABoneCleaner>();
        List <Transform> exclusionList = new List <Transform>();

        if (rootBone != null)
        {
#if DYNAMIC_BONE
            DynamicBone jiggleBone = rootBone.GetComponent <DynamicBone>();
            if (jiggleBone == null)
            {
                jiggleBone = rootBone.gameObject.AddComponent <DynamicBone>();
            }

            jiggleBone.m_Root = rootBone;



            foreach (string exception in exceptions)
            {
                exclusionList.Add(umaData.gameObject.transform.FindDeepChild(exception));
            }

            jiggleBone.m_Exclusions = exclusionList;
            jiggleBone.m_Inert      = reduceEffect;
            jiggleBone.UpdateParameters();
#else
            SwayRootBone jiggleBone = rootBone.GetComponent <SwayRootBone>();
            if (jiggleBone == null)
            {
                jiggleBone = rootBone.gameObject.AddComponent <SwayRootBone>();
            }

            foreach (string exception in exceptions)
            {
                exclusionList.Add(SkeletonTools.RecursiveFindBone(umaData.gameObject.transform, exception));
            }

            jiggleBone.Exclusions = exclusionList;
            jiggleBone.inertia    = reduceEffect;
            jiggleBone.SetupBoneChains();
#endif
        }

        if (deleteBoneWithSlot)
        {
            if (cleaner == null)
            {
                cleaner = umaData.gameObject.AddComponent <UMABoneCleaner>();
            }

            UMAJiggleBoneListing listing = new UMAJiggleBoneListing();
            listing.boneName    = jiggleBoneName;
            listing.carrierSlot = slotToWatch;

            linkedRecipe = umaData.gameObject.GetComponent <DynamicCharacterAvatar>().GetWardrobeItemName(slotToWatch);

            listing.recipe = linkedRecipe;

            listing.exceptions = exclusionList;
            cleaner.RegisterJiggleBone(listing);
        }
    }