mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
Merge branch '4.1-beta' into 4.2-beta
# Conflicts: # spine-ts/package-lock.json # spine-ts/package.json # spine-ts/spine-canvas/package.json # spine-ts/spine-core/package.json # spine-ts/spine-player/package.json # spine-ts/spine-threejs/package.json # spine-ts/spine-webgl/package.json
This commit is contained in:
commit
678833ce21
@ -1202,6 +1202,7 @@ spSkeletonData *spSkeletonJson_readSkeletonData(spSkeletonJson *self, const char
|
|||||||
data->offsetScaleY = Json_getFloat(constraintMap, "scaleY", 0);
|
data->offsetScaleY = Json_getFloat(constraintMap, "scaleY", 0);
|
||||||
data->offsetShearY = Json_getFloat(constraintMap, "shearY", 0);
|
data->offsetShearY = Json_getFloat(constraintMap, "shearY", 0);
|
||||||
|
|
||||||
|
data->mixRotate = Json_getFloat(constraintMap, "mixRotate", 1);
|
||||||
data->mixX = Json_getFloat(constraintMap, "mixX", 1);
|
data->mixX = Json_getFloat(constraintMap, "mixX", 1);
|
||||||
data->mixY = Json_getFloat(constraintMap, "mixY", data->mixX);
|
data->mixY = Json_getFloat(constraintMap, "mixY", data->mixX);
|
||||||
data->mixScaleX = Json_getFloat(constraintMap, "mixScaleX", 1);
|
data->mixScaleX = Json_getFloat(constraintMap, "mixScaleX", 1);
|
||||||
|
|||||||
@ -22,7 +22,9 @@
|
|||||||
<button id="walk">Walk</button>
|
<button id="walk">Walk</button>
|
||||||
<button id="jump">Jump</button>
|
<button id="jump">Jump</button>
|
||||||
<button id="roar">Roar</button>
|
<button id="roar">Roar</button>
|
||||||
|
<button id="screenshot">Screenshot</button>
|
||||||
</div>
|
</div>
|
||||||
|
<img id="screenshot-image" src="" style="width: 400px;">
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
// Creates a new spine player. The debugRender option enables
|
// Creates a new spine player. The debugRender option enables
|
||||||
@ -50,6 +52,7 @@
|
|||||||
premultipliedAlpha: true,
|
premultipliedAlpha: true,
|
||||||
backgroundColor: "#00000000",
|
backgroundColor: "#00000000",
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
preserveDrawingBuffer: true,
|
||||||
defaultMix: 1,
|
defaultMix: 1,
|
||||||
controlBones: ["root"],
|
controlBones: ["root"],
|
||||||
success: (player) => {
|
success: (player) => {
|
||||||
@ -66,6 +69,9 @@
|
|||||||
document.getElementById("roar").addEventListener("click", event => {
|
document.getElementById("roar").addEventListener("click", event => {
|
||||||
jsControlledPlayer.setAnimation("roar", true); // set the jump animation to loop
|
jsControlledPlayer.setAnimation("roar", true); // set the jump animation to loop
|
||||||
});
|
});
|
||||||
|
document.getElementById("screenshot").addEventListener("click", event => {
|
||||||
|
document.getElementById("screenshot-image").src = player.canvas.toDataURL();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -114,6 +114,9 @@ export interface SpinePlayerConfig {
|
|||||||
backgroundColor alpha is < ff. Default: false */
|
backgroundColor alpha is < ff. Default: false */
|
||||||
alpha?: boolean
|
alpha?: boolean
|
||||||
|
|
||||||
|
/* Optional: Whether to preserve the drawing buffer. This is needed if you want to take a screenshot via canvas.getDataURL(), Default: false */
|
||||||
|
preserveDrawingBuffer: boolean
|
||||||
|
|
||||||
/* Optional: The canvas background color, given in the format #rrggbb or #rrggbbaa. Default: #000000ff (black) or when
|
/* Optional: The canvas background color, given in the format #rrggbb or #rrggbbaa. Default: #000000ff (black) or when
|
||||||
alpha is true #00000000 (transparent) */
|
alpha is true #00000000 (transparent) */
|
||||||
backgroundColor?: string
|
backgroundColor?: string
|
||||||
@ -283,6 +286,7 @@ export class SpinePlayer implements Disposable {
|
|||||||
if (!config.fullScreenBackgroundColor) config.fullScreenBackgroundColor = config.backgroundColor;
|
if (!config.fullScreenBackgroundColor) config.fullScreenBackgroundColor = config.backgroundColor;
|
||||||
if (config.backgroundImage && !config.backgroundImage.url) config.backgroundImage = undefined;
|
if (config.backgroundImage && !config.backgroundImage.url) config.backgroundImage = undefined;
|
||||||
if (config.premultipliedAlpha === void 0) config.premultipliedAlpha = true;
|
if (config.premultipliedAlpha === void 0) config.premultipliedAlpha = true;
|
||||||
|
if (config.preserveDrawingBuffer === void 0) config.preserveDrawingBuffer = false;
|
||||||
if (config.mipmaps === void 0) config.mipmaps = true;
|
if (config.mipmaps === void 0) config.mipmaps = true;
|
||||||
if (!config.debug) config.debug = {
|
if (!config.debug) config.debug = {
|
||||||
bones: false,
|
bones: false,
|
||||||
@ -319,7 +323,7 @@ export class SpinePlayer implements Disposable {
|
|||||||
try {
|
try {
|
||||||
// Setup the OpenGL context.
|
// Setup the OpenGL context.
|
||||||
this.canvas = findWithClass(dom, "spine-player-canvas") as HTMLCanvasElement;
|
this.canvas = findWithClass(dom, "spine-player-canvas") as HTMLCanvasElement;
|
||||||
this.context = new ManagedWebGLRenderingContext(this.canvas, { alpha: config.alpha });
|
this.context = new ManagedWebGLRenderingContext(this.canvas, { alpha: config.alpha, preserveDrawingBuffer: config.preserveDrawingBuffer });
|
||||||
|
|
||||||
// Setup the scene renderer and loading screen.
|
// Setup the scene renderer and loading screen.
|
||||||
this.sceneRenderer = new SceneRenderer(this.canvas, this.context, true);
|
this.sceneRenderer = new SceneRenderer(this.canvas, this.context, true);
|
||||||
|
|||||||
@ -193,7 +193,7 @@ TextMesh:
|
|||||||
m_Text: 'Enter <b>PLAY MODE</b> in Unity to see Spineboy animate.
|
m_Text: 'Enter <b>PLAY MODE</b> in Unity to see Spineboy animate.
|
||||||
|
|
||||||
Try moving, jumping, aiming and shooting. (WASD+Spacebar+Left&Right Click, or
|
Try moving, jumping, aiming and shooting. (WASD+Spacebar+Left&Right Click, or
|
||||||
XBOX Controller)'
|
Gamepad)'
|
||||||
m_OffsetZ: 0
|
m_OffsetZ: 0
|
||||||
m_CharacterSize: 0.12
|
m_CharacterSize: 0.12
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
|
|||||||
@ -873,7 +873,7 @@ TextMesh:
|
|||||||
m_GameObject: {fileID: 522034802}
|
m_GameObject: {fileID: 522034802}
|
||||||
m_Text: 'Enter <b>PLAY MODE</b> in Unity to see bearded hero guy animate.
|
m_Text: 'Enter <b>PLAY MODE</b> in Unity to see bearded hero guy animate.
|
||||||
|
|
||||||
Try moving and jumping. (WASD+Spacebar, or XBOX Controller)'
|
Try moving and jumping. (WASD+Spacebar, or Gamepad)'
|
||||||
m_OffsetZ: 0
|
m_OffsetZ: 0
|
||||||
m_CharacterSize: 0.1
|
m_CharacterSize: 0.1
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
|
|||||||
@ -1421,7 +1421,7 @@ TextMesh:
|
|||||||
|
|
||||||
animated via physics.
|
animated via physics.
|
||||||
|
|
||||||
Try moving and jumping. (WASD+Spacebar, or XBOX Controller)'
|
Try moving and jumping. (WASD+Spacebar, or Gamepad)'
|
||||||
m_OffsetZ: 0
|
m_OffsetZ: 0
|
||||||
m_CharacterSize: 0.1
|
m_CharacterSize: 0.1
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
|
|||||||
@ -126,15 +126,13 @@ namespace Spine.Unity.Examples {
|
|||||||
var shootTrack = skeletonAnimation.AnimationState.SetAnimation(1, shoot, false);
|
var shootTrack = skeletonAnimation.AnimationState.SetAnimation(1, shoot, false);
|
||||||
shootTrack.AttachmentThreshold = 1f;
|
shootTrack.AttachmentThreshold = 1f;
|
||||||
shootTrack.MixDuration = 0f;
|
shootTrack.MixDuration = 0f;
|
||||||
var empty1 = skeletonAnimation.state.AddEmptyAnimation(1, 0.5f, 0.1f);
|
skeletonAnimation.state.AddEmptyAnimation(1, 0.5f, 0.1f);
|
||||||
empty1.AttachmentThreshold = 1f;
|
|
||||||
|
|
||||||
// Play the aim animation on track 2 to aim at the mouse target.
|
// Play the aim animation on track 2 to aim at the mouse target.
|
||||||
var aimTrack = skeletonAnimation.AnimationState.SetAnimation(2, aim, false);
|
var aimTrack = skeletonAnimation.AnimationState.SetAnimation(2, aim, false);
|
||||||
aimTrack.AttachmentThreshold = 1f;
|
aimTrack.AttachmentThreshold = 1f;
|
||||||
aimTrack.MixDuration = 0f;
|
aimTrack.MixDuration = 0f;
|
||||||
var empty2 = skeletonAnimation.state.AddEmptyAnimation(2, 0.5f, 0.1f);
|
skeletonAnimation.state.AddEmptyAnimation(2, 0.5f, 0.1f);
|
||||||
empty2.AttachmentThreshold = 1f;
|
|
||||||
|
|
||||||
gunSource.pitch = GetRandomPitch(gunsoundPitchOffset);
|
gunSource.pitch = GetRandomPitch(gunsoundPitchOffset);
|
||||||
gunSource.Play();
|
gunSource.Play();
|
||||||
@ -150,8 +148,7 @@ namespace Spine.Unity.Examples {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void StopPlayingAim () {
|
public void StopPlayingAim () {
|
||||||
var empty2 = skeletonAnimation.state.AddEmptyAnimation(2, 0.5f, 0.1f);
|
skeletonAnimation.state.AddEmptyAnimation(2, 0.5f, 0.1f);
|
||||||
empty2.AttachmentThreshold = 1f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Turn (bool facingLeft) {
|
public void Turn (bool facingLeft) {
|
||||||
|
|||||||
@ -620,22 +620,28 @@ namespace Spine.Unity.Editor {
|
|||||||
pageName = "Material";
|
pageName = "Material";
|
||||||
|
|
||||||
string materialPath = assetPath + "/" + primaryName + "_" + pageName + ".mat";
|
string materialPath = assetPath + "/" + primaryName + "_" + pageName + ".mat";
|
||||||
Material mat = (Material)AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material));
|
Material material = (Material)AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material));
|
||||||
|
|
||||||
if (mat == null) {
|
if (material == null) {
|
||||||
mat = new Material(Shader.Find(SpineEditorUtilities.Preferences.defaultShader));
|
Shader defaultShader = Shader.Find(SpineEditorUtilities.Preferences.DefaultShader);
|
||||||
ApplyPMAOrStraightAlphaSettings(mat, SpineEditorUtilities.Preferences.textureSettingsReference);
|
material = defaultShader != null ? new Material(defaultShader) : null;
|
||||||
AssetDatabase.CreateAsset(mat, materialPath);
|
if (material) {
|
||||||
|
ApplyPMAOrStraightAlphaSettings(material, SpineEditorUtilities.Preferences.textureSettingsReference);
|
||||||
|
if (texture != null)
|
||||||
|
material.mainTexture = texture;
|
||||||
|
AssetDatabase.CreateAsset(material, materialPath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
vestigialMaterials.Remove(mat);
|
vestigialMaterials.Remove(material);
|
||||||
|
if (texture != null)
|
||||||
|
material.mainTexture = texture;
|
||||||
|
EditorUtility.SetDirty(material);
|
||||||
|
// note: don't call AssetDatabase.SaveAssets() since this would trigger OnPostprocessAllAssets() every time unnecessarily.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture != null)
|
if (material != null) {
|
||||||
mat.mainTexture = texture;
|
populatingMaterials.Add(material);
|
||||||
|
}
|
||||||
EditorUtility.SetDirty(mat);
|
|
||||||
// note: don't call AssetDatabase.SaveAssets() since this would trigger OnPostprocessAllAssets() every time unnecessarily.
|
|
||||||
populatingMaterials.Add(mat); //atlasAsset.materials[i] = mat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
atlasAsset.materials = populatingMaterials.ToArray();
|
atlasAsset.materials = populatingMaterials.ToArray();
|
||||||
|
|||||||
@ -48,6 +48,7 @@ namespace Spine.Unity.Editor {
|
|||||||
public struct SpawnMenuData {
|
public struct SpawnMenuData {
|
||||||
public Vector3 spawnPoint;
|
public Vector3 spawnPoint;
|
||||||
public Transform parent;
|
public Transform parent;
|
||||||
|
public int siblingIndex;
|
||||||
public SkeletonDataAsset skeletonDataAsset;
|
public SkeletonDataAsset skeletonDataAsset;
|
||||||
public EditorInstantiation.InstantiateDelegate instantiateDelegate;
|
public EditorInstantiation.InstantiateDelegate instantiateDelegate;
|
||||||
public bool isUI;
|
public bool isUI;
|
||||||
@ -82,7 +83,7 @@ namespace Spine.Unity.Editor {
|
|||||||
RectTransform rectTransform = (Selection.activeGameObject == null) ? null : Selection.activeGameObject.GetComponent<RectTransform>();
|
RectTransform rectTransform = (Selection.activeGameObject == null) ? null : Selection.activeGameObject.GetComponent<RectTransform>();
|
||||||
Plane plane = (rectTransform == null) ? new Plane(Vector3.back, Vector3.zero) : new Plane(-rectTransform.forward, rectTransform.position);
|
Plane plane = (rectTransform == null) ? new Plane(Vector3.back, Vector3.zero) : new Plane(-rectTransform.forward, rectTransform.position);
|
||||||
Vector3 spawnPoint = MousePointToWorldPoint2D(mousePos, sceneview.camera, plane);
|
Vector3 spawnPoint = MousePointToWorldPoint2D(mousePos, sceneview.camera, plane);
|
||||||
ShowInstantiateContextMenu(skeletonDataAsset, spawnPoint, null);
|
ShowInstantiateContextMenu(skeletonDataAsset, spawnPoint, null, 0);
|
||||||
DragAndDrop.AcceptDrag();
|
DragAndDrop.AcceptDrag();
|
||||||
current.Use();
|
current.Use();
|
||||||
}
|
}
|
||||||
@ -91,7 +92,8 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowInstantiateContextMenu (SkeletonDataAsset skeletonDataAsset, Vector3 spawnPoint, Transform parent) {
|
public static void ShowInstantiateContextMenu (SkeletonDataAsset skeletonDataAsset, Vector3 spawnPoint,
|
||||||
|
Transform parent, int siblingIndex = 0) {
|
||||||
var menu = new GenericMenu();
|
var menu = new GenericMenu();
|
||||||
|
|
||||||
// SkeletonAnimation
|
// SkeletonAnimation
|
||||||
@ -99,6 +101,7 @@ namespace Spine.Unity.Editor {
|
|||||||
skeletonDataAsset = skeletonDataAsset,
|
skeletonDataAsset = skeletonDataAsset,
|
||||||
spawnPoint = spawnPoint,
|
spawnPoint = spawnPoint,
|
||||||
parent = parent,
|
parent = parent,
|
||||||
|
siblingIndex = siblingIndex,
|
||||||
instantiateDelegate = (data) => EditorInstantiation.InstantiateSkeletonAnimation(data),
|
instantiateDelegate = (data) => EditorInstantiation.InstantiateSkeletonAnimation(data),
|
||||||
isUI = false
|
isUI = false
|
||||||
});
|
});
|
||||||
@ -112,6 +115,7 @@ namespace Spine.Unity.Editor {
|
|||||||
skeletonDataAsset = skeletonDataAsset,
|
skeletonDataAsset = skeletonDataAsset,
|
||||||
spawnPoint = spawnPoint,
|
spawnPoint = spawnPoint,
|
||||||
parent = parent,
|
parent = parent,
|
||||||
|
siblingIndex = siblingIndex,
|
||||||
instantiateDelegate = System.Delegate.CreateDelegate(typeof(EditorInstantiation.InstantiateDelegate), graphicInstantiateDelegate) as EditorInstantiation.InstantiateDelegate,
|
instantiateDelegate = System.Delegate.CreateDelegate(typeof(EditorInstantiation.InstantiateDelegate), graphicInstantiateDelegate) as EditorInstantiation.InstantiateDelegate,
|
||||||
isUI = true
|
isUI = true
|
||||||
});
|
});
|
||||||
@ -124,6 +128,7 @@ namespace Spine.Unity.Editor {
|
|||||||
skeletonDataAsset = skeletonDataAsset,
|
skeletonDataAsset = skeletonDataAsset,
|
||||||
spawnPoint = spawnPoint,
|
spawnPoint = spawnPoint,
|
||||||
parent = parent,
|
parent = parent,
|
||||||
|
siblingIndex = siblingIndex,
|
||||||
instantiateDelegate = (data) => EditorInstantiation.InstantiateSkeletonMecanim(data),
|
instantiateDelegate = (data) => EditorInstantiation.InstantiateSkeletonMecanim(data),
|
||||||
isUI = false
|
isUI = false
|
||||||
});
|
});
|
||||||
@ -149,6 +154,8 @@ namespace Spine.Unity.Editor {
|
|||||||
var usedParent = data.parent != null ? data.parent.gameObject : isUI ? Selection.activeGameObject : null;
|
var usedParent = data.parent != null ? data.parent.gameObject : isUI ? Selection.activeGameObject : null;
|
||||||
if (usedParent)
|
if (usedParent)
|
||||||
newTransform.SetParent(usedParent.transform, false);
|
newTransform.SetParent(usedParent.transform, false);
|
||||||
|
if (data.siblingIndex != 0)
|
||||||
|
newTransform.SetSiblingIndex(data.siblingIndex);
|
||||||
|
|
||||||
newTransform.position = isUI ? data.spawnPoint : RoundVector(data.spawnPoint, 2);
|
newTransform.position = isUI ? data.spawnPoint : RoundVector(data.spawnPoint, 2);
|
||||||
|
|
||||||
|
|||||||
@ -56,16 +56,12 @@ namespace Spine.Unity.Editor {
|
|||||||
public partial class SpineEditorUtilities {
|
public partial class SpineEditorUtilities {
|
||||||
|
|
||||||
#if NEW_PREFERENCES_SETTINGS_PROVIDER
|
#if NEW_PREFERENCES_SETTINGS_PROVIDER
|
||||||
static class SpineSettingsProviderRegistration
|
static class SpineSettingsProviderRegistration {
|
||||||
{
|
|
||||||
[SettingsProvider]
|
[SettingsProvider]
|
||||||
public static SettingsProvider CreateSpineSettingsProvider()
|
public static SettingsProvider CreateSpineSettingsProvider () {
|
||||||
{
|
var provider = new SettingsProvider("Spine", SettingsScope.User) {
|
||||||
var provider = new SettingsProvider("Spine", SettingsScope.User)
|
|
||||||
{
|
|
||||||
label = "Spine",
|
label = "Spine",
|
||||||
guiHandler = (searchContext) =>
|
guiHandler = (searchContext) => {
|
||||||
{
|
|
||||||
var settings = SpinePreferences.GetOrCreateSettings();
|
var settings = SpinePreferences.GetOrCreateSettings();
|
||||||
var serializedSettings = new SerializedObject(settings);
|
var serializedSettings = new SerializedObject(settings);
|
||||||
SpinePreferences.HandlePreferencesGUI(serializedSettings);
|
SpinePreferences.HandlePreferencesGUI(serializedSettings);
|
||||||
@ -108,6 +104,10 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
const string DEFAULT_SHADER_KEY = "SPINE_DEFAULT_SHADER";
|
const string DEFAULT_SHADER_KEY = "SPINE_DEFAULT_SHADER";
|
||||||
public static string defaultShader = SpinePreferences.DEFAULT_DEFAULT_SHADER;
|
public static string defaultShader = SpinePreferences.DEFAULT_DEFAULT_SHADER;
|
||||||
|
public static string DefaultShader {
|
||||||
|
get { return !string.IsNullOrEmpty(defaultShader) ? defaultShader : SpinePreferences.DEFAULT_DEFAULT_SHADER; }
|
||||||
|
set { defaultShader = value; }
|
||||||
|
}
|
||||||
|
|
||||||
const string DEFAULT_ZSPACING_KEY = "SPINE_DEFAULT_ZSPACING";
|
const string DEFAULT_ZSPACING_KEY = "SPINE_DEFAULT_ZSPACING";
|
||||||
public static float defaultZSpacing = SpinePreferences.DEFAULT_DEFAULT_ZSPACING;
|
public static float defaultZSpacing = SpinePreferences.DEFAULT_DEFAULT_ZSPACING;
|
||||||
|
|||||||
@ -194,9 +194,13 @@ namespace Spine.Unity.Editor {
|
|||||||
SceneView.onSceneGUIDelegate += DragAndDropInstantiation.SceneViewDragAndDrop;
|
SceneView.onSceneGUIDelegate += DragAndDropInstantiation.SceneViewDragAndDrop;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
DragAndDrop.RemoveDropHandler(HierarchyHandler.HandleDragAndDrop);
|
||||||
|
DragAndDrop.AddDropHandler(HierarchyHandler.HandleDragAndDrop);
|
||||||
|
#else
|
||||||
EditorApplication.hierarchyWindowItemOnGUI -= HierarchyHandler.HandleDragAndDrop;
|
EditorApplication.hierarchyWindowItemOnGUI -= HierarchyHandler.HandleDragAndDrop;
|
||||||
EditorApplication.hierarchyWindowItemOnGUI += HierarchyHandler.HandleDragAndDrop;
|
EditorApplication.hierarchyWindowItemOnGUI += HierarchyHandler.HandleDragAndDrop;
|
||||||
|
#endif
|
||||||
// Hierarchy Icons
|
// Hierarchy Icons
|
||||||
#if NEWPLAYMODECALLBACKS
|
#if NEWPLAYMODECALLBACKS
|
||||||
EditorApplication.playModeStateChanged -= HierarchyHandler.IconsOnPlaymodeStateChanged;
|
EditorApplication.playModeStateChanged -= HierarchyHandler.IconsOnPlaymodeStateChanged;
|
||||||
@ -440,6 +444,32 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
internal static DragAndDropVisualMode HandleDragAndDrop (int dropTargetInstanceID, HierarchyDropFlags dropMode, Transform parentForDraggedObjects, bool perform) {
|
||||||
|
SkeletonDataAsset skeletonDataAsset = DragAndDrop.objectReferences.Length == 0 ? null :
|
||||||
|
DragAndDrop.objectReferences[0] as SkeletonDataAsset;
|
||||||
|
if (skeletonDataAsset == null)
|
||||||
|
return DragAndDropVisualMode.None;
|
||||||
|
if (!perform)
|
||||||
|
return DragAndDropVisualMode.Copy;
|
||||||
|
|
||||||
|
GameObject dropTargetObject = UnityEditor.EditorUtility.InstanceIDToObject(dropTargetInstanceID) as GameObject;
|
||||||
|
Transform dropTarget = dropTargetObject != null ? dropTargetObject.transform : null;
|
||||||
|
Transform parent = dropTarget;
|
||||||
|
int siblingIndex = 0;
|
||||||
|
if (parent != null) {
|
||||||
|
if (dropMode == HierarchyDropFlags.DropBetween) {
|
||||||
|
parent = dropTarget.parent;
|
||||||
|
siblingIndex = dropTarget ? dropTarget.GetSiblingIndex() + 1 : 0;
|
||||||
|
} else if (dropMode == HierarchyDropFlags.DropAbove) {
|
||||||
|
parent = dropTarget.parent;
|
||||||
|
siblingIndex = dropTarget ? dropTarget.GetSiblingIndex() : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DragAndDropInstantiation.ShowInstantiateContextMenu(skeletonDataAsset, Vector3.zero, parent, siblingIndex);
|
||||||
|
return DragAndDropVisualMode.Copy;
|
||||||
|
}
|
||||||
|
#else
|
||||||
internal static void HandleDragAndDrop (int instanceId, Rect selectionRect) {
|
internal static void HandleDragAndDrop (int instanceId, Rect selectionRect) {
|
||||||
// HACK: Uses EditorApplication.hierarchyWindowItemOnGUI.
|
// HACK: Uses EditorApplication.hierarchyWindowItemOnGUI.
|
||||||
// Only works when there is at least one item in the scene.
|
// Only works when there is at least one item in the scene.
|
||||||
@ -475,7 +505,7 @@ namespace Spine.Unity.Editor {
|
|||||||
// when dragging into empty space in hierarchy below last node, last node would be parent.
|
// when dragging into empty space in hierarchy below last node, last node would be parent.
|
||||||
if (IsLastNodeInHierarchy(parent))
|
if (IsLastNodeInHierarchy(parent))
|
||||||
parent = null;
|
parent = null;
|
||||||
DragAndDropInstantiation.ShowInstantiateContextMenu(skeletonDataAsset, Vector3.zero, parent);
|
DragAndDropInstantiation.ShowInstantiateContextMenu(skeletonDataAsset, Vector3.zero, parent, 0);
|
||||||
UnityEditor.DragAndDrop.AcceptDrag();
|
UnityEditor.DragAndDrop.AcceptDrag();
|
||||||
current.Use();
|
current.Use();
|
||||||
return;
|
return;
|
||||||
@ -501,6 +531,7 @@ namespace Spine.Unity.Editor {
|
|||||||
bool isLastNode = (rootNodes.Length > 0 && rootNodes[rootNodes.Length - 1].transform == node);
|
bool isLastNode = (rootNodes.Length > 0 && rootNodes[rootNodes.Length - 1].transform == node);
|
||||||
return isLastNode;
|
return isLastNode;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,10 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
internal const string DEFAULT_DEFAULT_SHADER = "Spine/Skeleton";
|
internal const string DEFAULT_DEFAULT_SHADER = "Spine/Skeleton";
|
||||||
public string defaultShader = DEFAULT_DEFAULT_SHADER;
|
public string defaultShader = DEFAULT_DEFAULT_SHADER;
|
||||||
|
public string DefaultShader {
|
||||||
|
get { return !string.IsNullOrEmpty(defaultShader) ? defaultShader : DEFAULT_DEFAULT_SHADER; }
|
||||||
|
set { defaultShader = value; }
|
||||||
|
}
|
||||||
|
|
||||||
internal const float DEFAULT_DEFAULT_ZSPACING = 0f;
|
internal const float DEFAULT_DEFAULT_ZSPACING = 0f;
|
||||||
public float defaultZSpacing = DEFAULT_DEFAULT_ZSPACING;
|
public float defaultZSpacing = DEFAULT_DEFAULT_ZSPACING;
|
||||||
|
|||||||
@ -90,6 +90,7 @@ namespace Spine.Unity {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Slot slotObject = skeletonRenderer.skeleton.FindSlot(slotMaterialOverride.slotName);
|
Slot slotObject = skeletonRenderer.skeleton.FindSlot(slotMaterialOverride.slotName);
|
||||||
|
if (slotObject != null)
|
||||||
skeletonRenderer.CustomSlotMaterials[slotObject] = slotMaterialOverride.material;
|
skeletonRenderer.CustomSlotMaterials[slotObject] = slotMaterialOverride.material;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +107,8 @@ namespace Spine.Unity {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Slot slotObject = skeletonRenderer.skeleton.FindSlot(slotMaterialOverride.slotName);
|
Slot slotObject = skeletonRenderer.skeleton.FindSlot(slotMaterialOverride.slotName);
|
||||||
|
if (slotObject == null)
|
||||||
|
continue;
|
||||||
Material currentMaterial;
|
Material currentMaterial;
|
||||||
if (!skeletonRenderer.CustomSlotMaterials.TryGetValue(slotObject, out currentMaterial))
|
if (!skeletonRenderer.CustomSlotMaterials.TryGetValue(slotObject, out currentMaterial))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -6,9 +6,9 @@ Material:
|
|||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_Name: SkeletonPMAAdditive
|
m_Name: SkeletonStraightAdditive
|
||||||
m_Shader: {fileID: 4800000, guid: 53efa1d97f5d9f74285d4330cda14e36, type: 3}
|
m_Shader: {fileID: 4800000, guid: 53efa1d97f5d9f74285d4330cda14e36, type: 3}
|
||||||
m_ShaderKeywords:
|
m_ShaderKeywords: _STRAIGHT_ALPHA_INPUT
|
||||||
m_LightmapFlags: 4
|
m_LightmapFlags: 4
|
||||||
m_EnableInstancingVariants: 0
|
m_EnableInstancingVariants: 0
|
||||||
m_DoubleSidedGI: 0
|
m_DoubleSidedGI: 0
|
||||||
@ -29,7 +29,16 @@ Material:
|
|||||||
m_Floats:
|
m_Floats:
|
||||||
- <noninit>: 0
|
- <noninit>: 0
|
||||||
- _Cutoff: 0.1
|
- _Cutoff: 0.1
|
||||||
- _StraightAlphaInput: 0
|
- _OutlineMipLevel: 0
|
||||||
|
- _OutlineReferenceTexWidth: 1024
|
||||||
|
- _OutlineSmoothness: 1
|
||||||
|
- _OutlineWidth: 3
|
||||||
|
- _StencilComp: 8
|
||||||
|
- _StencilRef: 1
|
||||||
|
- _StraightAlphaInput: 1
|
||||||
|
- _ThresholdEnd: 0.25
|
||||||
|
- _Use8Neighbourhood: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007110106}
|
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007110106}
|
||||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _OutlineColor: {r: 1, g: 1, b: 0, a: 1}
|
||||||
|
|||||||
@ -6,38 +6,39 @@ Material:
|
|||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_Name: SkeletonPMAMultiply
|
m_Name: SkeletonStraightMultiply
|
||||||
m_Shader: {fileID: 4800000, guid: 8bdcdc7ee298e594a9c20c61d25c33b6, type: 3}
|
m_Shader: {fileID: 4800000, guid: 8bdcdc7ee298e594a9c20c61d25c33b6, type: 3}
|
||||||
m_ShaderKeywords:
|
m_ShaderKeywords: _STRAIGHT_ALPHA_INPUT
|
||||||
m_LightmapFlags: 4
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
m_CustomRenderQueue: -1
|
m_CustomRenderQueue: -1
|
||||||
stringTagMap: {}
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
m_SavedProperties:
|
m_SavedProperties:
|
||||||
serializedVersion: 2
|
serializedVersion: 3
|
||||||
m_TexEnvs:
|
m_TexEnvs:
|
||||||
- first:
|
- <noninit>:
|
||||||
name: <noninit>
|
|
||||||
second:
|
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
- first:
|
- _MainTex:
|
||||||
name: _MainTex
|
|
||||||
second:
|
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
m_Floats:
|
m_Floats:
|
||||||
- first:
|
- <noninit>: 0
|
||||||
name: <noninit>
|
- _Cutoff: 0.1
|
||||||
second: 0
|
- _OutlineMipLevel: 0
|
||||||
- first:
|
- _OutlineReferenceTexWidth: 1024
|
||||||
name: _Cutoff
|
- _OutlineSmoothness: 1
|
||||||
second: 0.1
|
- _OutlineWidth: 3
|
||||||
|
- _StencilComp: 8
|
||||||
|
- _StencilRef: 1
|
||||||
|
- _StraightAlphaInput: 1
|
||||||
|
- _ThresholdEnd: 0.25
|
||||||
|
- _Use8Neighbourhood: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- first:
|
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007110106}
|
||||||
name: <noninit>
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
second: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007110106}
|
- _OutlineColor: {r: 1, g: 1, b: 0, a: 1}
|
||||||
- first:
|
|
||||||
name: _Color
|
|
||||||
second: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
|
|||||||
@ -6,38 +6,39 @@ Material:
|
|||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_Name: SkeletonPMAScreen
|
m_Name: SkeletonStraightScreen
|
||||||
m_Shader: {fileID: 4800000, guid: 4e8caa36c07aacf4ab270da00784e4d9, type: 3}
|
m_Shader: {fileID: 4800000, guid: 4e8caa36c07aacf4ab270da00784e4d9, type: 3}
|
||||||
m_ShaderKeywords:
|
m_ShaderKeywords: _STRAIGHT_ALPHA_INPUT
|
||||||
m_LightmapFlags: 4
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
m_CustomRenderQueue: -1
|
m_CustomRenderQueue: -1
|
||||||
stringTagMap: {}
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
m_SavedProperties:
|
m_SavedProperties:
|
||||||
serializedVersion: 2
|
serializedVersion: 3
|
||||||
m_TexEnvs:
|
m_TexEnvs:
|
||||||
- first:
|
- <noninit>:
|
||||||
name: <noninit>
|
|
||||||
second:
|
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
- first:
|
- _MainTex:
|
||||||
name: _MainTex
|
|
||||||
second:
|
|
||||||
m_Texture: {fileID: 0}
|
m_Texture: {fileID: 0}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
m_Floats:
|
m_Floats:
|
||||||
- first:
|
- <noninit>: 0
|
||||||
name: <noninit>
|
- _Cutoff: 0.1
|
||||||
second: 0
|
- _OutlineMipLevel: 0
|
||||||
- first:
|
- _OutlineReferenceTexWidth: 1024
|
||||||
name: _Cutoff
|
- _OutlineSmoothness: 1
|
||||||
second: 0.1
|
- _OutlineWidth: 3
|
||||||
|
- _StencilComp: 8
|
||||||
|
- _StencilRef: 1
|
||||||
|
- _StraightAlphaInput: 1
|
||||||
|
- _ThresholdEnd: 0.25
|
||||||
|
- _Use8Neighbourhood: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- first:
|
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007121922}
|
||||||
name: <noninit>
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
second: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007121922}
|
- _OutlineColor: {r: 1, g: 1, b: 0, a: 1}
|
||||||
- first:
|
|
||||||
name: _Color
|
|
||||||
second: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ MonoBehaviour:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3}
|
m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3}
|
||||||
m_Name: Demo 2D URP Asset
|
m_Name: Example 2D URP Asset
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
k_AssetVersion: 5
|
k_AssetVersion: 5
|
||||||
k_AssetPreviousVersion: 5
|
k_AssetPreviousVersion: 5
|
||||||
|
|||||||
@ -10,7 +10,7 @@ MonoBehaviour:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 11145981673336645838492a2d98e247, type: 3}
|
m_Script: {fileID: 11500000, guid: 11145981673336645838492a2d98e247, type: 3}
|
||||||
m_Name: Demo 2D URP Renderer Data
|
m_Name: Example 2D URP Renderer Data
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_RendererFeatures: []
|
m_RendererFeatures: []
|
||||||
m_HDREmulationScale: 1
|
m_HDREmulationScale: 1
|
||||||
|
|||||||
@ -10,7 +10,7 @@ MonoBehaviour:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3}
|
m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3}
|
||||||
m_Name: Demo URP Asset
|
m_Name: Example URP Asset
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
k_AssetVersion: 5
|
k_AssetVersion: 5
|
||||||
k_AssetPreviousVersion: 5
|
k_AssetPreviousVersion: 5
|
||||||
|
|||||||
@ -10,7 +10,7 @@ MonoBehaviour:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3}
|
m_Script: {fileID: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3}
|
||||||
m_Name: Demo URP Asset_Renderer
|
m_Name: Example URP Asset_Renderer
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_RendererFeatures: []
|
m_RendererFeatures: []
|
||||||
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
|
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user