mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[unity] Disable baking in 2018.3
This commit is contained in:
parent
987d074152
commit
bda6c58dbe
@ -28,7 +28,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
// Contributed by: Mitch Thompson
|
||||
#if UNITY_2018_3 || UNITY_2019
|
||||
#define NEW_PREFAB_SYSTEM
|
||||
#endif
|
||||
|
||||
#define SPINE_SKELETONMECANIM
|
||||
|
||||
@ -184,6 +186,8 @@ namespace Spine.Unity.Editor {
|
||||
return;
|
||||
}
|
||||
|
||||
#if !NEW_PREFAB_SYSTEM
|
||||
|
||||
if (outputPath == "") {
|
||||
outputPath = System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(skeletonDataAsset)) + "/Baked";
|
||||
System.IO.Directory.CreateDirectory(outputPath);
|
||||
@ -275,8 +279,8 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
string prefabPath = outputPath + "/" + skeletonDataAsset.skeletonJSON.name + " (" + skin.Name + ").prefab";
|
||||
|
||||
|
||||
Object prefab = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject));
|
||||
|
||||
if (prefab == null) {
|
||||
prefab = PrefabUtility.CreateEmptyPrefab(prefabPath);
|
||||
newPrefab = true;
|
||||
@ -430,7 +434,6 @@ namespace Spine.Unity.Editor {
|
||||
EditorGUIUtility.PingObject(controller);
|
||||
}
|
||||
|
||||
|
||||
if (newPrefab) {
|
||||
PrefabUtility.ReplacePrefab(prefabRoot, prefab, ReplacePrefabOptions.ConnectToPrefab);
|
||||
} else {
|
||||
@ -441,6 +444,7 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
PrefabUtility.ReplacePrefab(prefabRoot, prefab, ReplacePrefabOptions.ReplaceNameBased);
|
||||
}
|
||||
|
||||
|
||||
EditorGUIUtility.PingObject(prefab);
|
||||
|
||||
@ -448,7 +452,9 @@ namespace Spine.Unity.Editor {
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
GameObject.DestroyImmediate(prefabRoot);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -731,9 +737,9 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
return arr;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Animation Baking
|
||||
#region Animation Baking
|
||||
static AnimationClip ExtractAnimation (string name, SkeletonData skeletonData, Dictionary<int, List<string>> slotLookup, bool bakeIK, SendMessageOptions eventOptions, AnimationClip clip = null) {
|
||||
var animation = skeletonData.FindAnimation(name);
|
||||
|
||||
@ -1402,10 +1408,10 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
return angle;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Region Baking
|
||||
#region Region Baking
|
||||
public static GameObject BakeRegion (SpineAtlasAsset atlasAsset, AtlasRegion region, bool autoSave = true) {
|
||||
atlasAsset.GetAtlas(); // Initializes atlasAsset.
|
||||
|
||||
@ -1424,7 +1430,12 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
if (prefab == null) {
|
||||
root = new GameObject("temp", typeof(MeshFilter), typeof(MeshRenderer));
|
||||
#if NEW_PREFAB_SYSTEM
|
||||
prefab = PrefabUtility.SaveAsPrefabAsset(root, bakedPrefabPath);
|
||||
#else
|
||||
prefab = PrefabUtility.CreatePrefab(bakedPrefabPath, root);
|
||||
#endif
|
||||
|
||||
isNewPrefab = true;
|
||||
Object.DestroyImmediate(root);
|
||||
}
|
||||
@ -1450,7 +1461,7 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
return prefab;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
static string GetPath (BoneData b) {
|
||||
return GetPathRecurse(b).Substring(1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user