mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[unity] Fixed conflicts after merge of 3.7 into 3.8-beta branch.
This commit is contained in:
parent
4f3d2d8057
commit
3b17c20c9b
@ -45,13 +45,10 @@
|
|||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
#define NEWHIERARCHYWINDOWCALLBACKS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
#if UNITY_2018_3_OR_NEWER
|
||||||
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> 3.7
|
|
||||||
#if UNITY_2019_1_OR_NEWER
|
#if UNITY_2019_1_OR_NEWER
|
||||||
#define NEW_TIMELINE_AS_PACKAGE
|
#define NEW_TIMELINE_AS_PACKAGE
|
||||||
#endif
|
#endif
|
||||||
@ -1927,7 +1924,6 @@ namespace Spine.Unity.Editor {
|
|||||||
public static RequestState HandlePendingAsyncTimelineRequest () {
|
public static RequestState HandlePendingAsyncTimelineRequest () {
|
||||||
if (timelineRequest == null)
|
if (timelineRequest == null)
|
||||||
return RequestState.NoRequestIssued;
|
return RequestState.NoRequestIssued;
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
var status = timelineRequest.Status;
|
var status = timelineRequest.Status;
|
||||||
if (status == UnityEditor.PackageManager.StatusCode.InProgress) {
|
if (status == UnityEditor.PackageManager.StatusCode.InProgress) {
|
||||||
@ -2035,92 +2031,11 @@ namespace Spine.Unity.Editor {
|
|||||||
public static bool DisableBuildDefine (string define) {
|
public static bool DisableBuildDefine (string define) {
|
||||||
|
|
||||||
bool wasDefineRemoved = false;
|
bool wasDefineRemoved = false;
|
||||||
=======
|
|
||||||
|
|
||||||
var status = timelineRequest.Status;
|
|
||||||
if (status == UnityEditor.PackageManager.StatusCode.InProgress) {
|
|
||||||
return RequestState.InProgress;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
EditorApplication.update -= UpdateAsyncTimelineRequest;
|
|
||||||
timelineRequest = null;
|
|
||||||
if (status == UnityEditor.PackageManager.StatusCode.Failure) {
|
|
||||||
Debug.LogError("Download of package " + TIMELINE_PACKAGE_NAME + " failed!");
|
|
||||||
return RequestState.Failure;
|
|
||||||
}
|
|
||||||
else { // status == UnityEditor.PackageManager.StatusCode.Success
|
|
||||||
HandleSuccessfulTimelinePackageDownload();
|
|
||||||
return RequestState.Success;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void DisableTimelineSupport () {
|
|
||||||
SpineBuildEnvUtility.DisableBuildDefine(SPINE_TIMELINE_PACKAGE_DOWNLOADED_DEFINE);
|
|
||||||
SpineBuildEnvUtility.RemoveDependencyFromAsmdefFile(TIMELINE_ASMDEF_DEPENDENCY_STRING);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void HandleSuccessfulTimelinePackageDownload () {
|
|
||||||
|
|
||||||
#if !SPINE_TK2D
|
|
||||||
SpineBuildEnvUtility.EnableSpineAsmdefFiles();
|
|
||||||
#endif
|
|
||||||
SpineBuildEnvUtility.AddDependencyToAsmdefFile(TIMELINE_ASMDEF_DEPENDENCY_STRING);
|
|
||||||
SpineBuildEnvUtility.EnableBuildDefine(SPINE_TIMELINE_PACKAGE_DOWNLOADED_DEFINE);
|
|
||||||
|
|
||||||
ReimportTimelineScripts();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void ReimportTimelineScripts () {
|
|
||||||
// Note: unfortunately AssetDatabase::Refresh is not enough and
|
|
||||||
// ImportAsset on a dir does not have the desired effect.
|
|
||||||
List<string> searchStrings = new List<string>();
|
|
||||||
searchStrings.Add("SpineAnimationStateBehaviour t:script");
|
|
||||||
searchStrings.Add("SpineAnimationStateClip t:script");
|
|
||||||
searchStrings.Add("SpineAnimationStateMixerBehaviour t:script");
|
|
||||||
searchStrings.Add("SpineAnimationStateTrack t:script");
|
|
||||||
|
|
||||||
searchStrings.Add("SpineSkeletonFlipBehaviour t:script");
|
|
||||||
searchStrings.Add("SpineSkeletonFlipClip t:script");
|
|
||||||
searchStrings.Add("SpineSkeletonFlipMixerBehaviour t:script");
|
|
||||||
searchStrings.Add("SpineSkeletonFlipTrack t:script");
|
|
||||||
|
|
||||||
searchStrings.Add("SkeletonAnimationPlayableHandle t:script");
|
|
||||||
searchStrings.Add("SpinePlayableHandleBase t:script");
|
|
||||||
|
|
||||||
foreach (string searchString in searchStrings) {
|
|
||||||
string[] guids = AssetDatabase.FindAssets(searchString);
|
|
||||||
foreach (string guid in guids) {
|
|
||||||
string currentPath = AssetDatabase.GUIDToAssetPath(guid);
|
|
||||||
AssetDatabase.ImportAsset(currentPath, ImportAssetOptions.ForceUpdate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SpineBuildEnvUtility
|
|
||||||
{
|
|
||||||
static bool IsInvalidGroup (BuildTargetGroup group) {
|
|
||||||
int gi = (int)group;
|
|
||||||
return
|
|
||||||
gi == 15 || gi == 16
|
|
||||||
||
|
|
||||||
group == BuildTargetGroup.Unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool EnableBuildDefine (string define) {
|
|
||||||
|
|
||||||
bool wasDefineAdded = false;
|
|
||||||
Debug.LogWarning("Please ignore errors \"PlayerSettings Validation: Requested build target group doesn't exist\" below");
|
|
||||||
>>>>>>> 3.7
|
|
||||||
foreach (BuildTargetGroup group in System.Enum.GetValues(typeof(BuildTargetGroup))) {
|
foreach (BuildTargetGroup group in System.Enum.GetValues(typeof(BuildTargetGroup))) {
|
||||||
if (IsInvalidGroup(group))
|
if (IsInvalidGroup(group))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
||||||
<<<<<<< HEAD
|
|
||||||
if (defines.Contains(define)) {
|
if (defines.Contains(define)) {
|
||||||
wasDefineRemoved = true;
|
wasDefineRemoved = true;
|
||||||
if (defines.Contains(define + ";"))
|
if (defines.Contains(define + ";"))
|
||||||
@ -2151,83 +2066,6 @@ namespace Spine.Unity.Editor {
|
|||||||
SetAsmdefFileActive("spine-unity", true);
|
SetAsmdefFileActive("spine-unity", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddDependencyToAsmdefFile (string dependencyName) {
|
|
||||||
string asmdefName = "spine-unity";
|
|
||||||
string filePath = FindAsmdefFile(asmdefName);
|
|
||||||
if (string.IsNullOrEmpty(filePath))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (System.IO.File.Exists(filePath)) {
|
|
||||||
string fileContent = File.ReadAllText(filePath);
|
|
||||||
|
|
||||||
if (!fileContent.Contains("references")) {
|
|
||||||
string nameLine = string.Concat("\"name\": \"", asmdefName, "\"");
|
|
||||||
fileContent = fileContent.Replace(nameLine,
|
|
||||||
nameLine +
|
|
||||||
@",\n""references"": []");
|
|
||||||
=======
|
|
||||||
if (!defines.Contains(define)) {
|
|
||||||
wasDefineAdded = true;
|
|
||||||
if (defines.EndsWith(";", System.StringComparison.Ordinal))
|
|
||||||
defines += define;
|
|
||||||
else
|
|
||||||
defines += ";" + define;
|
|
||||||
|
|
||||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, defines);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Debug.LogWarning("Please ignore errors \"PlayerSettings Validation: Requested build target group doesn't exist\" above");
|
|
||||||
|
|
||||||
if (wasDefineAdded) {
|
|
||||||
Debug.LogWarning("Setting Scripting Define Symbol " + define);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Debug.LogWarning("Already Set Scripting Define Symbol " + define);
|
|
||||||
}
|
|
||||||
return wasDefineAdded;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool DisableBuildDefine (string define) {
|
|
||||||
|
|
||||||
bool wasDefineRemoved = false;
|
|
||||||
foreach (BuildTargetGroup group in System.Enum.GetValues(typeof(BuildTargetGroup))) {
|
|
||||||
if (IsInvalidGroup(group))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
|
||||||
if (defines.Contains(define)) {
|
|
||||||
wasDefineRemoved = true;
|
|
||||||
if (defines.Contains(define + ";"))
|
|
||||||
defines = defines.Replace(define + ";", "");
|
|
||||||
else
|
|
||||||
defines = defines.Replace(define, "");
|
|
||||||
|
|
||||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, defines);
|
|
||||||
>>>>>>> 3.7
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
if (wasDefineRemoved) {
|
|
||||||
Debug.LogWarning("Removing Scripting Define Symbol " + define);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Debug.LogWarning("Already Removed Scripting Define Symbol " + define);
|
|
||||||
}
|
|
||||||
return wasDefineRemoved;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DisableSpineAsmdefFiles () {
|
|
||||||
SetAsmdefFileActive("spine-unity-editor", false);
|
|
||||||
SetAsmdefFileActive("spine-unity", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void EnableSpineAsmdefFiles () {
|
|
||||||
SetAsmdefFileActive("spine-unity-editor", true);
|
|
||||||
SetAsmdefFileActive("spine-unity", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddDependencyToAsmdefFile (string dependencyName) {
|
public static void AddDependencyToAsmdefFile (string dependencyName) {
|
||||||
string asmdefName = "spine-unity";
|
string asmdefName = "spine-unity";
|
||||||
string filePath = FindAsmdefFile(asmdefName);
|
string filePath = FindAsmdefFile(asmdefName);
|
||||||
@ -2244,7 +2082,6 @@ namespace Spine.Unity.Editor {
|
|||||||
@",\n""references"": []");
|
@",\n""references"": []");
|
||||||
}
|
}
|
||||||
|
|
||||||
>>>>>>> 3.7
|
|
||||||
if (!fileContent.Contains(dependencyName)) {
|
if (!fileContent.Contains(dependencyName)) {
|
||||||
fileContent = fileContent.Replace(@"""references"": [",
|
fileContent = fileContent.Replace(@"""references"": [",
|
||||||
@"""references"": [" + dependencyName);
|
@"""references"": [" + dependencyName);
|
||||||
@ -2275,15 +2112,9 @@ namespace Spine.Unity.Editor {
|
|||||||
filePath = FindAsmdefFile(filename, isDisabledFile: true);
|
filePath = FindAsmdefFile(filename, isDisabledFile: true);
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
internal static string FindAsmdefFile (string filename, bool isDisabledFile) {
|
internal static string FindAsmdefFile (string filename, bool isDisabledFile) {
|
||||||
|
|
||||||
=======
|
|
||||||
|
|
||||||
internal static string FindAsmdefFile (string filename, bool isDisabledFile) {
|
|
||||||
|
|
||||||
>>>>>>> 3.7
|
|
||||||
string typeSearchString = isDisabledFile ? " t:TextAsset" : " t:AssemblyDefinitionAsset";
|
string typeSearchString = isDisabledFile ? " t:TextAsset" : " t:AssemblyDefinitionAsset";
|
||||||
string extension = isDisabledFile ? ".txt" : ".asmdef";
|
string extension = isDisabledFile ? ".txt" : ".asmdef";
|
||||||
string filenameWithExtension = filename + (isDisabledFile ? ".txt" : ".asmdef");
|
string filenameWithExtension = filename + (isDisabledFile ? ".txt" : ".asmdef");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user