UnityEditor.AnimationClipInfoProperties.MaskNeedsUpdating C# (CSharp) Method

MaskNeedsUpdating() public method

public MaskNeedsUpdating ( ) : bool
return bool
        public bool MaskNeedsUpdating()
        {
            AvatarMask maskSource = this.maskSource;
            if (maskSource != null)
            {
                SerializedProperty property = this.Get("bodyMask");
                if ((property != null) && property.isArray)
                {
                    for (AvatarMaskBodyPart part = AvatarMaskBodyPart.Root; part < AvatarMaskBodyPart.LastBodyPart; part += 1)
                    {
                        if (maskSource.GetHumanoidBodyPartActive(part) != (property.GetArrayElementAtIndex((int) part).intValue != 0))
                        {
                            return true;
                        }
                    }
                }
                else
                {
                    return true;
                }
                SerializedProperty property2 = this.Get("transformMask");
                if ((property2 != null) && property2.isArray)
                {
                    if ((property2.arraySize > 0) && (maskSource.transformCount != property2.arraySize))
                    {
                        return true;
                    }
                    int arraySize = property2.arraySize;
                    for (int i = 0; i < arraySize; i++)
                    {
                        SerializedProperty property3 = property2.GetArrayElementAtIndex(i).FindPropertyRelative("m_Path");
                        SerializedProperty property4 = property2.GetArrayElementAtIndex(i).FindPropertyRelative("m_Weight");
                        if ((maskSource.GetTransformPath(i) != property3.stringValue) || (maskSource.GetTransformActive(i) != (property4.floatValue > 0.5f)))
                        {
                            return true;
                        }
                    }
                }
                else
                {
                    return true;
                }
            }
            return false;
        }

Usage Example

示例#1
0
        private void AvatarMaskSettings(AnimationClipInfoProperties clipInfo)
        {
            if (clipInfo == null || !((UnityEngine.Object) this.m_AnimationClipEditor != (UnityEngine.Object)null))
            {
                return;
            }
            this.InitMask(clipInfo);
            int  indentLevel = EditorGUI.indentLevel;
            bool changed     = GUI.changed;

            ModelImporterClipEditor.m_MaskFoldout = EditorGUILayout.Foldout(ModelImporterClipEditor.m_MaskFoldout, ModelImporterClipEditor.styles.Mask);
            GUI.changed = changed;
            if (clipInfo.maskType == ClipAnimationMaskType.CreateFromThisModel && !this.m_MaskInspector.IsMaskUpToDate())
            {
                GUILayout.BeginHorizontal(EditorStyles.helpBox, new GUILayoutOption[0]);
                GUILayout.Label("Mask does not match hierarchy. Animation might not import correctly", EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.BeginVertical();
                GUILayout.Space(5f);
                if (GUILayout.Button("Fix Mask"))
                {
                    this.SetTransformMaskFromReference(clipInfo);
                }
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
            else if (clipInfo.maskType == ClipAnimationMaskType.CopyFromOther && clipInfo.MaskNeedsUpdating())
            {
                GUILayout.BeginHorizontal(EditorStyles.helpBox, new GUILayoutOption[0]);
                GUILayout.Label("Source Mask has changed since last import. It must be Updated", EditorStyles.wordWrappedMiniLabel, new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                GUILayout.BeginVertical();
                GUILayout.Space(5f);
                if (GUILayout.Button("Update Mask"))
                {
                    clipInfo.MaskToClip(clipInfo.maskSource);
                }
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
            if (ModelImporterClipEditor.m_MaskFoldout)
            {
                ++EditorGUI.indentLevel;
                this.m_MaskInspector.OnInspectorGUI();
            }
            EditorGUI.indentLevel = indentLevel;
        }
All Usage Examples Of UnityEditor.AnimationClipInfoProperties::MaskNeedsUpdating