[unity] Default loop preference for editor instantiation.

This commit is contained in:
pharan 2018-10-18 21:34:11 +08:00
parent f95465ff96
commit 3554fece09
2 changed files with 11 additions and 0 deletions

View File

@ -244,6 +244,10 @@ namespace Spine.Unity.Editor {
const string DEFAULT_ZSPACING_KEY = "SPINE_DEFAULT_ZSPACING";
public static float defaultZSpacing = DEFAULT_DEFAULT_ZSPACING;
const bool DEFAULT_DEFAULT_INSTANTIATE_LOOP = true;
const string DEFAULT_INSTANTIATE_LOOP_KEY = "SPINE_DEFAULT_INSTANTIATE_LOOP";
public static bool defaultInstantiateLoop = DEFAULT_DEFAULT_INSTANTIATE_LOOP;
const bool DEFAULT_SHOW_HIERARCHY_ICONS = true;
const string SHOW_HIERARCHY_ICONS_KEY = "SPINE_SHOW_HIERARCHY_ICONS";
public static bool showHierarchyIcons = DEFAULT_SHOW_HIERARCHY_ICONS;
@ -327,6 +331,11 @@ namespace Spine.Unity.Editor {
if (EditorGUI.EndChangeCheck())
EditorPrefs.SetFloat(DEFAULT_ZSPACING_KEY, defaultZSpacing);
EditorGUI.BeginChangeCheck();
defaultInstantiateLoop = EditorGUILayout.Toggle(new GUIContent("Default Loop", "Spawn Spine GameObjects with loop enabled."), defaultInstantiateLoop);
if (EditorGUI.EndChangeCheck())
EditorPrefs.SetBool(DEFAULT_INSTANTIATE_LOOP_KEY, defaultInstantiateLoop);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
@ -1246,6 +1255,7 @@ namespace Spine.Unity.Editor {
throw e;
}
newSkeletonAnimation.loop = SpineEditorUtilities.Preferences.defaultInstantiateLoop;
newSkeletonAnimation.skeleton.Update(0);
newSkeletonAnimation.state.Update(0);
newSkeletonAnimation.state.Apply(newSkeletonAnimation.skeleton);

View File

@ -195,6 +195,7 @@ namespace Spine.Unity.Editor {
skin = skin ?? data.DefaultSkin ?? data.Skins.Items[0];
graphic.MeshGenerator.settings.zSpacing = SpineEditorUtilities.Preferences.defaultZSpacing;
graphic.startingLoop = SpineEditorUtilities.Preferences.defaultInstantiateLoop;
graphic.Initialize(false);
if (skin != null) graphic.Skeleton.SetSkin(skin);
graphic.initialSkinName = skin.Name;