SkeletonDataAsset.FillStateData C# (CSharp) Method

FillStateData() public method

public FillStateData ( ) : void
return void
	public void FillStateData () {
		if (stateData == null)
			return;

		stateData.DefaultMix = defaultMix;
		for (int i = 0, n = fromAnimation.Length; i < n; i++) {
			if (fromAnimation[i].Length == 0 || toAnimation[i].Length == 0)
				continue;
			stateData.SetMix(fromAnimation[i], toAnimation[i], duration[i]);
		}
	}

Usage Example

        void DrawAnimationStateInfo()
        {
            showAnimationStateData = EditorGUILayout.Foldout(showAnimationStateData, "Animation State Data");
            if (!showAnimationStateData)
            {
                return;
            }

            EditorGUI.BeginChangeCheck();
            SpineInspectorUtility.PropertyFieldWideLabel(defaultMix, DefaultMixLabel, 160);

            var animations = new string[m_skeletonData.Animations.Count];

            for (int i = 0; i < animations.Length; i++)
            {
                animations[i] = m_skeletonData.Animations.Items[i].Name;
            }

            for (int i = 0; i < fromAnimation.arraySize; i++)
            {
                SerializedProperty from         = fromAnimation.GetArrayElementAtIndex(i);
                SerializedProperty to           = toAnimation.GetArrayElementAtIndex(i);
                SerializedProperty durationProp = duration.GetArrayElementAtIndex(i);
                using (new EditorGUILayout.HorizontalScope()) {
                    from.stringValue        = animations[EditorGUILayout.Popup(Math.Max(Array.IndexOf(animations, from.stringValue), 0), animations)];
                    to.stringValue          = animations[EditorGUILayout.Popup(Math.Max(Array.IndexOf(animations, to.stringValue), 0), animations)];
                    durationProp.floatValue = EditorGUILayout.FloatField(durationProp.floatValue);
                    if (GUILayout.Button("Delete"))
                    {
                        duration.DeleteArrayElementAtIndex(i);
                        toAnimation.DeleteArrayElementAtIndex(i);
                        fromAnimation.DeleteArrayElementAtIndex(i);
                    }
                }
            }

            using (new EditorGUILayout.HorizontalScope()) {
                EditorGUILayout.Space();
                if (GUILayout.Button("Add Mix"))
                {
                    duration.arraySize++;
                    toAnimation.arraySize++;
                    fromAnimation.arraySize++;
                }
                EditorGUILayout.Space();
            }

            if (EditorGUI.EndChangeCheck())
            {
                m_skeletonDataAsset.FillStateData();
                EditorUtility.SetDirty(m_skeletonDataAsset);
                serializedObject.ApplyModifiedProperties();
                needToSerialize = true;
            }
        }
All Usage Examples Of SkeletonDataAsset::FillStateData