OnEnable() public method

public OnEnable ( string transformPaths, SerializedObject serializedObject ) : void
transformPaths string
serializedObject SerializedObject
return void
Example #1
0
        internal override void OnEnable()
        {
            Editor.AssignCachedProperties(this, serializedObject.GetIterator());

            m_ExposeTransformEditor = new ExposeTransformEditor();

            string[] transformPaths = singleImporter.transformPaths;
            m_RootMotionBoneList = new GUIContent[transformPaths.Length];
            for (int i = 0; i < transformPaths.Length; i++)
            {
                m_RootMotionBoneList[i] = new GUIContent(transformPaths[i]);
            }

            if (m_RootMotionBoneList.Length > 0)
            {
                m_RootMotionBoneList[0] = EditorGUIUtility.TrTextContent("None");
            }

            m_ExposeTransformEditor.OnEnable(singleImporter.transformPaths, serializedObject);

            m_CanMultiEditTransformList = CanMultiEditTransformList();

            m_IsBiped            = false;
            m_BipedMappingReport = new List <string>();

            UpdateBipedMappingReport();

            if (m_AnimationType.intValue == (int)ModelImporterAnimationType.Human && m_Avatar == null)
            {
                ResetAvatar();
            }
        }
        internal override void OnEnable()
        {
            m_AnimationType = serializedObject.FindProperty("m_AnimationType");
            m_AvatarSetup   = serializedObject.FindProperty("m_AvatarSetup");
            m_AvatarSource  = serializedObject.FindProperty("m_LastHumanDescriptionAvatarSource");

            // Generic bone setup
            m_RootMotionBoneName = serializedObject.FindProperty("m_HumanDescription.m_RootMotionBoneName");

            m_ExposeTransformEditor = new ExposeTransformEditor();

            string[] transformPaths = singleImporter.transformPaths;
            m_RootMotionBoneList = new GUIContent[transformPaths.Length];
            for (int i = 0; i < transformPaths.Length; i++)
            {
                m_RootMotionBoneList[i] = new GUIContent(transformPaths[i]);
            }

            if (m_RootMotionBoneList.Length > 0)
            {
                m_RootMotionBoneList[0] = EditorGUIUtility.TrTextContent("None");
            }

            m_SrcHasExtraRoot = serializedObject.FindProperty("m_HasExtraRoot");
            m_DstHasExtraRoot = serializedObject.FindProperty("m_HumanDescription.m_HasExtraRoot");

            // Animation
            m_LegacyGenerateAnimations = serializedObject.FindProperty("m_LegacyGenerateAnimations");
            m_AnimationCompression     = serializedObject.FindProperty("m_AnimationCompression");

            m_SkinWeightsMode   = serializedObject.FindProperty("skinWeightsMode");
            m_MaxBonesPerVertex = serializedObject.FindProperty("maxBonesPerVertex");
            m_MinBoneWeight     = serializedObject.FindProperty("minBoneWeight");

            m_OptimizeGameObjects = serializedObject.FindProperty("m_OptimizeGameObjects");

            m_RigImportErrors   = serializedObject.FindProperty("m_RigImportErrors");
            m_RigImportWarnings = serializedObject.FindProperty("m_RigImportWarnings");

            m_HumanBoneArray = serializedObject.FindProperty("m_HumanDescription.m_Human");
            m_Skeleton       = serializedObject.FindProperty("m_HumanDescription.m_Skeleton");

            m_ExposeTransformEditor.OnEnable(singleImporter.transformPaths, serializedObject);

            m_CanMultiEditTransformList = CanMultiEditTransformList();

            // Check if avatar definition is same as the one it's copied from
            CheckIfAvatarCopyIsUpToDate();

            m_IsBiped            = false;
            m_BipedMappingReport = new List <string>();

            UpdateBipedMappingReport();

            if (m_AnimationType.intValue == (int)ModelImporterAnimationType.Human && m_Avatar == null)
            {
                ResetAvatar();
            }
        }
        internal override void OnEnable()
        {
            m_AnimationType       = serializedObject.FindProperty("m_AnimationType");
            m_AvatarSource        = serializedObject.FindProperty("m_LastHumanDescriptionAvatarSource");
            m_OptimizeGameObjects = serializedObject.FindProperty("m_OptimizeGameObjects");

            // Generic bone setup
            m_RootMotionBoneName     = serializedObject.FindProperty("m_HumanDescription.m_RootMotionBoneName");
            m_RootMotionBoneRotation = serializedObject.FindProperty("m_HumanDescription.m_RootMotionBoneRotation");

            m_ExposeTransformEditor = new ExposeTransformEditor();

            string[] transformPaths = singleImporter.transformPaths;
            m_RootMotionBoneList = new GUIContent[transformPaths.Length];
            for (int i = 0; i < transformPaths.Length; i++)
            {
                m_RootMotionBoneList[i] = new GUIContent(transformPaths[i]);
            }

            if (m_RootMotionBoneList.Length > 0)
            {
                m_RootMotionBoneList[0] = EditorGUIUtility.TrTextContent("None");
            }

            rootIndex = ArrayUtility.FindIndex(m_RootMotionBoneList, delegate(GUIContent content) { return(FileUtil.GetLastPathNameComponent(content.text) == m_RootMotionBoneName.stringValue); });
            rootIndex = rootIndex < 1 ? 0 : rootIndex;

            m_SrcHasExtraRoot = serializedObject.FindProperty("m_HasExtraRoot");
            m_DstHasExtraRoot = serializedObject.FindProperty("m_HumanDescription.m_HasExtraRoot");

            // Animation
            m_CopyAvatar = serializedObject.FindProperty("m_CopyAvatar");
            m_LegacyGenerateAnimations = serializedObject.FindProperty("m_LegacyGenerateAnimations");
            m_AnimationCompression     = serializedObject.FindProperty("m_AnimationCompression");

            m_RigImportErrors   = serializedObject.FindProperty("m_RigImportErrors");
            m_RigImportWarnings = serializedObject.FindProperty("m_RigImportWarnings");

            m_ExposeTransformEditor.OnEnable(singleImporter.transformPaths, serializedObject);

            m_CanMultiEditTransformList = CanMultiEditTransformList();

            // Check if avatar definition is same as the one it's copied from
            CheckIfAvatarCopyIsUpToDate();

            m_IsBiped            = false;
            m_BipedMappingReport = new List <string>();

            if (m_AnimationType.intValue == (int)ModelImporterAnimationType.Human)
            {
                GameObject go = assetTarget as GameObject;
                if (go != null)
                {
                    m_IsBiped = AvatarBipedMapper.IsBiped(go.transform, m_BipedMappingReport);
                }

                if (m_Avatar == null)
                {
                    ResetAvatar();
                }
            }
        }