mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-14 02:58:44 +08:00
[unity] Added Preferences parameter to disable console error when SkeletonDataAsset skeleton data file is none. Finishes code changes to allow copy protection systems. Closes #1794.
This commit is contained in:
parent
eb7bf3a8b3
commit
2b85114d54
@ -162,6 +162,9 @@ namespace Spine.Unity.Editor {
|
||||
const string COMPONENTMATERIAL_WARNING_KEY = "SPINE_COMPONENTMATERIAL_WARNING";
|
||||
public static bool componentMaterialWarning = SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING;
|
||||
|
||||
const string SKELETONDATA_ASSET_NO_FILE_ERROR_KEY = "SPINE_SKELETONDATA_ASSET_NO_FILE_ERROR";
|
||||
public static bool skeletonDataAssetNoFileError = SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR;
|
||||
|
||||
public const float DEFAULT_MIPMAPBIAS = SpinePreferences.DEFAULT_MIPMAPBIAS;
|
||||
|
||||
public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";
|
||||
@ -199,6 +202,7 @@ namespace Spine.Unity.Editor {
|
||||
atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
|
||||
textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
|
||||
componentMaterialWarning = EditorPrefs.GetBool(COMPONENTMATERIAL_WARNING_KEY, SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING);
|
||||
skeletonDataAssetNoFileError = EditorPrefs.GetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR);
|
||||
timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION);
|
||||
handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE);
|
||||
preferencesLoaded = true;
|
||||
@ -219,6 +223,7 @@ namespace Spine.Unity.Editor {
|
||||
newPreferences.atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
|
||||
newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
|
||||
newPreferences.componentMaterialWarning = EditorPrefs.GetBool(COMPONENTMATERIAL_WARNING_KEY, SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING);
|
||||
newPreferences.skeletonDataAssetNoFileError = EditorPrefs.GetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR);
|
||||
newPreferences.timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION);
|
||||
newPreferences.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE);
|
||||
}
|
||||
@ -237,6 +242,7 @@ namespace Spine.Unity.Editor {
|
||||
EditorPrefs.SetBool(ATLASTXT_WARNING_KEY, preferences.atlasTxtImportWarning);
|
||||
EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning);
|
||||
EditorPrefs.SetBool(COMPONENTMATERIAL_WARNING_KEY, preferences.componentMaterialWarning);
|
||||
EditorPrefs.SetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, preferences.skeletonDataAssetNoFileError);
|
||||
EditorPrefs.SetBool(TIMELINE_USE_BLEND_DURATION_KEY, preferences.timelineUseBlendDuration);
|
||||
EditorPrefs.SetFloat(SCENE_ICONS_SCALE_KEY, preferences.handleScale);
|
||||
}
|
||||
@ -312,6 +318,8 @@ namespace Spine.Unity.Editor {
|
||||
SpineEditorUtilities.BoolPrefsField(ref atlasTxtImportWarning, ATLASTXT_WARNING_KEY, new GUIContent("Atlas Extension Warning", "Log a warning and recommendation whenever a `.atlas` file is found."));
|
||||
SpineEditorUtilities.BoolPrefsField(ref textureImporterWarning, TEXTUREIMPORTER_WARNING_KEY, new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts."));
|
||||
SpineEditorUtilities.BoolPrefsField(ref componentMaterialWarning, COMPONENTMATERIAL_WARNING_KEY, new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible."));
|
||||
SpineEditorUtilities.BoolPrefsField(ref skeletonDataAssetNoFileError, SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, new GUIContent("SkeletonDataAsset no file Error", "Log an error when querying SkeletonData from SkeletonDataAsset with no json or binary file assigned."));
|
||||
SkeletonDataAsset.errorIfSkeletonFileNullGlobal = skeletonDataAssetNoFileError;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@ -165,6 +165,9 @@ namespace Spine.Unity.Editor {
|
||||
internal const bool DEFAULT_COMPONENTMATERIAL_WARNING = true;
|
||||
public bool componentMaterialWarning = DEFAULT_COMPONENTMATERIAL_WARNING;
|
||||
|
||||
internal const bool DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR = true;
|
||||
public bool skeletonDataAssetNoFileError = DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR;
|
||||
|
||||
public const float DEFAULT_MIPMAPBIAS = -0.5f;
|
||||
|
||||
public const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true;
|
||||
@ -211,6 +214,7 @@ namespace Spine.Unity.Editor {
|
||||
#if HAS_ON_POSTPROCESS_PREFAB
|
||||
SkeletonRenderer.fixPrefabOverrideViaMeshFilterGlobal = settings.fixPrefabOverrideViaMeshFilter;
|
||||
#endif
|
||||
SkeletonDataAsset.errorIfSkeletonFileNullGlobal = settings.skeletonDataAssetNoFileError;
|
||||
return settings;
|
||||
}
|
||||
|
||||
@ -298,6 +302,8 @@ namespace Spine.Unity.Editor {
|
||||
EditorGUILayout.PropertyField(settings.FindProperty("atlasTxtImportWarning"), new GUIContent("Atlas & Skel Extension Warning", "Log a warning and recommendation whenever a `.atlas` or `.skel` file is found."));
|
||||
EditorGUILayout.PropertyField(settings.FindProperty("textureImporterWarning"), new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts."));
|
||||
EditorGUILayout.PropertyField(settings.FindProperty("componentMaterialWarning"), new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible."));
|
||||
EditorGUILayout.PropertyField(settings.FindProperty("skeletonDataAssetNoFileError"), new GUIContent("SkeletonDataAsset no file Error", "Log an error when querying SkeletonData from SkeletonDataAsset with no json or binary file assigned."));
|
||||
SkeletonDataAsset.errorIfSkeletonFileNullGlobal = settings.FindProperty("skeletonDataAssetNoFileError").boolValue;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@ -63,6 +63,10 @@ namespace Spine.Unity {
|
||||
public float defaultMix;
|
||||
public RuntimeAnimatorController controller;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static bool errorIfSkeletonFileNullGlobal = true;
|
||||
#endif
|
||||
|
||||
public bool IsLoaded { get { return this.skeletonData != null; } }
|
||||
|
||||
void Reset () {
|
||||
@ -112,6 +116,9 @@ namespace Spine.Unity {
|
||||
/// <summary>Loads, caches and returns the SkeletonData from the skeleton data file. Returns the cached SkeletonData after the first time it is called. Pass false to prevent direct errors from being logged.</summary>
|
||||
public SkeletonData GetSkeletonData (bool quiet) {
|
||||
if (skeletonJSON == null) {
|
||||
#if UNITY_EDITOR
|
||||
if (!errorIfSkeletonFileNullGlobal) quiet = true;
|
||||
#endif
|
||||
if (!quiet)
|
||||
Debug.LogError("Skeleton JSON file not set for SkeletonData asset: " + name, this);
|
||||
Clear();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user