Merge branch '3.8' into 4.0-beta
@ -362,6 +362,9 @@
|
|||||||
* Added `SkeletonGraphicCustomMaterials` component, providing functionality to override materials and textures of a `SkeletonGraphic`, similar to `SkeletonRendererCustomMaterials`. Note: overriding materials or textures per slot is not provided due to structural limitations.
|
* Added `SkeletonGraphicCustomMaterials` component, providing functionality to override materials and textures of a `SkeletonGraphic`, similar to `SkeletonRendererCustomMaterials`. Note: overriding materials or textures per slot is not provided due to structural limitations.
|
||||||
* Added **Root Motion support** for `SkeletonAnimation`, `SkeletonMecanim` and `SkeletonGraphic` via new components `SkeletonRootMotion` and `SkeletonMecanimRootMotion`. The `SkeletonAnimation` and `SkeletonGraphic` component Inspector now provides a line `Root Motion` with `Add Component` and `Remove Component` buttons to add/remove the new `SkeletonRootMotion` component to your GameObject. The `SkeletonMecanim` Inspector detects whether root motion is enabled at the `Animator` component and adds a `SkeletonMecanimRootMotion` component automatically.
|
* Added **Root Motion support** for `SkeletonAnimation`, `SkeletonMecanim` and `SkeletonGraphic` via new components `SkeletonRootMotion` and `SkeletonMecanimRootMotion`. The `SkeletonAnimation` and `SkeletonGraphic` component Inspector now provides a line `Root Motion` with `Add Component` and `Remove Component` buttons to add/remove the new `SkeletonRootMotion` component to your GameObject. The `SkeletonMecanim` Inspector detects whether root motion is enabled at the `Animator` component and adds a `SkeletonMecanimRootMotion` component automatically.
|
||||||
* `SkeletonMecanim` now provides an additional `Custom MixMode` parameter under `Mecanim Translator`. It is enabled by default in version 3.8 to maintain current behaviour, using the set `Mix Mode` for each Mecanim layer. When disabled, `SkeletonMecanim` will use the recommended `MixMode` according to the layer blend mode. Additional information can be found in the [Mecanim Translator section](http://esotericsoftware.com/spine-unity#Parameters-for-animation-blending-control) on the spine-unity documentation pages.
|
* `SkeletonMecanim` now provides an additional `Custom MixMode` parameter under `Mecanim Translator`. It is enabled by default in version 3.8 to maintain current behaviour, using the set `Mix Mode` for each Mecanim layer. When disabled, `SkeletonMecanim` will use the recommended `MixMode` according to the layer blend mode. Additional information can be found in the [Mecanim Translator section](http://esotericsoftware.com/spine-unity#Parameters-for-animation-blending-control) on the spine-unity documentation pages.
|
||||||
|
* Added **SkeletonGraphic Timeline support**. Added supprot for multi-track Timeline preview in the Editor outside of play mode (multi-track scrubbing). See the [Timeline-Extension-UPM-Package](http://esotericsoftware.com/spine-unity#Timeline-Extension-UPM-Package) section of the spine-unity documentation for more information.
|
||||||
|
* Added support for double-sided lighting at all `SkeletonLit` shaders (including URP and LWRP packages).
|
||||||
|
* Added frustum culling update mode parameters `Update When Invisible` (Inspector parameter) and `UpdateMode` (available via code) to all Skeleton components. This provides a simple way to disable certain updates when the `Renderer` is no longer visible (outside all cameras, culled in frustum culling). The new `UpdateMode` property allows disabling updates at a finer granularity level than disabling the whole component. Available modes are: `Nothing`, `OnlyAnimationStatus`, `EverythingExceptMesh` and `FullUpdate`.
|
||||||
|
|
||||||
* **Changes of default values**
|
* **Changes of default values**
|
||||||
* `SkeletonMecanim`'s `Layer Mix Mode` now defaults to `MixMode.MixNext` instead of `MixMode.MixAlways`.
|
* `SkeletonMecanim`'s `Layer Mix Mode` now defaults to `MixMode.MixNext` instead of `MixMode.MixAlways`.
|
||||||
|
|||||||
@ -34,10 +34,9 @@
|
|||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
|
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
Cocos2dTextureLoader textureLoader;
|
Cocos2dTextureLoader textureLoader;
|
||||||
|
|
||||||
int computeTotalCoordCount(Skeleton& skeleton, int startSlotIndex, int endSlotIndex);
|
int computeTotalCoordCount(Skeleton& skeleton, int startSlotIndex, int endSlotIndex);
|
||||||
@ -49,46 +48,45 @@ namespace spine {
|
|||||||
Color4B ColorToColor4B(const Color& color);
|
Color4B ColorToColor4B(const Color& color);
|
||||||
bool slotIsOutRange(Slot& slot, int startSlotIndex, int endSlotIndex);
|
bool slotIsOutRange(Slot& slot, int startSlotIndex, int endSlotIndex);
|
||||||
bool nothingToDraw(Slot& slot, int startSlotIndex, int endSlotIndex);
|
bool nothingToDraw(Slot& slot, int startSlotIndex, int endSlotIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// C Variable length array
|
// C Variable length array
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// VLA not supported, use _malloca
|
// VLA not supported, use _malloca
|
||||||
#define VLA(type, arr, count) \
|
#define VLA(type, arr, count) \
|
||||||
type* arr = static_cast<type*>( _malloca(sizeof(type) * count) )
|
type* arr = static_cast<type*>( _malloca(sizeof(type) * count) )
|
||||||
#define VLA_FREE(arr) do { _freea(arr); } while(false)
|
#define VLA_FREE(arr) do { _freea(arr); } while(false)
|
||||||
#else
|
#else
|
||||||
#define VLA(type, arr, count) \
|
#define VLA(type, arr, count) \
|
||||||
type arr[count]
|
type arr[count]
|
||||||
#define VLA_FREE(arr)
|
#define VLA_FREE(arr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SkeletonRenderer* SkeletonRenderer::createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
|
||||||
SkeletonRenderer* SkeletonRenderer::createWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData) {
|
|
||||||
SkeletonRenderer* node = new SkeletonRenderer(skeleton, ownsSkeleton, ownsSkeletonData);
|
SkeletonRenderer* node = new SkeletonRenderer(skeleton, ownsSkeleton, ownsSkeletonData);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer* SkeletonRenderer::createWithData (SkeletonData* skeletonData, bool ownsSkeletonData) {
|
SkeletonRenderer* SkeletonRenderer::createWithData (SkeletonData* skeletonData, bool ownsSkeletonData) {
|
||||||
SkeletonRenderer* node = new SkeletonRenderer(skeletonData, ownsSkeletonData);
|
SkeletonRenderer* node = new SkeletonRenderer(skeletonData, ownsSkeletonData);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) {
|
SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) {
|
||||||
SkeletonRenderer* node = new SkeletonRenderer(skeletonDataFile, atlas, scale);
|
SkeletonRenderer* node = new SkeletonRenderer(skeletonDataFile, atlas, scale);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
SkeletonRenderer* SkeletonRenderer::createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
||||||
SkeletonRenderer* node = new SkeletonRenderer(skeletonDataFile, atlasFile, scale);
|
SkeletonRenderer* node = new SkeletonRenderer(skeletonDataFile, atlasFile, scale);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initialize () {
|
void SkeletonRenderer::initialize () {
|
||||||
_clipper = new (__FILE__, __LINE__) SkeletonClipping();
|
_clipper = new (__FILE__, __LINE__) SkeletonClipping();
|
||||||
|
|
||||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||||
@ -98,9 +96,9 @@ namespace spine {
|
|||||||
|
|
||||||
_skeleton->setToSetupPose();
|
_skeleton->setToSetupPose();
|
||||||
_skeleton->updateWorldTransform();
|
_skeleton->updateWorldTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
|
void SkeletonRenderer::setupGLProgramState (bool twoColorTintEnabled) {
|
||||||
if (twoColorTintEnabled) {
|
if (twoColorTintEnabled) {
|
||||||
#if COCOS2D_VERSION < 0x00040000
|
#if COCOS2D_VERSION < 0x00040000
|
||||||
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
|
setGLProgramState(SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState());
|
||||||
@ -119,8 +117,7 @@ namespace spine {
|
|||||||
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||||
MeshAttachment* meshAttachment = static_cast<MeshAttachment*>(attachment);
|
MeshAttachment* meshAttachment = static_cast<MeshAttachment*>(attachment);
|
||||||
texture = static_cast<AttachmentVertices*>(meshAttachment->getRendererObject())->_texture;
|
texture = static_cast<AttachmentVertices*>(meshAttachment->getRendererObject())->_texture;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,60 +128,60 @@ namespace spine {
|
|||||||
#if COCOS2D_VERSION < 0x00040000
|
#if COCOS2D_VERSION < 0x00040000
|
||||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP, texture));
|
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP, texture));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setSkeletonData (SkeletonData *skeletonData, bool ownsSkeletonData) {
|
void SkeletonRenderer::setSkeletonData (SkeletonData *skeletonData, bool ownsSkeletonData) {
|
||||||
_skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData);
|
_skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData);
|
||||||
_ownsSkeletonData = ownsSkeletonData;
|
_ownsSkeletonData = ownsSkeletonData;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer::SkeletonRenderer ()
|
SkeletonRenderer::SkeletonRenderer ()
|
||||||
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer::SkeletonRenderer(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData, bool ownsAtlas)
|
SkeletonRenderer::SkeletonRenderer(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData, bool ownsAtlas)
|
||||||
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
||||||
initWithSkeleton(skeleton, ownsSkeleton, ownsSkeletonData, ownsAtlas);
|
initWithSkeleton(skeleton, ownsSkeleton, ownsSkeletonData, ownsAtlas);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer::SkeletonRenderer (SkeletonData *skeletonData, bool ownsSkeletonData)
|
SkeletonRenderer::SkeletonRenderer (SkeletonData *skeletonData, bool ownsSkeletonData)
|
||||||
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
||||||
initWithData(skeletonData, ownsSkeletonData);
|
initWithData(skeletonData, ownsSkeletonData);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, Atlas* atlas, float scale)
|
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, Atlas* atlas, float scale)
|
||||||
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
||||||
initWithJsonFile(skeletonDataFile, atlas, scale);
|
initWithJsonFile(skeletonDataFile, atlas, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
|
SkeletonRenderer::SkeletonRenderer (const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
|
||||||
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
: _atlas(nullptr), _attachmentLoader(nullptr), _timeScale(1), _debugSlots(false), _debugBones(false), _debugMeshes(false), _debugBoundingRect(false), _effect(nullptr), _startSlotIndex(0), _endSlotIndex(std::numeric_limits<int>::max()) {
|
||||||
initWithJsonFile(skeletonDataFile, atlasFile, scale);
|
initWithJsonFile(skeletonDataFile, atlasFile, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonRenderer::~SkeletonRenderer () {
|
SkeletonRenderer::~SkeletonRenderer () {
|
||||||
if (_ownsSkeletonData) delete _skeleton->getData();
|
if (_ownsSkeletonData) delete _skeleton->getData();
|
||||||
if (_ownsSkeleton) delete _skeleton;
|
if (_ownsSkeleton) delete _skeleton;
|
||||||
if (_ownsAtlas && _atlas) delete _atlas;
|
if (_ownsAtlas && _atlas) delete _atlas;
|
||||||
if (_attachmentLoader) delete _attachmentLoader;
|
if (_attachmentLoader) delete _attachmentLoader;
|
||||||
delete _clipper;
|
delete _clipper;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData, bool ownsAtlas) {
|
void SkeletonRenderer::initWithSkeleton(Skeleton* skeleton, bool ownsSkeleton, bool ownsSkeletonData, bool ownsAtlas) {
|
||||||
_skeleton = skeleton;
|
_skeleton = skeleton;
|
||||||
_ownsSkeleton = ownsSkeleton;
|
_ownsSkeleton = ownsSkeleton;
|
||||||
_ownsSkeletonData = ownsSkeletonData;
|
_ownsSkeletonData = ownsSkeletonData;
|
||||||
_ownsAtlas = ownsAtlas;
|
_ownsAtlas = ownsAtlas;
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithData (SkeletonData* skeletonData, bool ownsSkeletonData) {
|
void SkeletonRenderer::initWithData (SkeletonData* skeletonData, bool ownsSkeletonData) {
|
||||||
_ownsSkeleton = true;
|
_ownsSkeleton = true;
|
||||||
setSkeletonData(skeletonData, ownsSkeletonData);
|
setSkeletonData(skeletonData, ownsSkeletonData);
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) {
|
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) {
|
||||||
_atlas = atlas;
|
_atlas = atlas;
|
||||||
_attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas);
|
_attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas);
|
||||||
|
|
||||||
@ -197,9 +194,9 @@ namespace spine {
|
|||||||
setSkeletonData(skeletonData, true);
|
setSkeletonData(skeletonData, true);
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
||||||
_atlas = new (__FILE__, __LINE__) Atlas(atlasFile.c_str(), &textureLoader, true);
|
_atlas = new (__FILE__, __LINE__) Atlas(atlasFile.c_str(), &textureLoader, true);
|
||||||
CCASSERT(_atlas, "Error reading atlas file.");
|
CCASSERT(_atlas, "Error reading atlas file.");
|
||||||
|
|
||||||
@ -215,9 +212,9 @@ namespace spine {
|
|||||||
setSkeletonData(skeletonData, true);
|
setSkeletonData(skeletonData, true);
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) {
|
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, Atlas* atlas, float scale) {
|
||||||
_atlas = atlas;
|
_atlas = atlas;
|
||||||
_attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas);
|
_attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas);
|
||||||
|
|
||||||
@ -229,9 +226,9 @@ namespace spine {
|
|||||||
setSkeletonData(skeletonData, true);
|
setSkeletonData(skeletonData, true);
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
||||||
_atlas = new (__FILE__, __LINE__) Atlas(atlasFile.c_str(), &textureLoader, true);
|
_atlas = new (__FILE__, __LINE__) Atlas(atlasFile.c_str(), &textureLoader, true);
|
||||||
CCASSERT(_atlas, "Error reading atlas file.");
|
CCASSERT(_atlas, "Error reading atlas file.");
|
||||||
|
|
||||||
@ -246,16 +243,16 @@ namespace spine {
|
|||||||
setSkeletonData(skeletonData, true);
|
setSkeletonData(skeletonData, true);
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SkeletonRenderer::update (float deltaTime) {
|
void SkeletonRenderer::update (float deltaTime) {
|
||||||
Node::update(deltaTime);
|
Node::update(deltaTime);
|
||||||
if (_ownsSkeleton) _skeleton->update(deltaTime * _timeScale);
|
if (_ownsSkeleton) _skeleton->update(deltaTime * _timeScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t transformFlags) {
|
void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t transformFlags) {
|
||||||
// Early exit if the skeleton is invisible
|
// Early exit if the skeleton is invisible.
|
||||||
if (getDisplayedOpacity() == 0 || _skeleton->getColor().a == 0) {
|
if (getDisplayedOpacity() == 0 || _skeleton->getColor().a == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -269,14 +266,14 @@ namespace spine {
|
|||||||
VLA(float, worldCoords, coordCount);
|
VLA(float, worldCoords, coordCount);
|
||||||
transformWorldVertices(worldCoords, coordCount, *_skeleton, _startSlotIndex, _endSlotIndex);
|
transformWorldVertices(worldCoords, coordCount, *_skeleton, _startSlotIndex, _endSlotIndex);
|
||||||
|
|
||||||
#if CC_USE_CULLING
|
#if CC_USE_CULLING
|
||||||
const cocos2d::Rect bb = computeBoundingRect(worldCoords, coordCount / 2);
|
const cocos2d::Rect bb = computeBoundingRect(worldCoords, coordCount / 2);
|
||||||
|
|
||||||
if (cullRectangle(renderer, transform, bb)) {
|
if (cullRectangle(renderer, transform, bb)) {
|
||||||
VLA_FREE(worldCoords);
|
VLA_FREE(worldCoords);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const float* worldCoordPtr = worldCoords;
|
const float* worldCoordPtr = worldCoords;
|
||||||
SkeletonBatch* batch = SkeletonBatch::getInstance();
|
SkeletonBatch* batch = SkeletonBatch::getInstance();
|
||||||
@ -337,7 +334,7 @@ namespace spine {
|
|||||||
dstTriangleVertices = reinterpret_cast<float*>(trianglesTwoColor.verts);
|
dstTriangleVertices = reinterpret_cast<float*>(trianglesTwoColor.verts);
|
||||||
dstStride = sizeof(V3F_C4B_C4B_T2F) / sizeof(float);
|
dstStride = sizeof(V3F_C4B_C4B_T2F) / sizeof(float);
|
||||||
}
|
}
|
||||||
// Copy world vertices to triangle vertices
|
// Copy world vertices to triangle vertices.
|
||||||
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, 4, dstStride);
|
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, 4, dstStride);
|
||||||
worldCoordPtr += 8;
|
worldCoordPtr += 8;
|
||||||
|
|
||||||
@ -372,7 +369,7 @@ namespace spine {
|
|||||||
dstVertexCount = trianglesTwoColor.vertCount;
|
dstVertexCount = trianglesTwoColor.vertCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy world vertices to triangle vertices
|
// Copy world vertices to triangle vertices.
|
||||||
//assert(dstVertexCount * 2 == attachment->super.worldVerticesLength);
|
//assert(dstVertexCount * 2 == attachment->super.worldVerticesLength);
|
||||||
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, dstVertexCount, dstStride);
|
interleaveCoordinates(dstTriangleVertices, worldCoordPtr, dstVertexCount, dstStride);
|
||||||
worldCoordPtr += dstVertexCount * 2;
|
worldCoordPtr += dstVertexCount * 2;
|
||||||
@ -398,16 +395,14 @@ namespace spine {
|
|||||||
darkColor.a = darkPremultipliedAlpha;
|
darkColor.a = darkPremultipliedAlpha;
|
||||||
|
|
||||||
color.a *= nodeColor.a * _skeleton->getColor().a * slot->getColor().a;
|
color.a *= nodeColor.a * _skeleton->getColor().a * slot->getColor().a;
|
||||||
// skip rendering if the color of this attachment is 0
|
if (color.a == 0) {
|
||||||
if (color.a == 0){
|
|
||||||
_clipper->clipEnd(*slot);
|
_clipper->clipEnd(*slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
color.r *= nodeColor.r * _skeleton->getColor().r * slot->getColor().r;
|
color.r *= nodeColor.r * _skeleton->getColor().r * slot->getColor().r;
|
||||||
color.g *= nodeColor.g * _skeleton->getColor().g * slot->getColor().g;
|
color.g *= nodeColor.g * _skeleton->getColor().g * slot->getColor().g;
|
||||||
color.b *= nodeColor.b * _skeleton->getColor().b * slot->getColor().b;
|
color.b *= nodeColor.b * _skeleton->getColor().b * slot->getColor().b;
|
||||||
if (_premultipliedAlpha)
|
if (_premultipliedAlpha) {
|
||||||
{
|
|
||||||
color.r *= color.a;
|
color.r *= color.a;
|
||||||
color.g *= color.a;
|
color.g *= color.a;
|
||||||
color.b *= color.a;
|
color.b *= color.a;
|
||||||
@ -423,7 +418,7 @@ namespace spine {
|
|||||||
_clipper->clipTriangles((float*)&triangles.verts[0].vertices, triangles.indices, triangles.indexCount, (float*)&triangles.verts[0].texCoords, sizeof(cocos2d::V3F_C4B_T2F) / 4);
|
_clipper->clipTriangles((float*)&triangles.verts[0].vertices, triangles.indices, triangles.indexCount, (float*)&triangles.verts[0].texCoords, sizeof(cocos2d::V3F_C4B_T2F) / 4);
|
||||||
batch->deallocateVertices(triangles.vertCount);
|
batch->deallocateVertices(triangles.vertCount);
|
||||||
|
|
||||||
if (_clipper->getClippedTriangles().size() == 0){
|
if (_clipper->getClippedTriangles().size() == 0) {
|
||||||
_clipper->clipEnd(*slot);
|
_clipper->clipEnd(*slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -466,7 +461,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not clipping
|
// Not clipping.
|
||||||
#if COCOS2D_VERSION < 0x00040000
|
#if COCOS2D_VERSION < 0x00040000
|
||||||
cocos2d::TrianglesCommand* batchedTriangles = batch->addCommand(renderer, _globalZOrder, attachmentVertices->_texture, _glProgramState, blendFunc, triangles, transform, transformFlags);
|
cocos2d::TrianglesCommand* batchedTriangles = batch->addCommand(renderer, _globalZOrder, attachmentVertices->_texture, _glProgramState, blendFunc, triangles, transform, transformFlags);
|
||||||
#else
|
#else
|
||||||
@ -489,13 +484,13 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Two tints
|
// Two color tinting.
|
||||||
|
|
||||||
if (_clipper->isClipping()) {
|
if (_clipper->isClipping()) {
|
||||||
_clipper->clipTriangles((float*)&trianglesTwoColor.verts[0].position, trianglesTwoColor.indices, trianglesTwoColor.indexCount, (float*)&trianglesTwoColor.verts[0].texCoords, sizeof(V3F_C4B_C4B_T2F) / 4);
|
_clipper->clipTriangles((float*)&trianglesTwoColor.verts[0].position, trianglesTwoColor.indices, trianglesTwoColor.indexCount, (float*)&trianglesTwoColor.verts[0].texCoords, sizeof(V3F_C4B_C4B_T2F) / 4);
|
||||||
twoColorBatch->deallocateVertices(trianglesTwoColor.vertCount);
|
twoColorBatch->deallocateVertices(trianglesTwoColor.vertCount);
|
||||||
|
|
||||||
if (_clipper->getClippedTriangles().size() == 0){
|
if (_clipper->getClippedTriangles().size() == 0) {
|
||||||
_clipper->clipEnd(*slot);
|
_clipper->clipEnd(*slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -572,13 +567,10 @@ namespace spine {
|
|||||||
if (lastTwoColorTrianglesCommand) {
|
if (lastTwoColorTrianglesCommand) {
|
||||||
Node* parent = this->getParent();
|
Node* parent = this->getParent();
|
||||||
|
|
||||||
// We need to decide if we can postpone flushing the current
|
// We need to decide if we can postpone flushing the current batch. We can postpone if the next sibling node is a two color
|
||||||
// batch. We can postpone if the next sibling node is a
|
// tinted skeleton with the same global-z.
|
||||||
// two color tinted skeleton with the same global-z.
|
// The parent->getChildrenCount() > 100 check is a hack as checking for a sibling is an O(n) operation, and if all children
|
||||||
// The parent->getChildrenCount() > 100 check is a hack
|
// of this nodes parent are skeletons, we are in O(n2) territory.
|
||||||
// as checking for a sibling is an O(n) operation, and if
|
|
||||||
// all children of this nodes parent are skeletons, we
|
|
||||||
// are in O(n2) territory.
|
|
||||||
if (!parent || parent->getChildrenCount() > 100 || getChildrenCount() != 0) {
|
if (!parent || parent->getChildrenCount() > 100 || getChildrenCount() != 0) {
|
||||||
lastTwoColorTrianglesCommand->setForceFlush(true);
|
lastTwoColorTrianglesCommand->setForceFlush(true);
|
||||||
} else {
|
} else {
|
||||||
@ -613,10 +605,10 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VLA_FREE(worldCoords);
|
VLA_FREE(worldCoords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SkeletonRenderer::drawDebug (Renderer* renderer, const Mat4 &transform, uint32_t transformFlags) {
|
void SkeletonRenderer::drawDebug (Renderer* renderer, const Mat4 &transform, uint32_t transformFlags) {
|
||||||
|
|
||||||
#if !defined(USE_MATRIX_STACK_PROJECTION_ONLY)
|
#if !defined(USE_MATRIX_STACK_PROJECTION_ONLY)
|
||||||
Director* director = Director::getInstance();
|
Director* director = Director::getInstance();
|
||||||
@ -737,9 +729,9 @@ namespace spine {
|
|||||||
#if !defined(USE_MATRIX_STACK_PROJECTION_ONLY)
|
#if !defined(USE_MATRIX_STACK_PROJECTION_ONLY)
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cocos2d::Rect SkeletonRenderer::getBoundingBox () const {
|
cocos2d::Rect SkeletonRenderer::getBoundingBox () const {
|
||||||
const int coordCount = computeTotalCoordCount(*_skeleton, _startSlotIndex, _endSlotIndex);
|
const int coordCount = computeTotalCoordCount(*_skeleton, _startSlotIndex, _endSlotIndex);
|
||||||
if (coordCount == 0) return { 0, 0, 0, 0 };
|
if (coordCount == 0) return { 0, 0, 0, 0 };
|
||||||
VLA(float, worldCoords, coordCount);
|
VLA(float, worldCoords, coordCount);
|
||||||
@ -747,152 +739,152 @@ namespace spine {
|
|||||||
const cocos2d::Rect bb = computeBoundingRect(worldCoords, coordCount / 2);
|
const cocos2d::Rect bb = computeBoundingRect(worldCoords, coordCount / 2);
|
||||||
VLA_FREE(worldCoords);
|
VLA_FREE(worldCoords);
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Convenience methods for Skeleton_* functions.
|
// --- Convenience methods for Skeleton_* functions.
|
||||||
|
|
||||||
void SkeletonRenderer::updateWorldTransform() {
|
void SkeletonRenderer::updateWorldTransform() {
|
||||||
_skeleton->updateWorldTransform();
|
_skeleton->updateWorldTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setToSetupPose () {
|
void SkeletonRenderer::setToSetupPose () {
|
||||||
_skeleton->setToSetupPose();
|
_skeleton->setToSetupPose();
|
||||||
}
|
}
|
||||||
void SkeletonRenderer::setBonesToSetupPose () {
|
void SkeletonRenderer::setBonesToSetupPose () {
|
||||||
_skeleton->setBonesToSetupPose();
|
_skeleton->setBonesToSetupPose();
|
||||||
}
|
}
|
||||||
void SkeletonRenderer::setSlotsToSetupPose () {
|
void SkeletonRenderer::setSlotsToSetupPose () {
|
||||||
_skeleton->setSlotsToSetupPose();
|
_skeleton->setSlotsToSetupPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bone* SkeletonRenderer::findBone (const std::string& boneName) const {
|
Bone* SkeletonRenderer::findBone (const std::string& boneName) const {
|
||||||
return _skeleton->findBone(boneName.c_str());
|
return _skeleton->findBone(boneName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Slot* SkeletonRenderer::findSlot (const std::string& slotName) const {
|
Slot* SkeletonRenderer::findSlot (const std::string& slotName) const {
|
||||||
return _skeleton->findSlot( slotName.c_str());
|
return _skeleton->findSlot( slotName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setSkin (const std::string& skinName) {
|
void SkeletonRenderer::setSkin (const std::string& skinName) {
|
||||||
_skeleton->setSkin(skinName.empty() ? 0 : skinName.c_str());
|
_skeleton->setSkin(skinName.empty() ? 0 : skinName.c_str());
|
||||||
}
|
}
|
||||||
void SkeletonRenderer::setSkin (const char* skinName) {
|
void SkeletonRenderer::setSkin (const char* skinName) {
|
||||||
_skeleton->setSkin(skinName);
|
_skeleton->setSkin(skinName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Attachment* SkeletonRenderer::getAttachment (const std::string& slotName, const std::string& attachmentName) const {
|
Attachment* SkeletonRenderer::getAttachment (const std::string& slotName, const std::string& attachmentName) const {
|
||||||
return _skeleton->getAttachment(slotName.c_str(), attachmentName.c_str());
|
return _skeleton->getAttachment(slotName.c_str(), attachmentName.c_str());
|
||||||
}
|
}
|
||||||
bool SkeletonRenderer::setAttachment (const std::string& slotName, const std::string& attachmentName) {
|
bool SkeletonRenderer::setAttachment (const std::string& slotName, const std::string& attachmentName) {
|
||||||
bool result = _skeleton->getAttachment(slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str()) ? true : false;
|
bool result = _skeleton->getAttachment(slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str()) ? true : false;
|
||||||
_skeleton->setAttachment(slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str());
|
_skeleton->setAttachment(slotName.c_str(), attachmentName.empty() ? 0 : attachmentName.c_str());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
bool SkeletonRenderer::setAttachment (const std::string& slotName, const char* attachmentName) {
|
bool SkeletonRenderer::setAttachment (const std::string& slotName, const char* attachmentName) {
|
||||||
bool result = _skeleton->getAttachment(slotName.c_str(), attachmentName) ? true : false;
|
bool result = _skeleton->getAttachment(slotName.c_str(), attachmentName) ? true : false;
|
||||||
_skeleton->setAttachment(slotName.c_str(), attachmentName);
|
_skeleton->setAttachment(slotName.c_str(), attachmentName);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setTwoColorTint(bool enabled) {
|
void SkeletonRenderer::setTwoColorTint(bool enabled) {
|
||||||
#if COCOS2D_VERSION >= 0x00040000
|
#if COCOS2D_VERSION >= 0x00040000
|
||||||
_twoColorTint = enabled;
|
_twoColorTint = enabled;
|
||||||
#endif
|
#endif
|
||||||
setupGLProgramState(enabled);
|
setupGLProgramState(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonRenderer::isTwoColorTint() {
|
bool SkeletonRenderer::isTwoColorTint() {
|
||||||
#if COCOS2D_VERSION < 0x00040000
|
#if COCOS2D_VERSION < 0x00040000
|
||||||
return getGLProgramState() == SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState();
|
return getGLProgramState() == SkeletonTwoColorBatch::getInstance()->getTwoColorTintProgramState();
|
||||||
#else
|
#else
|
||||||
return _twoColorTint;
|
return _twoColorTint;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setVertexEffect(VertexEffect *effect) {
|
void SkeletonRenderer::setVertexEffect(VertexEffect *effect) {
|
||||||
this->_effect = effect;
|
this->_effect = effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setSlotsRange(int startSlotIndex, int endSlotIndex) {
|
void SkeletonRenderer::setSlotsRange(int startSlotIndex, int endSlotIndex) {
|
||||||
_startSlotIndex = startSlotIndex == -1 ? 0 : startSlotIndex;
|
_startSlotIndex = startSlotIndex == -1 ? 0 : startSlotIndex;
|
||||||
_endSlotIndex = endSlotIndex == -1 ? std::numeric_limits<int>::max() : endSlotIndex;
|
_endSlotIndex = endSlotIndex == -1 ? std::numeric_limits<int>::max() : endSlotIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
Skeleton* SkeletonRenderer::getSkeleton () const {
|
Skeleton* SkeletonRenderer::getSkeleton () const {
|
||||||
return _skeleton;
|
return _skeleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setTimeScale (float scale) {
|
void SkeletonRenderer::setTimeScale (float scale) {
|
||||||
_timeScale = scale;
|
_timeScale = scale;
|
||||||
}
|
}
|
||||||
float SkeletonRenderer::getTimeScale () const {
|
float SkeletonRenderer::getTimeScale () const {
|
||||||
return _timeScale;
|
return _timeScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setDebugSlotsEnabled (bool enabled) {
|
void SkeletonRenderer::setDebugSlotsEnabled (bool enabled) {
|
||||||
_debugSlots = enabled;
|
_debugSlots = enabled;
|
||||||
}
|
}
|
||||||
bool SkeletonRenderer::getDebugSlotsEnabled () const {
|
bool SkeletonRenderer::getDebugSlotsEnabled () const {
|
||||||
return _debugSlots;
|
return _debugSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setDebugBonesEnabled (bool enabled) {
|
void SkeletonRenderer::setDebugBonesEnabled (bool enabled) {
|
||||||
_debugBones = enabled;
|
_debugBones = enabled;
|
||||||
}
|
}
|
||||||
bool SkeletonRenderer::getDebugBonesEnabled () const {
|
bool SkeletonRenderer::getDebugBonesEnabled () const {
|
||||||
return _debugBones;
|
return _debugBones;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setDebugMeshesEnabled (bool enabled) {
|
void SkeletonRenderer::setDebugMeshesEnabled (bool enabled) {
|
||||||
_debugMeshes = enabled;
|
_debugMeshes = enabled;
|
||||||
}
|
}
|
||||||
bool SkeletonRenderer::getDebugMeshesEnabled () const {
|
bool SkeletonRenderer::getDebugMeshesEnabled () const {
|
||||||
return _debugMeshes;
|
return _debugMeshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setDebugBoundingRectEnabled(bool enabled) {
|
void SkeletonRenderer::setDebugBoundingRectEnabled(bool enabled) {
|
||||||
_debugBoundingRect = enabled;
|
_debugBoundingRect = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonRenderer::getDebugBoundingRectEnabled() const {
|
bool SkeletonRenderer::getDebugBoundingRectEnabled() const {
|
||||||
return _debugBoundingRect;
|
return _debugBoundingRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::onEnter () {
|
void SkeletonRenderer::onEnter () {
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
if (_scriptType == kScriptTypeJavascript && ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnter)) return;
|
if (_scriptType == kScriptTypeJavascript && ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnter)) return;
|
||||||
#endif
|
#endif
|
||||||
Node::onEnter();
|
Node::onEnter();
|
||||||
scheduleUpdate();
|
scheduleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::onExit () {
|
void SkeletonRenderer::onExit () {
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
if (_scriptType == kScriptTypeJavascript && ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnExit)) return;
|
if (_scriptType == kScriptTypeJavascript && ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnExit)) return;
|
||||||
#endif
|
#endif
|
||||||
Node::onExit();
|
Node::onExit();
|
||||||
unscheduleUpdate();
|
unscheduleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- CCBlendProtocol
|
// --- CCBlendProtocol
|
||||||
|
|
||||||
const BlendFunc& SkeletonRenderer::getBlendFunc () const {
|
const BlendFunc& SkeletonRenderer::getBlendFunc () const {
|
||||||
return _blendFunc;
|
return _blendFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setBlendFunc (const BlendFunc &blendFunc) {
|
void SkeletonRenderer::setBlendFunc (const BlendFunc &blendFunc) {
|
||||||
_blendFunc = blendFunc;
|
_blendFunc = blendFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonRenderer::setOpacityModifyRGB (bool value) {
|
void SkeletonRenderer::setOpacityModifyRGB (bool value) {
|
||||||
_premultipliedAlpha = value;
|
_premultipliedAlpha = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonRenderer::isOpacityModifyRGB () const {
|
bool SkeletonRenderer::isOpacityModifyRGB () const {
|
||||||
return _premultipliedAlpha;
|
return _premultipliedAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
cocos2d::Rect computeBoundingRect(const float* coords, int vertexCount) {
|
cocos2d::Rect computeBoundingRect(const float* coords, int vertexCount) {
|
||||||
assert(coords);
|
assert(coords);
|
||||||
assert(vertexCount > 0);
|
assert(vertexCount > 0);
|
||||||
@ -1077,6 +1069,6 @@ namespace spine {
|
|||||||
Color4B ColorToColor4B(const Color& color) {
|
Color4B ColorToColor4B(const Color& color) {
|
||||||
return { (uint8_t)(color.r * 255.f), (uint8_t)(color.g * 255.f), (uint8_t)(color.b * 255.f), (uint8_t)(color.a * 255.f) };
|
return { (uint8_t)(color.r * 255.f), (uint8_t)(color.g * 255.f), (uint8_t)(color.b * 255.f), (uint8_t)(color.a * 255.f) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,10 @@ public class SkeletonRenderer {
|
|||||||
Object[] drawOrder = skeleton.drawOrder.items;
|
Object[] drawOrder = skeleton.drawOrder.items;
|
||||||
for (int i = 0, n = skeleton.drawOrder.size; i < n; i++) {
|
for (int i = 0, n = skeleton.drawOrder.size; i < n; i++) {
|
||||||
Slot slot = (Slot)drawOrder[i];
|
Slot slot = (Slot)drawOrder[i];
|
||||||
if (!slot.bone.active) continue;
|
if (!slot.bone.active) {
|
||||||
|
clipper.clipEnd(slot);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Attachment attachment = slot.attachment;
|
Attachment attachment = slot.attachment;
|
||||||
if (attachment instanceof RegionAttachment) {
|
if (attachment instanceof RegionAttachment) {
|
||||||
RegionAttachment region = (RegionAttachment)attachment;
|
RegionAttachment region = (RegionAttachment)attachment;
|
||||||
@ -169,7 +172,10 @@ public class SkeletonRenderer {
|
|||||||
Object[] drawOrder = skeleton.drawOrder.items;
|
Object[] drawOrder = skeleton.drawOrder.items;
|
||||||
for (int i = 0, n = skeleton.drawOrder.size; i < n; i++) {
|
for (int i = 0, n = skeleton.drawOrder.size; i < n; i++) {
|
||||||
Slot slot = (Slot)drawOrder[i];
|
Slot slot = (Slot)drawOrder[i];
|
||||||
if (!slot.bone.active) continue;
|
if (!slot.bone.active) {
|
||||||
|
clipper.clipEnd(slot);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Texture texture = null;
|
Texture texture = null;
|
||||||
int vertexSize = clipper.isClipping() ? 2 : 5;
|
int vertexSize = clipper.isClipping() ? 2 : 5;
|
||||||
Attachment attachment = slot.attachment;
|
Attachment attachment = slot.attachment;
|
||||||
@ -292,7 +298,10 @@ public class SkeletonRenderer {
|
|||||||
Object[] drawOrder = skeleton.drawOrder.items;
|
Object[] drawOrder = skeleton.drawOrder.items;
|
||||||
for (int i = 0, n = skeleton.drawOrder.size; i < n; i++) {
|
for (int i = 0, n = skeleton.drawOrder.size; i < n; i++) {
|
||||||
Slot slot = (Slot)drawOrder[i];
|
Slot slot = (Slot)drawOrder[i];
|
||||||
if (!slot.bone.active) continue;
|
if (!slot.bone.active) {
|
||||||
|
clipper.clipEnd(slot);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Texture texture = null;
|
Texture texture = null;
|
||||||
int vertexSize = clipper.isClipping() ? 2 : 6;
|
int vertexSize = clipper.isClipping() ? 2 : 6;
|
||||||
Attachment attachment = slot.attachment;
|
Attachment attachment = slot.attachment;
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
# spine-ts
|
# spine-ts
|
||||||
|
|
||||||
The spine-ts runtime provides functionality to load and manipulate [Spine](http://esotericsoftware.com) skeletal animation data using TypeScript and JavaScript. spine-ts is split
|
The spine-ts runtime provides functionality to load and manipulate [Spine](http://esotericsoftware.com) skeletal animation data using TypeScript and JavaScript. spine-ts is split
|
||||||
up into multiple modules:
|
up into multiple modules:
|
||||||
|
|
||||||
1. **Core**: `core/`, the core classes to load and process Spine models
|
1. **Core**: `core/`, the core classes to load and process Spine skeletons.
|
||||||
1. **WebGL**: `webgl/`, a self-contained WebGL backend, build on the core classes
|
1. **WebGL**: `webgl/`, a self-contained WebGL backend, built on the core classes.
|
||||||
1. **Canvas**: `canvas/`, a self-contained Canvas backend, build on the core classes
|
1. **Canvas**: `canvas/`, a self-contained Canvas backend, built on the core classes.
|
||||||
1. **THREE.JS**: `threejs/`, a self-contained THREE.JS backend, build on the core classes
|
1. **THREE.JS**: `threejs/`, a self-contained THREE.JS backend, built on the core classes.
|
||||||
1. **Player**: `player/`, a self-contained player to easily display Spine animations on your website, build on core classes & WebGL backend.
|
1. **Player**: `player/`, a self-contained player to easily display Spine animations on your website, built on core the classes and WebGL backend.
|
||||||
|
|
||||||
While the source code for the core library and backends is written in TypeScript, all code is compiled to easily consumable JavaScript.
|
While the source code for the core library and backends is written in TypeScript, all code is compiled to JavaScript.
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
You are welcome to evaluate the Spine Runtimes and the examples we provide in this repository free of charge.
|
You are welcome to evaluate the Spine Runtimes and the examples we provide in this repository free of charge.
|
||||||
|
|
||||||
You can integrate the Spine Runtimes into your software free of charge, but users of your software must have their own [Spine license](https://esotericsoftware.com/spine-purchase). Please make your users aware of this requirement! This option is often chosen by those making development tools, such as an SDK, game toolkit, or software library.
|
You can integrate the Spine Runtimes into your software free of charge, but users of your software must have their own [Spine license](https://esotericsoftware.com/spine-purchase). Please make your users aware of this requirement! This option is often chosen by those making development tools, such as an SDK, game toolkit, or software library.
|
||||||
@ -22,17 +23,16 @@ For the official legal terms governing the Spine Runtimes, please read the [Spin
|
|||||||
|
|
||||||
## Spine version
|
## Spine version
|
||||||
|
|
||||||
spine-ts works with data exported from Spine 3.9.xx.
|
spine-ts works with data exported from Spine 3.8.xx.
|
||||||
|
|
||||||
spine-ts WebGL & players backends supports all Spine features.
|
The spine-ts WebGL and Player backends support all Spine features.
|
||||||
|
|
||||||
spine-ts Canvas does not support white space stripped texture atlases, color tinting, mesh attachments and clipping. Only the alpha channel from tint colors is applied. Experimental support for mesh attachments can be enabled by setting `spine.canvas.SkeletonRenderer.useTriangleRendering` to true. Note that this method is slow and may lead to artifacts on some browsers.
|
spine-ts Canvas does not support white space stripped texture atlases, color tinting, mesh attachments, or clipping. Only the alpha channel from tint colors is applied. Experimental support for mesh attachments can be enabled by setting `spine.canvas.SkeletonRenderer.useTriangleRendering` to true. Note that this experimental mesh rendering is slow and may lead to artifacts on some browsers.
|
||||||
|
|
||||||
spine-ts THREE.JS does not support two color tinting & blend modes. The THREE.JS backend provides `SkeletonMesh.zOffset` to avoid z-fighting. Adjust to your near/far plane settings.
|
spine-ts THREE.JS does not support two color tinting or blend modes. The THREE.JS backend provides `SkeletonMesh.zOffset` to avoid z-fighting. Adjust to your near/far plane settings.
|
||||||
|
|
||||||
spine-ts does not yet support loading the binary format.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above.
|
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above.
|
||||||
2. To use only the core library without rendering support, include the `build/spine-core.js` file in your project.
|
2. To use only the core library without rendering support, include the `build/spine-core.js` file in your project.
|
||||||
3. To use the WebGL backend, include the `build/spine-webgl.js` file in your project.
|
3. To use the WebGL backend, include the `build/spine-webgl.js` file in your project.
|
||||||
@ -42,89 +42,102 @@ spine-ts does not yet support loading the binary format.
|
|||||||
|
|
||||||
All `*.js` files are self-contained and include both the core and respective backend classes.
|
All `*.js` files are self-contained and include both the core and respective backend classes.
|
||||||
|
|
||||||
If you write your app with TypeScript, additionally copy the corresponding `build/spine-*.d.ts` file to your project.
|
If you write your app with TypeScript, additionally copy the corresponding `build/spine-*.d.ts` file into your project.
|
||||||
|
|
||||||
**Note:** If you are using the compiled `.js` files with ES6 or other module systems, you have to add
|
**Note:** If you are using the compiled `.js` files with ES6 or other module systems, you need to add:
|
||||||
|
|
||||||
```
|
```
|
||||||
export { spine };
|
export { spine };
|
||||||
```
|
```
|
||||||
|
|
||||||
At the bottom of the `.js` file you are using. You can then import the module as usual, e.g.:
|
At the bottom of the `.js` file you are using. You can then import the module as usual, for example:
|
||||||
|
|
||||||
```
|
```
|
||||||
import { spine } from './spine-webgl.js';
|
import { spine } from './spine-webgl.js';
|
||||||
```
|
```
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
To run the examples, the image, atlas, and JSON files must be served by a webserver, they can't be loaded from your local disk. Spawn a light-weight web server in the root of spine-ts, then navigate to the `index.html` file for the example you want to view. E.g.:
|
|
||||||
|
To run the various examples found in each of the spine-ts backend folders, the image, atlas, and JSON files must be served by a webserver. For security reasons browsers will not load these files from your local disk. To work around this, you can spawn a lightweight web server in the spine-ts folder, then navigate to the `index.html` file for the example you want to view. For example:
|
||||||
|
|
||||||
```
|
```
|
||||||
cd spine-ts
|
cd spine-ts
|
||||||
python -m SimpleHTTPServer
|
python -m SimpleHTTPServer // for Python 2
|
||||||
|
python -m http.server // for Python 3
|
||||||
```
|
```
|
||||||
|
|
||||||
Then open `http://localhost:8000/webgl/example`, `http://localhost:8000/canvas/example`, `https://localhost:8000/threejs/example` or `http://localhost:8000/player/example` in your browser.
|
Then open `http://localhost:8000/webgl/example`, `http://localhost:8000/canvas/example`, `https://localhost:8000/threejs/example`, or `http://localhost:8000/player/example` in your browser.
|
||||||
|
|
||||||
## WebGL Demos
|
### WebGL demos
|
||||||
The spine-ts WebGL demos load their image, atlas, and JSON files from our webserver and so can be run directly, without needing a webserver. The demos can be viewed [all on one page](http://esotericsoftware.com/spine-demos/) or in individual, standalone pages which are easy for you to explore and edit. See the [standalone demos source code](webgl/demos) and view the pages here:
|
|
||||||
|
|
||||||
- [Spine vs sprite sheets](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/spritesheets.html)
|
The spine-ts WebGL demos can be viewed [all on one page](http://esotericsoftware.com/spine-demos/) or in individual, standalone pages which are easy for you to explore and edit. See the [standalone demos source code](webgl/demos) and view the pages here:
|
||||||
- [Image changes](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/imagechanges.html)
|
|
||||||
- [Transitions](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/transitions.html)
|
- [Spine vs sprite sheets](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/spritesheets.html)
|
||||||
- [Meshes](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/meshes.html)
|
- [Image changes](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/imagechanges.html)
|
||||||
- [Skins](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/skins.html)
|
- [Transitions](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/transitions.html)
|
||||||
- [Hoverboard](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/hoverboard.html)
|
- [Meshes](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/meshes.html)
|
||||||
- [Vine](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/vine.html)
|
- [Skins](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/skins.html)
|
||||||
- [Clipping](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/clipping.html)
|
- [Hoverboard](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/hoverboard.html)
|
||||||
- [Stretchyman](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/stretchyman.html)
|
- [Vine](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/vine.html)
|
||||||
- [Tank](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/tank.html)
|
- [Clipping](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/clipping.html)
|
||||||
- [Transform constraints](http://rawgit.com/EsotericSoftware/spine-runtimes/3.6/spine-ts/webgl/demos/transforms.html)
|
- [Stretchyman](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/stretchyman.html)
|
||||||
|
- [Tank](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/tank.html)
|
||||||
|
- [Transform constraints](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/demos/transforms.html)
|
||||||
|
|
||||||
Please note that Chrome and possibly other browsers do not use the original CORS headers when loading cached resources. After the initial page load for a demo, you may need to forcefully refresh (hold `shift` and click refresh) or clear your browser cache.
|
Please note that Chrome and possibly other browsers do not use the original CORS headers when loading cached resources. After the initial page load for a demo, you may need to forcefully refresh (hold `shift` and click refresh) or clear your browser cache.
|
||||||
|
|
||||||
## Development Setup
|
### WebGL examples
|
||||||
The spine-ts runtime and the various backends are implemented in TypeScript for greater maintainability and better tooling support. To
|
|
||||||
setup a development environment, follow these steps.
|
|
||||||
|
|
||||||
1. Install [NPM](https://nodejs.org/en/download/) and make sure it's available on the command line
|
The WebGL demos serve well as examples, showing various ways to use the APIs. We also provide a simple, self-contained example with UI to control the skeletons:
|
||||||
2. On the command line, Install the TypeScript compiler via `npm install -g typescript`
|
|
||||||
3. Install [Visual Studio Code](https://code.visualstudio.com/)
|
- [WebGL example](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/example/index.html)
|
||||||
4. On the command line, change into the `spine-ts` directory
|
|
||||||
|
A barebones example is also available. It doesn't use JQuery and shows the minimal code necessary to use spine-ts with WebGL to load and render a skeleton:
|
||||||
|
|
||||||
|
- [WebGL barebones](http://rawgit.com/EsotericSoftware/spine-runtimes/3.8/spine-ts/webgl/example/barebones.html)
|
||||||
|
|
||||||
|
## Development setup
|
||||||
|
|
||||||
|
The spine-ts runtime and the various backends are implemented in TypeScript for greater maintainability and better tooling support. To setup a development environment, follow these steps:
|
||||||
|
|
||||||
|
1. Install [NPM](https://nodejs.org/en/download/) and make sure it's available on the command line.
|
||||||
|
2. On the command line, Install the TypeScript compiler via `npm install -g typescript`.
|
||||||
|
3. Install [Visual Studio Code](https://code.visualstudio.com/).
|
||||||
|
4. On the command line, change into the `spine-ts` directory.
|
||||||
5. Start the TypeScript compiler in watcher mode for the backend you want to work on:
|
5. Start the TypeScript compiler in watcher mode for the backend you want to work on:
|
||||||
* **Core**: `tsc -w -p tsconfig.core.json`, builds `core/src`, outputs `build/spine-core.js|d.ts|js.map`
|
* **Core**: `tsc -w -p tsconfig.core.json`, builds `core/src`, outputs `build/spine-core.js|d.ts|js.map`.
|
||||||
* **WebGL**: `tsc -w -p tsconfig.webgl.json`, builds `core/src` and `webgl/src`, outputs `build/spine-webgl.js|d.ts|js.map`
|
* **WebGL**: `tsc -w -p tsconfig.webgl.json`, builds `core/src` and `webgl/src`, outputs `build/spine-webgl.js|d.ts|js.map`.
|
||||||
* **Canvas**: `tsc -w -p tsconfig.canvas.json`, builds `core/src` and `canvas/src`, outputs `build/spine-canvas.js|d.ts|js.map`
|
* **Canvas**: `tsc -w -p tsconfig.canvas.json`, builds `core/src` and `canvas/src`, outputs `build/spine-canvas.js|d.ts|js.map`.
|
||||||
* **THREE.JS**: `tsc -w -p tsconfig.threejs.json`, builds `core/src` and `threejs/src`, outputs `build/spine-threejs.js|d.ts|js.map`
|
* **THREE.JS**: `tsc -w -p tsconfig.threejs.json`, builds `core/src` and `threejs/src`, outputs `build/spine-threejs.js|d.ts|js.map`.
|
||||||
* **Player**: `tsc -w -p tsconfig.player.json`, builds `core/src` and `player/src`, outputs `build/spine-player.js|d.ts|js.map`
|
* **Player**: `tsc -w -p tsconfig.player.json`, builds `core/src` and `player/src`, outputs `build/spine-player.js|d.ts|js.map`.
|
||||||
6. Open the `spine-ts` folder in Visual Studio Code. VS Code will use the `tsconfig.json` file all source files from core and all
|
6. Open the `spine-ts` folder in Visual Studio Code. VS Code will use the `tsconfig.json` file to find all source files for your development pleasure. The actual JavaScript output is still created by the command line TypeScript compiler process from the previous step.
|
||||||
backends for your development pleasure. The actual JavaScript output is still created by the command line TypeScript compiler process from the previous step.
|
|
||||||
|
|
||||||
Each backend contains an `example/` folder with an `index.html` file that demonstrates the respective backend. For development, we
|
Each backend contains an `example/` folder with an `index.html` file that demonstrates the respective backend. For development, we suggest to run a HTTP server in the root of `spine-ts`, for example:
|
||||||
suggest to run a HTTP server in the root of `spine-ts`, e.g.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd spine-ts
|
cd spine-ts
|
||||||
python -m SimpleHTTPServer
|
python -m SimpleHTTPServer // for Python 2
|
||||||
|
python -m http.server // for Python 3
|
||||||
```
|
```
|
||||||
|
|
||||||
Then navigate to `http://localhost:8000/webgl/example`, `http://localhost:8000/canvas/example`, `http://localhost:8000/threejs/example` or `http://localhost:8000/player/example`
|
Then navigate to `http://localhost:8000/webgl/example`, `http://localhost:8000/canvas/example`, `http://localhost:8000/threejs/example`, or `http://localhost:8000/player/example`.
|
||||||
|
|
||||||
|
### WebGL backend
|
||||||
|
|
||||||
### Spine-ts WebGL backend
|
|
||||||
By default, the spine-ts WebGL backend supports two-color tinting. This requires more per vertex data to be submitted to the GPU and the fragment shader has to do a few more arithmetic operations. It has a neglible effect on performance, but you can disable two-color tinting like this:
|
By default, the spine-ts WebGL backend supports two-color tinting. This requires more per vertex data to be submitted to the GPU and the fragment shader has to do a few more arithmetic operations. It has a neglible effect on performance, but you can disable two-color tinting like this:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// If you use SceneRenderer, disable two-color tinting via the last constructor argument
|
// If you use SceneRenderer, disable two-color tinting via the last constructor argument.
|
||||||
var sceneRenderer = new spine.SceneRenderer(canvas, gl, false);
|
var sceneRenderer = new spine.SceneRenderer(canvas, gl, false);
|
||||||
|
|
||||||
// If you use SkeletonRenderer and PolygonBatcher directly,
|
// If you use SkeletonRenderer and PolygonBatcher directly, disable two-color
|
||||||
// disable two-color tinting in the respective constructor
|
// tinting in the respective constructor and use the shader returned by
|
||||||
// and use the shader returned by Shader.newColoredTextured()
|
// Shader.newColoredTextured() instead of Shader.newTwoColoredTextured().
|
||||||
// instead of Shader.newTwoColoredTextured()
|
|
||||||
var batcher = new spine.PolygonBatcher(gl, false);
|
var batcher = new spine.PolygonBatcher(gl, false);
|
||||||
var skeletonRenderer = new spine.SkeletonRenderer(gl, false);
|
var skeletonRenderer = new spine.SkeletonRenderer(gl, false);
|
||||||
var shader = Shader.newColoredTextured();
|
var shader = Shader.newColoredTextured();
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using the Player
|
### Using the Player
|
||||||
Please see the documentation for the [Spine Web Player](https://esotericsoftware.com/spine-player)
|
|
||||||
|
Please see the documentation for the [Spine Web Player](https://esotericsoftware.com/spine-player).
|
||||||
|
|||||||
@ -37,7 +37,6 @@ using UnityEditor;
|
|||||||
namespace Spine.Unity.Editor {
|
namespace Spine.Unity.Editor {
|
||||||
using Icons = SpineEditorUtilities.Icons;
|
using Icons = SpineEditorUtilities.Icons;
|
||||||
|
|
||||||
[InitializeOnLoad]
|
|
||||||
[CustomEditor(typeof(SkeletonGraphic))]
|
[CustomEditor(typeof(SkeletonGraphic))]
|
||||||
[CanEditMultipleObjects]
|
[CanEditMultipleObjects]
|
||||||
public class SkeletonGraphicInspector : UnityEditor.Editor {
|
public class SkeletonGraphicInspector : UnityEditor.Editor {
|
||||||
@ -51,7 +50,7 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
SerializedProperty material, color;
|
SerializedProperty material, color;
|
||||||
SerializedProperty skeletonDataAsset, initialSkinName;
|
SerializedProperty skeletonDataAsset, initialSkinName;
|
||||||
SerializedProperty startingAnimation, startingLoop, timeScale, freeze, unscaledTime, tintBlack;
|
SerializedProperty startingAnimation, startingLoop, timeScale, freeze, updateWhenInvisible, unscaledTime, tintBlack;
|
||||||
SerializedProperty initialFlipX, initialFlipY;
|
SerializedProperty initialFlipX, initialFlipY;
|
||||||
SerializedProperty meshGeneratorSettings;
|
SerializedProperty meshGeneratorSettings;
|
||||||
SerializedProperty allowMultipleCanvasRenderers, separatorSlotNames, enableSeparatorSlots, updateSeparatorPartLocation;
|
SerializedProperty allowMultipleCanvasRenderers, separatorSlotNames, enableSeparatorSlots, updateSeparatorPartLocation;
|
||||||
@ -111,6 +110,7 @@ namespace Spine.Unity.Editor {
|
|||||||
timeScale = so.FindProperty("timeScale");
|
timeScale = so.FindProperty("timeScale");
|
||||||
unscaledTime = so.FindProperty("unscaledTime");
|
unscaledTime = so.FindProperty("unscaledTime");
|
||||||
freeze = so.FindProperty("freeze");
|
freeze = so.FindProperty("freeze");
|
||||||
|
updateWhenInvisible = so.FindProperty("updateWhenInvisible");
|
||||||
|
|
||||||
meshGeneratorSettings = so.FindProperty("meshGenerator").FindPropertyRelative("settings");
|
meshGeneratorSettings = so.FindProperty("meshGenerator").FindPropertyRelative("settings");
|
||||||
meshGeneratorSettings.isExpanded = SkeletonRendererInspector.advancedFoldout;
|
meshGeneratorSettings.isExpanded = SkeletonRendererInspector.advancedFoldout;
|
||||||
@ -172,6 +172,7 @@ namespace Spine.Unity.Editor {
|
|||||||
meshGeneratorSettings.isExpanded = true;
|
meshGeneratorSettings.isExpanded = true;
|
||||||
|
|
||||||
using (new SpineInspectorUtility.BoxScope()) {
|
using (new SpineInspectorUtility.BoxScope()) {
|
||||||
|
|
||||||
EditorGUILayout.PropertyField(meshGeneratorSettings, SpineInspectorUtility.TempContent("Advanced..."), includeChildren: true);
|
EditorGUILayout.PropertyField(meshGeneratorSettings, SpineInspectorUtility.TempContent("Advanced..."), includeChildren: true);
|
||||||
SkeletonRendererInspector.advancedFoldout = meshGeneratorSettings.isExpanded;
|
SkeletonRendererInspector.advancedFoldout = meshGeneratorSettings.isExpanded;
|
||||||
|
|
||||||
@ -190,6 +191,8 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
EditorGUILayout.EndHorizontal();
|
EditorGUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
EditorGUILayout.PropertyField(updateWhenInvisible);
|
||||||
|
|
||||||
// warning box
|
// warning box
|
||||||
if (isSeparationEnabledButNotMultipleRenderers) {
|
if (isSeparationEnabledButNotMultipleRenderers) {
|
||||||
using (new SpineInspectorUtility.BoxScope()) {
|
using (new SpineInspectorUtility.BoxScope()) {
|
||||||
|
|||||||
@ -59,7 +59,7 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
protected SerializedProperty skeletonDataAsset, initialSkinName;
|
protected SerializedProperty skeletonDataAsset, initialSkinName;
|
||||||
protected SerializedProperty initialFlipX, initialFlipY;
|
protected SerializedProperty initialFlipX, initialFlipY;
|
||||||
protected SerializedProperty singleSubmesh, separatorSlotNames, clearStateOnDisable, immutableTriangles, fixDrawOrder;
|
protected SerializedProperty updateWhenInvisible, singleSubmesh, separatorSlotNames, clearStateOnDisable, immutableTriangles, fixDrawOrder;
|
||||||
protected SerializedProperty normals, tangents, zSpacing, pmaVertexColors, tintBlack; // MeshGenerator settings
|
protected SerializedProperty normals, tangents, zSpacing, pmaVertexColors, tintBlack; // MeshGenerator settings
|
||||||
protected SerializedProperty maskInteraction;
|
protected SerializedProperty maskInteraction;
|
||||||
protected SerializedProperty maskMaterialsNone, maskMaterialsInside, maskMaterialsOutside;
|
protected SerializedProperty maskMaterialsNone, maskMaterialsInside, maskMaterialsOutside;
|
||||||
@ -74,7 +74,7 @@ namespace Spine.Unity.Editor {
|
|||||||
protected bool deleteOutsideMaskMaterialsQueued = false;
|
protected bool deleteOutsideMaskMaterialsQueued = false;
|
||||||
|
|
||||||
protected GUIContent SkeletonDataAssetLabel, SkeletonUtilityButtonContent;
|
protected GUIContent SkeletonDataAssetLabel, SkeletonUtilityButtonContent;
|
||||||
protected GUIContent PMAVertexColorsLabel, ClearStateOnDisableLabel, ZSpacingLabel, ImmubleTrianglesLabel, TintBlackLabel, SingleSubmeshLabel, FixDrawOrderLabel;
|
protected GUIContent PMAVertexColorsLabel, ClearStateOnDisableLabel, ZSpacingLabel, ImmubleTrianglesLabel, TintBlackLabel, UpdateWhenInvisibleLabel, SingleSubmeshLabel, FixDrawOrderLabel;
|
||||||
protected GUIContent NormalsLabel, TangentsLabel, MaskInteractionLabel;
|
protected GUIContent NormalsLabel, TangentsLabel, MaskInteractionLabel;
|
||||||
protected GUIContent MaskMaterialsHeadingLabel, MaskMaterialsNoneLabel, MaskMaterialsInsideLabel, MaskMaterialsOutsideLabel;
|
protected GUIContent MaskMaterialsHeadingLabel, MaskMaterialsNoneLabel, MaskMaterialsInsideLabel, MaskMaterialsOutsideLabel;
|
||||||
protected GUIContent SetMaterialButtonLabel, ClearMaterialButtonLabel, DeleteMaterialButtonLabel;
|
protected GUIContent SetMaterialButtonLabel, ClearMaterialButtonLabel, DeleteMaterialButtonLabel;
|
||||||
@ -119,6 +119,7 @@ namespace Spine.Unity.Editor {
|
|||||||
TangentsLabel = new GUIContent("Solve Tangents", "Calculates the tangents per frame. Use this if you are using lit shaders (usually with normal maps) that require vertex tangents.");
|
TangentsLabel = new GUIContent("Solve Tangents", "Calculates the tangents per frame. Use this if you are using lit shaders (usually with normal maps) that require vertex tangents.");
|
||||||
TintBlackLabel = new GUIContent("Tint Black (!)", "Adds black tint vertex data to the mesh as UV2 and UV3. Black tinting requires that the shader interpret UV2 and UV3 as black tint colors for this effect to work. You may also use the default [Spine/Skeleton Tint Black] shader.\n\nIf you only need to tint the whole skeleton and not individual parts, the [Spine/Skeleton Tint] shader is recommended for better efficiency and changing/animating the _Black material property via MaterialPropertyBlock.");
|
TintBlackLabel = new GUIContent("Tint Black (!)", "Adds black tint vertex data to the mesh as UV2 and UV3. Black tinting requires that the shader interpret UV2 and UV3 as black tint colors for this effect to work. You may also use the default [Spine/Skeleton Tint Black] shader.\n\nIf you only need to tint the whole skeleton and not individual parts, the [Spine/Skeleton Tint] shader is recommended for better efficiency and changing/animating the _Black material property via MaterialPropertyBlock.");
|
||||||
SingleSubmeshLabel = new GUIContent("Use Single Submesh", "Simplifies submesh generation by assuming you are only using one Material and need only one submesh. This is will disable multiple materials, render separation, and custom slot materials.");
|
SingleSubmeshLabel = new GUIContent("Use Single Submesh", "Simplifies submesh generation by assuming you are only using one Material and need only one submesh. This is will disable multiple materials, render separation, and custom slot materials.");
|
||||||
|
UpdateWhenInvisibleLabel = new GUIContent("Update When Invisible", "Update mode used when the MeshRenderer becomes invisible. Update mode is automatically reset to UpdateMode.FullUpdate when the mesh becomes visible again.");
|
||||||
FixDrawOrderLabel = new GUIContent("Fix Draw Order", "Applies only when 3+ submeshes are used (2+ materials with alternating order, e.g. \"A B A\"). If true, GPU instancing will be disabled at all materials and MaterialPropertyBlocks are assigned at each material to prevent aggressive batching of submeshes by e.g. the LWRP renderer, leading to incorrect draw order (e.g. \"A1 B A2\" changed to \"A1A2 B\"). You can disable this parameter when everything is drawn correctly to save the additional performance cost. Note: the GPU instancing setting will remain disabled at affected material assets after exiting play mode, you have to enable it manually if you accidentally enabled this parameter.");
|
FixDrawOrderLabel = new GUIContent("Fix Draw Order", "Applies only when 3+ submeshes are used (2+ materials with alternating order, e.g. \"A B A\"). If true, GPU instancing will be disabled at all materials and MaterialPropertyBlocks are assigned at each material to prevent aggressive batching of submeshes by e.g. the LWRP renderer, leading to incorrect draw order (e.g. \"A1 B A2\" changed to \"A1A2 B\"). You can disable this parameter when everything is drawn correctly to save the additional performance cost. Note: the GPU instancing setting will remain disabled at affected material assets after exiting play mode, you have to enable it manually if you accidentally enabled this parameter.");
|
||||||
MaskInteractionLabel = new GUIContent("Mask Interaction", "SkeletonRenderer's interaction with a Sprite Mask.");
|
MaskInteractionLabel = new GUIContent("Mask Interaction", "SkeletonRenderer's interaction with a Sprite Mask.");
|
||||||
MaskMaterialsHeadingLabel = new GUIContent("Mask Interaction Materials", "Materials used for different interaction with sprite masks.");
|
MaskMaterialsHeadingLabel = new GUIContent("Mask Interaction Materials", "Materials used for different interaction with sprite masks.");
|
||||||
@ -140,6 +141,7 @@ namespace Spine.Unity.Editor {
|
|||||||
pmaVertexColors = so.FindProperty("pmaVertexColors");
|
pmaVertexColors = so.FindProperty("pmaVertexColors");
|
||||||
clearStateOnDisable = so.FindProperty("clearStateOnDisable");
|
clearStateOnDisable = so.FindProperty("clearStateOnDisable");
|
||||||
tintBlack = so.FindProperty("tintBlack");
|
tintBlack = so.FindProperty("tintBlack");
|
||||||
|
updateWhenInvisible = so.FindProperty("updateWhenInvisible");
|
||||||
singleSubmesh = so.FindProperty("singleSubmesh");
|
singleSubmesh = so.FindProperty("singleSubmesh");
|
||||||
fixDrawOrder = so.FindProperty("fixDrawOrder");
|
fixDrawOrder = so.FindProperty("fixDrawOrder");
|
||||||
maskInteraction = so.FindProperty("maskInteraction");
|
maskInteraction = so.FindProperty("maskInteraction");
|
||||||
@ -319,6 +321,8 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorGUILayout.LabelField("Renderer Settings", EditorStyles.boldLabel);
|
EditorGUILayout.LabelField("Renderer Settings", EditorStyles.boldLabel);
|
||||||
using (new SpineInspectorUtility.LabelWidthScope()) {
|
using (new SpineInspectorUtility.LabelWidthScope()) {
|
||||||
// Optimization options
|
// Optimization options
|
||||||
|
if (updateWhenInvisible != null) EditorGUILayout.PropertyField(updateWhenInvisible, UpdateWhenInvisibleLabel);
|
||||||
|
|
||||||
if (singleSubmesh != null) EditorGUILayout.PropertyField(singleSubmesh, SingleSubmeshLabel);
|
if (singleSubmesh != null) EditorGUILayout.PropertyField(singleSubmesh, SingleSubmeshLabel);
|
||||||
#if PER_MATERIAL_PROPERTY_BLOCKS
|
#if PER_MATERIAL_PROPERTY_BLOCKS
|
||||||
if (fixDrawOrder != null) EditorGUILayout.PropertyField(fixDrawOrder, FixDrawOrderLabel);
|
if (fixDrawOrder != null) EditorGUILayout.PropertyField(fixDrawOrder, FixDrawOrderLabel);
|
||||||
|
|||||||
@ -35,6 +35,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Spine;
|
using Spine;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Spine.Unity.Editor {
|
namespace Spine.Unity.Editor {
|
||||||
public struct SpineDrawerValuePair {
|
public struct SpineDrawerValuePair {
|
||||||
@ -177,8 +178,10 @@ namespace Spine.Unity.Editor {
|
|||||||
if (TargetAttribute.includeNone)
|
if (TargetAttribute.includeNone)
|
||||||
menu.AddItem(new GUIContent(NoneString), !property.hasMultipleDifferentValues && string.IsNullOrEmpty(property.stringValue), HandleSelect, new SpineDrawerValuePair(string.Empty, property));
|
menu.AddItem(new GUIContent(NoneString), !property.hasMultipleDifferentValues && string.IsNullOrEmpty(property.stringValue), HandleSelect, new SpineDrawerValuePair(string.Empty, property));
|
||||||
|
|
||||||
for (int slotIndex = 0; slotIndex < data.Slots.Count; slotIndex++) {
|
IEnumerable<SlotData> orderedSlots = data.Slots.Items.OrderBy(slotData => slotData.Name);
|
||||||
string name = data.Slots.Items[slotIndex].Name;
|
foreach (SlotData slotData in orderedSlots) {
|
||||||
|
int slotIndex = slotData.Index;
|
||||||
|
string name = slotData.Name;
|
||||||
if (name.StartsWith(targetAttribute.startsWith, StringComparison.Ordinal)) {
|
if (name.StartsWith(targetAttribute.startsWith, StringComparison.Ordinal)) {
|
||||||
|
|
||||||
if (targetAttribute.containsBoundingBoxes) {
|
if (targetAttribute.containsBoundingBoxes) {
|
||||||
@ -521,9 +524,17 @@ namespace Spine.Unity.Editor {
|
|||||||
menu.AddItem(new GUIContent(NoneString), !property.hasMultipleDifferentValues && string.IsNullOrEmpty(property.stringValue), HandleSelect, new SpineDrawerValuePair(string.Empty, property));
|
menu.AddItem(new GUIContent(NoneString), !property.hasMultipleDifferentValues && string.IsNullOrEmpty(property.stringValue), HandleSelect, new SpineDrawerValuePair(string.Empty, property));
|
||||||
|
|
||||||
for (int i = 0; i < data.Bones.Count; i++) {
|
for (int i = 0; i < data.Bones.Count; i++) {
|
||||||
string name = data.Bones.Items[i].Name;
|
var bone = data.Bones.Items[i];
|
||||||
if (name.StartsWith(targetAttribute.startsWith, StringComparison.Ordinal))
|
string name = bone.Name;
|
||||||
menu.AddItem(new GUIContent(name), !property.hasMultipleDifferentValues && name == property.stringValue, HandleSelect, new SpineDrawerValuePair(name, property));
|
if (name.StartsWith(targetAttribute.startsWith, StringComparison.Ordinal)) {
|
||||||
|
// jointName = "root/hip/bone" to show a hierarchial tree.
|
||||||
|
string jointName = name;
|
||||||
|
var iterator = bone;
|
||||||
|
while ((iterator = iterator.Parent) != null)
|
||||||
|
jointName = string.Format("{0}/{1}", iterator.Name, jointName);
|
||||||
|
|
||||||
|
menu.AddItem(new GUIContent(jointName), !property.hasMultipleDifferentValues && name == property.stringValue, HandleSelect, new SpineDrawerValuePair(name, property));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -256,7 +256,6 @@ namespace Spine.Unity.Editor {
|
|||||||
bool reimport = false) {
|
bool reimport = false) {
|
||||||
|
|
||||||
var atlasPaths = new List<string>();
|
var atlasPaths = new List<string>();
|
||||||
var spriteAtlasPaths = new List<string>();
|
|
||||||
var imagePaths = new List<string>();
|
var imagePaths = new List<string>();
|
||||||
var skeletonPaths = new List<PathAndProblemInfo>();
|
var skeletonPaths = new List<PathAndProblemInfo>();
|
||||||
CompatibilityProblemInfo compatibilityProblemInfo = null;
|
CompatibilityProblemInfo compatibilityProblemInfo = null;
|
||||||
@ -273,9 +272,6 @@ namespace Spine.Unity.Editor {
|
|||||||
if (str.EndsWith(".atlas.txt", System.StringComparison.Ordinal))
|
if (str.EndsWith(".atlas.txt", System.StringComparison.Ordinal))
|
||||||
atlasPaths.Add(str);
|
atlasPaths.Add(str);
|
||||||
break;
|
break;
|
||||||
case ".spriteatlas":
|
|
||||||
spriteAtlasPaths.Add(str);
|
|
||||||
break;
|
|
||||||
case ".png":
|
case ".png":
|
||||||
case ".jpg":
|
case ".jpg":
|
||||||
imagePaths.Add(str);
|
imagePaths.Add(str);
|
||||||
@ -295,13 +291,13 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Import atlases first.
|
// Import atlases first.
|
||||||
var atlases = new List<AtlasAssetBase>();
|
var newAtlases = new List<AtlasAssetBase>();
|
||||||
foreach (string ap in atlasPaths) {
|
foreach (string ap in atlasPaths) {
|
||||||
if (ap.StartsWith("Packages"))
|
if (ap.StartsWith("Packages"))
|
||||||
continue;
|
continue;
|
||||||
TextAsset atlasText = AssetDatabase.LoadAssetAtPath<TextAsset>(ap);
|
TextAsset atlasText = AssetDatabase.LoadAssetAtPath<TextAsset>(ap);
|
||||||
AtlasAssetBase atlas = IngestSpineAtlas(atlasText, texturesWithoutMetaFile);
|
AtlasAssetBase atlas = IngestSpineAtlas(atlasText, texturesWithoutMetaFile);
|
||||||
atlases.Add(atlas);
|
newAtlases.Add(atlas);
|
||||||
}
|
}
|
||||||
AddDependentSkeletonIfAtlasChanged(skeletonPaths, atlasPaths);
|
AddDependentSkeletonIfAtlasChanged(skeletonPaths, atlasPaths);
|
||||||
|
|
||||||
@ -328,13 +324,14 @@ namespace Spine.Unity.Editor {
|
|||||||
#if SPINE_TK2D
|
#if SPINE_TK2D
|
||||||
IngestSpineProject(loadedAsset, null);
|
IngestSpineProject(loadedAsset, null);
|
||||||
#else
|
#else
|
||||||
var localAtlases = FindAtlasesAtPath(dir);
|
var atlasesForSkeleton = FindAtlasesAtPath(dir);
|
||||||
|
atlasesForSkeleton.AddRange(newAtlases);
|
||||||
var requiredPaths = GetRequiredAtlasRegions(skeletonPath);
|
var requiredPaths = GetRequiredAtlasRegions(skeletonPath);
|
||||||
var atlasMatch = GetMatchingAtlas(requiredPaths, localAtlases);
|
var atlasMatch = GetMatchingAtlas(requiredPaths, atlasesForSkeleton);
|
||||||
if (atlasMatch != null || requiredPaths.Count == 0) {
|
if (atlasMatch != null || requiredPaths.Count == 0) {
|
||||||
IngestSpineProject(loadedAsset, atlasMatch);
|
IngestSpineProject(loadedAsset, atlasMatch);
|
||||||
} else {
|
} else {
|
||||||
SkeletonImportDialog(skeletonPath, localAtlases, requiredPaths, ref abortSkeletonImport);
|
SkeletonImportDialog(skeletonPath, atlasesForSkeleton, requiredPaths, ref abortSkeletonImport);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abortSkeletonImport)
|
if (abortSkeletonImport)
|
||||||
@ -580,7 +577,10 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protectFromStackGarbageCollection.Remove(atlasAsset);
|
protectFromStackGarbageCollection.Remove(atlasAsset);
|
||||||
return (AtlasAssetBase)AssetDatabase.LoadAssetAtPath(atlasPath, typeof(AtlasAssetBase));
|
// note: at Asset Pipeline V2 this LoadAssetAtPath of the just created
|
||||||
|
// asset returns null, regardless of refresh calls.
|
||||||
|
var loadedAtlas = (AtlasAssetBase)AssetDatabase.LoadAssetAtPath(atlasPath, typeof(AtlasAssetBase));
|
||||||
|
return loadedAtlas != null ? loadedAtlas : atlasAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool SpriteAtlasSettingsNeedAdjustment (UnityEngine.U2D.SpriteAtlas spriteAtlas) {
|
public static bool SpriteAtlasSettingsNeedAdjustment (UnityEngine.U2D.SpriteAtlas spriteAtlas) {
|
||||||
|
|||||||
@ -177,6 +177,9 @@ namespace Spine.Unity {
|
|||||||
void OnDisable () {
|
void OnDisable () {
|
||||||
if (clearStateOnDisable)
|
if (clearStateOnDisable)
|
||||||
ClearState();
|
ClearState();
|
||||||
|
|
||||||
|
if (skeletonRenderer != null)
|
||||||
|
skeletonRenderer.OnRebuild -= HandleRebuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearState () {
|
public void ClearState () {
|
||||||
|
|||||||
@ -100,6 +100,11 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnDestroy () {
|
||||||
|
if (skeletonRenderer != null)
|
||||||
|
skeletonRenderer.OnRebuild -= HandleRebuildRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
public void LateUpdate () {
|
public void LateUpdate () {
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (!Application.isPlaying) skeletonTransformIsParent = Transform.ReferenceEquals(skeletonTransform, transform.parent);
|
if (!Application.isPlaying) skeletonTransformIsParent = Transform.ReferenceEquals(skeletonTransform, transform.parent);
|
||||||
|
|||||||
@ -185,9 +185,23 @@ namespace Spine.Unity {
|
|||||||
if (!valid || state == null)
|
if (!valid || state == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
wasUpdatedAfterInit = true;
|
||||||
|
if (updateMode < UpdateMode.OnlyAnimationStatus)
|
||||||
|
return;
|
||||||
|
UpdateAnimationStatus(deltaTime);
|
||||||
|
|
||||||
|
if (updateMode == UpdateMode.OnlyAnimationStatus)
|
||||||
|
return;
|
||||||
|
ApplyAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void UpdateAnimationStatus (float deltaTime) {
|
||||||
deltaTime *= timeScale;
|
deltaTime *= timeScale;
|
||||||
skeleton.Update(deltaTime);
|
skeleton.Update(deltaTime);
|
||||||
state.Update(deltaTime);
|
state.Update(deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ApplyAnimation () {
|
||||||
state.Apply(skeleton);
|
state.Apply(skeleton);
|
||||||
|
|
||||||
if (_UpdateLocal != null)
|
if (_UpdateLocal != null)
|
||||||
@ -203,7 +217,6 @@ namespace Spine.Unity {
|
|||||||
if (_UpdateComplete != null) {
|
if (_UpdateComplete != null) {
|
||||||
_UpdateComplete(this);
|
_UpdateComplete(this);
|
||||||
}
|
}
|
||||||
wasUpdatedAfterInit = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LateUpdate () {
|
public override void LateUpdate () {
|
||||||
|
|||||||
@ -58,6 +58,16 @@ namespace Spine.Unity {
|
|||||||
public bool startingLoop;
|
public bool startingLoop;
|
||||||
public float timeScale = 1f;
|
public float timeScale = 1f;
|
||||||
public bool freeze;
|
public bool freeze;
|
||||||
|
|
||||||
|
/// <summary>Update mode to optionally limit updates to e.g. only apply animations but not update the mesh.</summary>
|
||||||
|
public UpdateMode UpdateMode { get { return updateMode; } set { updateMode = value; } }
|
||||||
|
[SerializeField] protected UpdateMode updateMode = UpdateMode.FullUpdate;
|
||||||
|
|
||||||
|
/// <summary>Update mode used when the MeshRenderer becomes invisible
|
||||||
|
/// (when <c>OnBecameInvisible()</c> is called). Update mode is automatically
|
||||||
|
/// reset to <c>UpdateMode.FullUpdate</c> when the mesh becomes visible again.</summary>
|
||||||
|
public UpdateMode updateWhenInvisible = UpdateMode.FullUpdate;
|
||||||
|
|
||||||
public bool unscaledTime;
|
public bool unscaledTime;
|
||||||
public bool allowMultipleCanvasRenderers = false;
|
public bool allowMultipleCanvasRenderers = false;
|
||||||
public List<CanvasRenderer> canvasRenderers = new List<CanvasRenderer>();
|
public List<CanvasRenderer> canvasRenderers = new List<CanvasRenderer>();
|
||||||
@ -232,12 +242,27 @@ namespace Spine.Unity {
|
|||||||
public virtual void Update (float deltaTime) {
|
public virtual void Update (float deltaTime) {
|
||||||
if (!this.IsValid) return;
|
if (!this.IsValid) return;
|
||||||
|
|
||||||
|
wasUpdatedAfterInit = true;
|
||||||
|
if (updateMode < UpdateMode.OnlyAnimationStatus)
|
||||||
|
return;
|
||||||
|
UpdateAnimationStatus(deltaTime);
|
||||||
|
|
||||||
|
if (updateMode == UpdateMode.OnlyAnimationStatus)
|
||||||
|
return;
|
||||||
|
ApplyAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void UpdateAnimationStatus (float deltaTime) {
|
||||||
deltaTime *= timeScale;
|
deltaTime *= timeScale;
|
||||||
skeleton.Update(deltaTime);
|
skeleton.Update(deltaTime);
|
||||||
state.Update(deltaTime);
|
state.Update(deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ApplyAnimation () {
|
||||||
state.Apply(skeleton);
|
state.Apply(skeleton);
|
||||||
|
|
||||||
if (UpdateLocal != null) UpdateLocal(this);
|
if (UpdateLocal != null)
|
||||||
|
UpdateLocal(this);
|
||||||
|
|
||||||
skeleton.UpdateWorldTransform();
|
skeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
@ -246,18 +271,27 @@ namespace Spine.Unity {
|
|||||||
skeleton.UpdateWorldTransform();
|
skeleton.UpdateWorldTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UpdateComplete != null) UpdateComplete(this);
|
if (UpdateComplete != null)
|
||||||
wasUpdatedAfterInit = true;
|
UpdateComplete(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LateUpdate () {
|
public void LateUpdate () {
|
||||||
// instantiation can happen from Update() after this component, leading to a missing Update() call.
|
// instantiation can happen from Update() after this component, leading to a missing Update() call.
|
||||||
if (!wasUpdatedAfterInit) Update(0);
|
if (!wasUpdatedAfterInit) Update(0);
|
||||||
if (freeze) return;
|
if (freeze) return;
|
||||||
//this.SetVerticesDirty(); // Which is better?
|
if (updateMode <= UpdateMode.EverythingExceptMesh) return;
|
||||||
|
|
||||||
UpdateMesh();
|
UpdateMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnBecameVisible () {
|
||||||
|
updateMode = UpdateMode.FullUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnBecameInvisible () {
|
||||||
|
updateMode = updateWhenInvisible;
|
||||||
|
}
|
||||||
|
|
||||||
public void ReapplySeparatorSlotNames () {
|
public void ReapplySeparatorSlotNames () {
|
||||||
if (!IsValid)
|
if (!IsValid)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -78,6 +78,14 @@ namespace Spine.Unity {
|
|||||||
public void Update () {
|
public void Update () {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
|
wasUpdatedAfterInit = true;
|
||||||
|
// animation status is kept by Mecanim Animator component
|
||||||
|
if (updateMode <= UpdateMode.OnlyAnimationStatus)
|
||||||
|
return;
|
||||||
|
ApplyAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ApplyAnimation () {
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
var translatorAnimator = translator.Animator;
|
var translatorAnimator = translator.Animator;
|
||||||
if (translatorAnimator != null && !translatorAnimator.isInitialized)
|
if (translatorAnimator != null && !translatorAnimator.isInitialized)
|
||||||
@ -85,7 +93,8 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
if (Application.isPlaying) {
|
if (Application.isPlaying) {
|
||||||
translator.Apply(skeleton);
|
translator.Apply(skeleton);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (translatorAnimator != null && translatorAnimator.isInitialized &&
|
if (translatorAnimator != null && translatorAnimator.isInitialized &&
|
||||||
translatorAnimator.isActiveAndEnabled && translatorAnimator.runtimeAnimatorController != null) {
|
translatorAnimator.isActiveAndEnabled && translatorAnimator.runtimeAnimatorController != null) {
|
||||||
// Note: Rebind is required to prevent warning "Animator is not playing an AnimatorController" with prefabs
|
// Note: Rebind is required to prevent warning "Animator is not playing an AnimatorController" with prefabs
|
||||||
@ -112,7 +121,6 @@ namespace Spine.Unity {
|
|||||||
if (_UpdateComplete != null)
|
if (_UpdateComplete != null)
|
||||||
_UpdateComplete(this);
|
_UpdateComplete(this);
|
||||||
}
|
}
|
||||||
wasUpdatedAfterInit = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LateUpdate () {
|
public override void LateUpdate () {
|
||||||
|
|||||||
@ -55,11 +55,11 @@ namespace Spine.Unity {
|
|||||||
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
||||||
[HelpURL("http://esotericsoftware.com/spine-unity-rendering")]
|
[HelpURL("http://esotericsoftware.com/spine-unity-rendering")]
|
||||||
public class SkeletonRenderer : MonoBehaviour, ISkeletonComponent, IHasSkeletonDataAsset {
|
public class SkeletonRenderer : MonoBehaviour, ISkeletonComponent, IHasSkeletonDataAsset {
|
||||||
[SerializeField] public SkeletonDataAsset skeletonDataAsset;
|
public SkeletonDataAsset skeletonDataAsset;
|
||||||
|
|
||||||
#region Initialization settings
|
#region Initialization settings
|
||||||
/// <summary>Skin name to use when the Skeleton is initialized.</summary>
|
/// <summary>Skin name to use when the Skeleton is initialized.</summary>
|
||||||
[SerializeField] [SpineSkin(defaultAsEmptyString:true)] public string initialSkinName;
|
[SpineSkin(defaultAsEmptyString:true)] public string initialSkinName;
|
||||||
|
|
||||||
/// <summary>Enable this parameter when overwriting the Skeleton's skin from an editor script.
|
/// <summary>Enable this parameter when overwriting the Skeleton's skin from an editor script.
|
||||||
/// Otherwise any changes will be overwritten by the next inspector update.</summary>
|
/// Otherwise any changes will be overwritten by the next inspector update.</summary>
|
||||||
@ -71,10 +71,20 @@ namespace Spine.Unity {
|
|||||||
protected bool editorSkipSkinSync = false;
|
protected bool editorSkipSkinSync = false;
|
||||||
#endif
|
#endif
|
||||||
/// <summary>Flip X and Y to use when the Skeleton is initialized.</summary>
|
/// <summary>Flip X and Y to use when the Skeleton is initialized.</summary>
|
||||||
[SerializeField] public bool initialFlipX, initialFlipY;
|
public bool initialFlipX, initialFlipY;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Advanced Render Settings
|
#region Advanced Render Settings
|
||||||
|
|
||||||
|
/// <summary>Update mode to optionally limit updates to e.g. only apply animations but not update the mesh.</summary>
|
||||||
|
public UpdateMode UpdateMode { get { return updateMode; } set { updateMode = value; } }
|
||||||
|
[SerializeField] protected UpdateMode updateMode = UpdateMode.FullUpdate;
|
||||||
|
|
||||||
|
/// <summary>Update mode used when the MeshRenderer becomes invisible
|
||||||
|
/// (when <c>OnBecameInvisible()</c> is called). Update mode is automatically
|
||||||
|
/// reset to <c>UpdateMode.FullUpdate</c> when the mesh becomes visible again.</summary>
|
||||||
|
public UpdateMode updateWhenInvisible = UpdateMode.FullUpdate;
|
||||||
|
|
||||||
// Submesh Separation
|
// Submesh Separation
|
||||||
/// <summary>Slot names used to populate separatorSlots list when the Skeleton is initialized. Changing this after initialization does nothing.</summary>
|
/// <summary>Slot names used to populate separatorSlots list when the Skeleton is initialized. Changing this after initialization does nothing.</summary>
|
||||||
[UnityEngine.Serialization.FormerlySerializedAs("submeshSeparators")][SerializeField][SpineSlot] protected string[] separatorSlotNames = new string[0];
|
[UnityEngine.Serialization.FormerlySerializedAs("submeshSeparators")][SerializeField][SpineSlot] protected string[] separatorSlotNames = new string[0];
|
||||||
@ -361,6 +371,8 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (updateMode <= UpdateMode.EverythingExceptMesh) return;
|
||||||
|
|
||||||
#if SPINE_OPTIONAL_RENDEROVERRIDE
|
#if SPINE_OPTIONAL_RENDEROVERRIDE
|
||||||
bool doMeshOverride = generateMeshOverride != null;
|
bool doMeshOverride = generateMeshOverride != null;
|
||||||
if ((!meshRenderer.enabled) && !doMeshOverride) return;
|
if ((!meshRenderer.enabled) && !doMeshOverride) return;
|
||||||
@ -477,6 +489,14 @@ namespace Spine.Unity {
|
|||||||
OnMeshAndMaterialsUpdated(this);
|
OnMeshAndMaterialsUpdated(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnBecameVisible () {
|
||||||
|
updateMode = UpdateMode.FullUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnBecameInvisible () {
|
||||||
|
updateMode = updateWhenInvisible;
|
||||||
|
}
|
||||||
|
|
||||||
public void FindAndApplySeparatorSlots (string startsWith, bool clearExistingSeparators = true, bool updateStringArray = false) {
|
public void FindAndApplySeparatorSlots (string startsWith, bool clearExistingSeparators = true, bool updateStringArray = false) {
|
||||||
if (string.IsNullOrEmpty(startsWith)) return;
|
if (string.IsNullOrEmpty(startsWith)) return;
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,13 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
|
public enum UpdateMode {
|
||||||
|
Nothing = 0,
|
||||||
|
OnlyAnimationStatus,
|
||||||
|
EverythingExceptMesh,
|
||||||
|
FullUpdate
|
||||||
|
};
|
||||||
|
|
||||||
public delegate void UpdateBonesDelegate (ISkeletonAnimation animated);
|
public delegate void UpdateBonesDelegate (ISkeletonAnimation animated);
|
||||||
|
|
||||||
/// <summary>A Spine-Unity Component that animates a Skeleton but not necessarily with a Spine.AnimationState.</summary>
|
/// <summary>A Spine-Unity Component that animates a Skeleton but not necessarily with a Spine.AnimationState.</summary>
|
||||||
|
|||||||
@ -83,7 +83,13 @@ VertexOutput vert (appdata v) {
|
|||||||
float3 eyePos = UnityObjectToViewPos(float4(v.pos, 1)).xyz; //mul(UNITY_MATRIX_MV, float4(v.pos,1)).xyz;
|
float3 eyePos = UnityObjectToViewPos(float4(v.pos, 1)).xyz; //mul(UNITY_MATRIX_MV, float4(v.pos,1)).xyz;
|
||||||
half3 fixedNormal = half3(0,0,-1);
|
half3 fixedNormal = half3(0,0,-1);
|
||||||
half3 eyeNormal = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, fixedNormal));
|
half3 eyeNormal = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, fixedNormal));
|
||||||
//half3 eyeNormal = half3(0,0,1);
|
|
||||||
|
#ifdef _DOUBLE_SIDED_LIGHTING
|
||||||
|
// unfortunately we have to compute the sign here in the vertex shader
|
||||||
|
// instead of using VFACE in fragment shader stage.
|
||||||
|
half faceSign = sign(eyeNormal.z);
|
||||||
|
eyeNormal *= faceSign;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Lights
|
// Lights
|
||||||
half3 lcolor = half4(0,0,0,1).rgb + color.rgb * glstate_lightmodel_ambient.rgb;
|
half3 lcolor = half4(0,0,0,1).rgb + color.rgb * glstate_lightmodel_ambient.rgb;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ Shader "Spine/Outline/Skeleton Lit" {
|
|||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
|
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ Shader "Spine/Outline/Skeleton Lit ZWrite" {
|
|||||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
|
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ Shader "Spine/Skeleton Lit ZWrite" {
|
|||||||
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
|
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||||
|
|
||||||
@ -42,6 +43,7 @@ Shader "Spine/Skeleton Lit ZWrite" {
|
|||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||||
|
#pragma shader_feature _ _DOUBLE_SIDED_LIGHTING
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
#pragma fragment frag
|
#pragma fragment frag
|
||||||
#pragma target 2.0
|
#pragma target 2.0
|
||||||
|
|||||||
@ -7,6 +7,7 @@ Shader "Spine/Skeleton Lit" {
|
|||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
|
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||||
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ Shader "Spine/Skeleton Lit" {
|
|||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||||
|
#pragma shader_feature _ _DOUBLE_SIDED_LIGHTING
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
#pragma fragment frag
|
#pragma fragment frag
|
||||||
#pragma target 2.0
|
#pragma target 2.0
|
||||||
|
|||||||
@ -53,15 +53,23 @@ namespace Spine.Unity {
|
|||||||
"Warning: Z Spacing recommended on selected shader configuration!\n\nPlease\n"
|
"Warning: Z Spacing recommended on selected shader configuration!\n\nPlease\n"
|
||||||
+ "1) make sure at least minimal 'Z Spacing' is set at the SkeletonRenderer/SkeletonAnimation component under 'Advanced' and\n"
|
+ "1) make sure at least minimal 'Z Spacing' is set at the SkeletonRenderer/SkeletonAnimation component under 'Advanced' and\n"
|
||||||
+ "2) ensure that the skeleton has overlapping parts on different Z depth. You can adjust this in Spine via draw order.\n";
|
+ "2) ensure that the skeleton has overlapping parts on different Z depth. You can adjust this in Spine via draw order.\n";
|
||||||
|
public static readonly string kAddNormalsRequiredMessage =
|
||||||
|
"Warning: 'Add Normals' required on URP shader to receive shadows!\n\nPlease\n"
|
||||||
|
+ "a) enable 'Add Normals' at the SkeletonRenderer/SkeletonAnimation component under 'Advanced' or\n"
|
||||||
|
+ "b) disable 'Receive Shadows' at the Material.";
|
||||||
|
|
||||||
public static bool IsMaterialSetupProblematic (SkeletonRenderer renderer, ref string errorMessage) {
|
public static bool IsMaterialSetupProblematic (SkeletonRenderer renderer, ref string errorMessage) {
|
||||||
var materials = renderer.GetComponent<Renderer>().sharedMaterials;
|
var materials = renderer.GetComponent<Renderer>().sharedMaterials;
|
||||||
bool isProblematic = false;
|
bool isProblematic = false;
|
||||||
foreach (var mat in materials) {
|
foreach (var material in materials) {
|
||||||
if (mat == null) continue;
|
if (material == null) continue;
|
||||||
isProblematic |= IsMaterialSetupProblematic(mat, ref errorMessage);
|
isProblematic |= IsMaterialSetupProblematic(material, ref errorMessage);
|
||||||
if (renderer.zSpacing == 0) {
|
if (renderer.zSpacing == 0) {
|
||||||
isProblematic |= IsZSpacingRequired(mat, ref errorMessage);
|
isProblematic |= IsZSpacingRequired(material, ref errorMessage);
|
||||||
|
}
|
||||||
|
if (IsURPMaterial(material) && !AreShadowsDisabled(material) && renderer.addNormals == false) {
|
||||||
|
isProblematic = true;
|
||||||
|
errorMessage += kAddNormalsRequiredMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isProblematic;
|
return isProblematic;
|
||||||
@ -104,6 +112,7 @@ namespace Spine.Unity {
|
|||||||
bool sRGBTexture, bool mipmapEnabled, bool alphaIsTransparency,
|
bool sRGBTexture, bool mipmapEnabled, bool alphaIsTransparency,
|
||||||
string texturePath, string materialPath,
|
string texturePath, string materialPath,
|
||||||
ref string errorMessage) {
|
ref string errorMessage) {
|
||||||
|
|
||||||
if (material == null || !UsesSpineShader(material)) {
|
if (material == null || !UsesSpineShader(material)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -113,19 +122,34 @@ namespace Spine.Unity {
|
|||||||
// 'sRGBTexture = true' generates incorrectly weighted mipmaps at PMA textures,
|
// 'sRGBTexture = true' generates incorrectly weighted mipmaps at PMA textures,
|
||||||
// causing white borders due to undesired custom weighting.
|
// causing white borders due to undesired custom weighting.
|
||||||
if (sRGBTexture && mipmapEnabled && colorSpace == ColorSpace.Gamma) {
|
if (sRGBTexture && mipmapEnabled && colorSpace == ColorSpace.Gamma) {
|
||||||
errorMessage += string.Format("`{0}` : Problematic Texture Settings found: When enabling `Generate Mip Maps` in Gamma color space, it is recommended to disable `sRGB (Color Texture)` on `Premultiply alpha` textures. Otherwise you will receive white border artifacts on an atlas exported with default `Premultiply alpha` settings.\n(You can disable this warning in `Edit - Preferences - Spine`)\n", texturePath);
|
errorMessage += string.Format("`{0}` : Problematic Texture Settings found: " +
|
||||||
|
"When enabling `Generate Mip Maps` in Gamma color space, it is recommended " +
|
||||||
|
"to disable `sRGB (Color Texture)` on `Premultiply alpha` textures. Otherwise " +
|
||||||
|
"you will receive white border artifacts on an atlas exported with default " +
|
||||||
|
"`Premultiply alpha` settings.\n" +
|
||||||
|
"(You can disable this warning in `Edit - Preferences - Spine`)\n", texturePath);
|
||||||
isProblematic = true;
|
isProblematic = true;
|
||||||
}
|
}
|
||||||
if (alphaIsTransparency) {
|
if (alphaIsTransparency) {
|
||||||
string materialName = System.IO.Path.GetFileName(materialPath);
|
string materialName = System.IO.Path.GetFileName(materialPath);
|
||||||
errorMessage += string.Format("`{0}` and material `{1}` : Problematic Texture / Material Settings found: It is recommended to disable `Alpha Is Transparency` on `Premultiply alpha` textures.\nAssuming `Premultiply alpha` texture because `Straight Alpha Texture` is disabled at material). (You can disable this warning in `Edit - Preferences - Spine`)\n", texturePath, materialName);
|
errorMessage += string.Format("`{0}` and material `{1}` : Problematic " +
|
||||||
|
"Texture / Material Settings found: It is recommended to disable " +
|
||||||
|
"`Alpha Is Transparency` on `Premultiply alpha` textures.\n" +
|
||||||
|
"Assuming `Premultiply alpha` texture because `Straight Alpha Texture` " +
|
||||||
|
"is disabled at material). " +
|
||||||
|
"(You can disable this warning in `Edit - Preferences - Spine`)\n", texturePath, materialName);
|
||||||
isProblematic = true;
|
isProblematic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // straight alpha texture
|
else { // straight alpha texture
|
||||||
if (!alphaIsTransparency) {
|
if (!alphaIsTransparency) {
|
||||||
string materialName = System.IO.Path.GetFileName(materialPath);
|
string materialName = System.IO.Path.GetFileName(materialPath);
|
||||||
errorMessage += string.Format("`{0}` and material `{1}` : Incorrect Texture / Material Settings found: It is strongly recommended to enable `Alpha Is Transparency` on `Straight alpha` textures.\nAssuming `Straight alpha` texture because `Straight Alpha Texture` is enabled at material). (You can disable this warning in `Edit - Preferences - Spine`)\n", texturePath, materialName);
|
errorMessage += string.Format("`{0}` and material `{1}` : Incorrect" +
|
||||||
|
"Texture / Material Settings found: It is strongly recommended " +
|
||||||
|
"to enable `Alpha Is Transparency` on `Straight alpha` textures.\n" +
|
||||||
|
"Assuming `Straight alpha` texture because `Straight Alpha Texture` " +
|
||||||
|
"is enabled at material). " +
|
||||||
|
"(You can disable this warning in `Edit - Preferences - Spine`)\n", texturePath, materialName);
|
||||||
isProblematic = true;
|
isProblematic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,6 +176,14 @@ namespace Spine.Unity {
|
|||||||
return (material.HasProperty(STRAIGHT_ALPHA_PARAM_ID) && material.GetInt(STRAIGHT_ALPHA_PARAM_ID) == 0) ||
|
return (material.HasProperty(STRAIGHT_ALPHA_PARAM_ID) && material.GetInt(STRAIGHT_ALPHA_PARAM_ID) == 0) ||
|
||||||
material.IsKeywordEnabled(ALPHAPREMULTIPLY_ON_KEYWORD);
|
material.IsKeywordEnabled(ALPHAPREMULTIPLY_ON_KEYWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsURPMaterial (Material material) {
|
||||||
|
return material.shader.name.Contains("Universal Render Pipeline");
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool AreShadowsDisabled (Material material) {
|
||||||
|
return material.IsKeywordEnabled("_RECEIVE_SHADOWS_OFF");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,15 @@ VertexOutput vert(appdata v) {
|
|||||||
float3 positionWS = TransformObjectToWorld(v.pos);
|
float3 positionWS = TransformObjectToWorld(v.pos);
|
||||||
half3 fixedNormal = half3(0, 0, -1);
|
half3 fixedNormal = half3(0, 0, -1);
|
||||||
half3 normalWS = normalize(mul((float3x3)unity_ObjectToWorld, fixedNormal));
|
half3 normalWS = normalize(mul((float3x3)unity_ObjectToWorld, fixedNormal));
|
||||||
|
|
||||||
|
#ifdef _DOUBLE_SIDED_LIGHTING
|
||||||
|
// unfortunately we have to compute the sign here in the vertex shader
|
||||||
|
// instead of using VFACE in fragment shader stage.
|
||||||
|
half3 viewDirWS = UNITY_MATRIX_V[2].xyz;
|
||||||
|
half faceSign = sign(dot(viewDirWS, normalWS));
|
||||||
|
normalWS *= faceSign;
|
||||||
|
#endif
|
||||||
|
|
||||||
color.rgb = LightweightLightVertexSimplified(positionWS, normalWS);
|
color.rgb = LightweightLightVertexSimplified(positionWS, normalWS);
|
||||||
|
|
||||||
// Note: ambient light is also handled via SH.
|
// Note: ambient light is also handled via SH.
|
||||||
|
|||||||
@ -105,7 +105,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
|||||||
finalColor += inputData.vertexLighting * brdfData.diffuse;
|
finalColor += inputData.vertexLighting * brdfData.diffuse;
|
||||||
#endif
|
#endif
|
||||||
finalColor += emission;
|
finalColor += emission;
|
||||||
return prepareLitPixelForOutput(half4(finalColor, texAlbedoAlpha.a), vertexColor);
|
return prepareLitPixelForOutput(half4(finalColor, albedo.a), vertexColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // !SPECULAR
|
#else // !SPECULAR
|
||||||
@ -148,7 +148,7 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
|||||||
diffuseLighting += emission;
|
diffuseLighting += emission;
|
||||||
//half3 finalColor = diffuseLighting * diffuse + emission;
|
//half3 finalColor = diffuseLighting * diffuse + emission;
|
||||||
half3 finalColor = diffuseLighting * diffuse.rgb;
|
half3 finalColor = diffuseLighting * diffuse.rgb;
|
||||||
return prepareLitPixelForOutput(half4(finalColor, texDiffuseAlpha.a), vertexColor);
|
return prepareLitPixelForOutput(half4(finalColor, diffuse.a), vertexColor);
|
||||||
}
|
}
|
||||||
#endif // SPECULAR
|
#endif // SPECULAR
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton Lit" {
|
|||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
|
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||||
}
|
}
|
||||||
@ -60,6 +61,7 @@ Shader "Lightweight Render Pipeline/Spine/Skeleton Lit" {
|
|||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
// Spine related keywords
|
// Spine related keywords
|
||||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||||
|
#pragma shader_feature _ _DOUBLE_SIDED_LIGHTING
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
#pragma fragment frag
|
#pragma fragment frag
|
||||||
#pragma target 2.0
|
#pragma target 2.0
|
||||||
|
|||||||
@ -4,19 +4,36 @@ The latest version of this documentation can also be found at the [spine-unity R
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
Timeline support is provided as a separate UPM (Unity Package Manager) package. See section [Optional - Installing Extension UPM Packages](http://esotericsoftware.com/spine-unity#Optional---Installing-Extension-UPM-Packages) on how to download and install this package and section [Updating an Extension UPM Package](http://esotericsoftware.com/spine-unity#Updating-an-Extension-UPM-Package) on how to update it.
|
Timeline support is provided as a separate UPM (Unity Package Manager) package. See section [Optional Extension UPM Packages](http://esotericsoftware.com/spine-unity#Optional-Extension-UPM-Packages) on how to download and install this package and section [Updating an Extension UPM Package](http://esotericsoftware.com/spine-unity#Updating-an-Extension-UPM-Package) on how to update it.
|
||||||
|
|
||||||
## Spine-Unity Timeline Playables
|
## Spine-Unity Timeline Playables
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Spine Timeline currently provides two types of Timeline Playables: `Spine AnimationState Track` and `Spine Skeleton Flip Track`, described below.
|
Spine Timeline currently provides three types of Timeline Playables:
|
||||||
|
- `Spine AnimationState Track` *(for `SkeletonAnimation`)*,
|
||||||
|
- `Spine AnimationState Graphic Track` *(for `SkeletonGraphic`)*,
|
||||||
|
- `Spine Skeleton Flip Track` *(for both `SkeletonAnimation` and `SkeletonGraphic`)*.
|
||||||
|
|
||||||
**Limitations:** currently only [SkeletonAnimation](http://esotericsoftware.com/spine-unity#SkeletonAnimation-Component) is supported. You can find an implementation for [SkeletonGraphic](http://esotericsoftware.com/spine-unity#SkeletonGraphic-Component) kindly provided by a forum user on [this forum thread](http://zh.esotericsoftware.com/forum/Spine-timeline-plugin-for-2019-1-12000).
|
**Limitations:** currently only [SkeletonAnimation](http://esotericsoftware.com/spine-unity#SkeletonAnimation-Component) and [SkeletonGraphic](http://esotericsoftware.com/spine-unity#SkeletonGraphic-Component) are supported. There is currently no Timeline support for [SkeletonMecanim](http://esotericsoftware.com/spine-unity#SkeletonMecanim-Component).
|
||||||
|
|
||||||
### Spine AnimationState Track
|
### Spine AnimationState Track
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
This track type can be used to set animations at the AnimationState of the target `SkeletonAnimation` or `SkeletonGraphic`. Track type `Spine AnimationState Track` is used for `SkeletonAnimation`, `Spine AnimationState Graphic Track` for `SkeletonGraphic`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**Parameters**
|
||||||
|
- *Track Index.* The target AnimationState track index to set animations at. Do not forget to set this value accordingly when using multiple timeline tracks.
|
||||||
|
> **Important Note:** Currently it is required to order the timeline tracks with base track at the top and overlay tracks below, otherwise the Editor Preview will display incorrect results.
|
||||||
|
|
||||||
|
#### Spine Animation State Clip
|
||||||
|
|
||||||
|
You can add a `Spine Animation State Clip` to a `Spine AnimationState Track` (or `Spine AnimationState Graphic Track`) by dragging an `AnimationReferenceAsset` onto a Timeline track. See the [SkeletonData - Preview](http://esotericsoftware.com/spine-unity#Preview) section on how to generate `AnimationReferenceAssets` for a `SkeletonDataAsset`.
|
||||||
|
|
||||||

|

|
||||||
This track type can be used to set animations on the target SkeletonAnimation's AnimationState.
|
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
- *Clip In.* An initial local start time offset applied when playing this animation. Can also be adjusted by dragging the left edge of the clip.
|
- *Clip In.* An initial local start time offset applied when playing this animation. Can also be adjusted by dragging the left edge of the clip.
|
||||||
@ -33,34 +50,42 @@ This track type can be used to set animations on the target SkeletonAnimation's
|
|||||||
- *Ease Out Duration, Blend Curves*. These parameters are ignored and have no effect.
|
- *Ease Out Duration, Blend Curves*. These parameters are ignored and have no effect.
|
||||||
|
|
||||||
**Usage**
|
**Usage**
|
||||||
1. Add `SkeletonAnimationPlayableHandle` component to your SkeletonAnimation GameObject.
|
1. Add `SkeletonAnimationPlayableHandle` component to your SkeletonAnimation GameObject, or the `SkeletonGraphicPlayableHandle` in case of `SkeletonGraphic`.
|
||||||
2. With an existing Unity Playable Director, and in the Unity Timeline window, right-click on an empty space on the left and choose `Spine.Unity.Playables` - `Spine Animation State Track`.
|
2. With an existing Unity Playable Director, and in the Unity Timeline window, right-click on an empty space on the left and choose `Spine.Unity.Playables` - `Spine Animation State Track`.
|
||||||
3. Drag the SkeletonAnimation GameObject onto the empty reference property of the new Spine AnimationState Track.
|
3. Drag the SkeletonAnimation or SkeletonGraphic GameObject onto the empty reference property of the new Spine AnimationState Track.
|
||||||
4. Right-click on the row in an empty space in the Timeline dopesheet and choose `Add Spine Animation State Clip Clip`.
|
4. To add an animation at a track, drag the respective [`AnimationReferenceAsset`](http://esotericsoftware.com/spine-unity#Preview) into the clips view (the right part of the Timeline panel) as you would with normal animation clips.
|
||||||
5. Adjust the start and end times of the new clip, name it appropriately at the top of the Inspector.
|
|
||||||
6. Click on the clip inspector's SkeletonDataAsset field and choose your target skeleton's SkeletonDataAsset. This will enable the animation name dropdown to appear.
|
|
||||||
7. Choose the appropriate animation name, loop, and mix settings.
|
|
||||||
8. For easier readability, rename your clip to the animation name or something descriptive.
|
|
||||||
|
|
||||||
> **Note:** To avoid having to do steps 4-6 repeatedly, use the Duplicate function (`CTRL`/`CMD` + `D`)
|
See spine-unity Runtime Documentation, [section Preview](http://esotericsoftware.com/spine-unity#Preview) on how to create an `AnimationReferenceAsset` for each of your animations.
|
||||||
|
|
||||||
|
> **Note:** You can use the Duplicate function (`CTRL`/`CMD` + `D`) to duplicate selected clips in the clips view.
|
||||||
|
|
||||||
**Track Behavior**
|
**Track Behavior**
|
||||||
- `AnimationState.SetAnimation` will be called at the beginning of every clip based on the animationName.
|
- `AnimationState.SetAnimation` will be called at the beginning of every clip based on the `AnimationReferenceAsset`.
|
||||||
- Clip durations don't matter. Animations won't be cleared where there is no active clip at certain slices of time.
|
- Clip durations don't matter. Animations won't be cleared where there is no active clip at certain slices of time.
|
||||||
- Empty animation: If a clip has no name specified, it will call SetEmptyAnimation instead.
|
- Empty animation: If a clip has no `AnimationReferenceAsset` assigned, it will call `SetEmptyAnimation` instead.
|
||||||
- Error handling: If the animation with the provided animationName is not found, it will do nothing (the previous animation will continue playing normally).
|
- Error handling: If the animation with the provided `AnimationReferenceAsset` is not found, it will do nothing (the previous animation will continue playing normally).
|
||||||
- Animations playing before the timeline starts playing will not be interrupted until the first clip starts playing.
|
- Animations playing before the timeline starts playing will not be interrupted until the first clip starts playing.
|
||||||
- At the end of the last clip and at the end of the timeline, nothing happens. This means the effect of the last clip's SetAnimation call will persist until you give other commands to that AnimationState.
|
- At the end of the last clip and at the end of the timeline, nothing happens. This means the effect of the last clip's `SetAnimation` call will persist until you issue other calls at the AnimationState.
|
||||||
- Edit mode preview mixing may look different from Play Mode mixing. Please check in actual Play Mode to see the real results.
|
- Edit mode preview mixing may look different from Play Mode mixing. Please check in actual Play Mode to see the actual results. Please see the remark in the [Spine AnimationState Track](#Spine-AnimationState-Track) section on correct track ordering when previewing multiple overlaid tracks.
|
||||||
|
|
||||||
### Spine Skeleton Flip Track
|
### Spine Skeleton Flip Track
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
This track type can be used to flip the skeleton of the target `SkeletonAnimation` or `SkeletonGraphic`.
|
||||||
|
|
||||||
|
#### Spine Skeleton Flip Clip
|
||||||
|
|
||||||

|

|
||||||
This track type can be used to flip the skeleton of the target SkeletonAnimation.
|
|
||||||
|
**Parameters**
|
||||||
|
- *Flip X.* Flips the skeleton along the X axis during the extents of the clip.
|
||||||
|
- *Flip Y.* Flips the skeleton along the Y axis during the extents of the clip.
|
||||||
|
|
||||||
**Usage**
|
**Usage**
|
||||||
1. Add `SkeletonAnimationPlayableHandle` component to your SkeletonAnimation GameObject.
|
1. Add `SkeletonAnimationPlayableHandle` component to your SkeletonAnimation GameObject, or the `SkeletonGraphicPlayableHandle` in case of `SkeletonGraphic`.
|
||||||
2. With an existing Unity Playable Director, and in the Unity Timeline window, right-click on an empty space on the left and choose `Spine.Unity.Playables` - `Spine Skeleton Flip Track`.
|
2. With an existing Unity Playable Director, and in the Unity Timeline window, right-click on an empty space on the left and choose `Spine.Unity.Playables` - `Spine Skeleton Flip Track`.
|
||||||
3. Drag the SkeletonAnimation GameObject onto the empty reference property of the new Spine Skeleton Flip Track.
|
3. Drag the SkeletonAnimation or SkeletonGraphic GameObject onto the empty reference property of the new Spine Skeleton Flip Track.
|
||||||
4. Right-click on the row in an empty space in the Timeline dopesheet and choose `Add Spine Skeleton Flip Clip Clip`.
|
4. Right-click on the row in an empty space in the Timeline dopesheet and choose `Add Spine Skeleton Flip Clip Clip`.
|
||||||
5. Adjust the start and end times of the new clip, name it appropriately at the top of the Inspector, and choose the desired FlipX and FlipY values.
|
5. Adjust the start and end times of the new clip, name it appropriately at the top of the Inspector, and choose the desired FlipX and FlipY values.
|
||||||
|
|
||||||
@ -69,7 +94,7 @@ This track type can be used to flip the skeleton of the target SkeletonAnimation
|
|||||||
- At the end of the timeline, the track will revert the skeleton flip to the flip values it captures when it starts playing that timeline.
|
- At the end of the timeline, the track will revert the skeleton flip to the flip values it captures when it starts playing that timeline.
|
||||||
|
|
||||||
### Known Issues
|
### Known Issues
|
||||||
- The Console potentially logs an incorrect/harmless error `DrivenPropertyManager has failed to register property "m_Script" of object "Spine GameObject (spineboy-pro)" with driver "" because the property doesn't exist.`. This is a known issue on Unity's end. See more here: https://forum.unity.com/threads/default-playables-text-switcher-track-error.502903/
|
- The Console potentially logs an incorrect and harmless error `DrivenPropertyManager has failed to register property "m_Script" of object "Spine GameObject (spineboy-pro)" with driver "" because the property doesn't exist.`. This is a known issue on Unity's end. See more here: https://forum.unity.com/threads/default-playables-text-switcher-track-error.502903/
|
||||||
- These Spine Tracks (like other custom Unity Timeline Playable types) do not have labels on them. Unity currently doesn't have API to specify their labels yet.
|
- These Spine Tracks (like other custom Unity Timeline Playable types) do not have labels on them. Unity currently doesn't have API to specify their labels yet.
|
||||||
- Each track clip currently requires you to specify a reference to SkeletonData so its inspector can show you a convenient list of animation names. This is because track clips are agnostic of its track and target component/track binding, and provides no way of automatically finding it while in the editor. The clips will still function correctly without the SkeletonDataAsset references; you just won't get the dropdown of animation names in the editor.
|
- Each track clip currently requires you to specify a reference to SkeletonData so its inspector can show you a convenient list of animation names. This is because track clips are agnostic of its track and target component/track binding, and provides no way of automatically finding it while in the editor. The clips will still function correctly without the SkeletonDataAsset references; you just won't get the dropdown of animation names in the editor.
|
||||||
- Each track clip cannot be automatically named based on the chosen animationName. The Timeline object editors currently doesn't provide access to the clip names to do this automatically.
|
- Each track clip cannot be automatically named based on the chosen animationName. The Timeline object editors currently doesn't provide access to the clip names to do this automatically.
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
@ -0,0 +1,94 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 04051f71b9b3db740a8d236ff80672e7
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,74 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d698a92ba07201b4eb9f99a6275f2b3b
|
||||||
|
timeCreated: 1595514078
|
||||||
|
licenseType: Pro
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: -1
|
||||||
|
wrapV: -1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,74 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e56f159fca97b5d4ab93f104e1cce135
|
||||||
|
timeCreated: 1595514078
|
||||||
|
licenseType: Pro
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: -1
|
||||||
|
wrapV: -1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 26 KiB |
@ -0,0 +1,74 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 73e3829cc431d4f438368d3b284c3d03
|
||||||
|
timeCreated: 1570476238
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: -1
|
||||||
|
wrapV: -1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -38,7 +38,7 @@ using Spine.Unity.Editor;
|
|||||||
public class SpineAnimationStateDrawer : PropertyDrawer {
|
public class SpineAnimationStateDrawer : PropertyDrawer {
|
||||||
|
|
||||||
public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
|
public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
|
||||||
const int fieldCount = 8;
|
const int fieldCount = 10;
|
||||||
return fieldCount * EditorGUIUtility.singleLineHeight;
|
return fieldCount * EditorGUIUtility.singleLineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,52 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes License Agreement
|
||||||
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
|
*
|
||||||
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
|
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||||
|
* http://esotericsoftware.com/spine-editor-license
|
||||||
|
*
|
||||||
|
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||||
|
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||||
|
* "Products"), provided that each user of the Products must obtain their own
|
||||||
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
|
* include this license and copyright notice.
|
||||||
|
*
|
||||||
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
using Spine.Unity.Playables;
|
||||||
|
using UnityEngine.Timeline;
|
||||||
|
|
||||||
|
namespace Spine.Unity.Editor {
|
||||||
|
|
||||||
|
[CustomEditor(typeof(SpineAnimationStateGraphicTrack))]
|
||||||
|
[CanEditMultipleObjects]
|
||||||
|
public class SpineAnimationStateGraphicTrackInspector : UnityEditor.Editor {
|
||||||
|
|
||||||
|
protected SerializedProperty trackIndexProperty = null;
|
||||||
|
|
||||||
|
public void OnEnable () {
|
||||||
|
trackIndexProperty = serializedObject.FindProperty("trackIndex");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnInspectorGUI () {
|
||||||
|
serializedObject.Update();
|
||||||
|
EditorGUILayout.PropertyField(trackIndexProperty);
|
||||||
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1bd1fca227e65ae4fb9a54086eb5cfce
|
||||||
|
timeCreated: 1595441224
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -35,7 +35,7 @@ using UnityEngine.Playables;
|
|||||||
public class SpineSkeletonFlipDrawer : PropertyDrawer
|
public class SpineSkeletonFlipDrawer : PropertyDrawer
|
||||||
{
|
{
|
||||||
public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
|
public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
|
||||||
int fieldCount = 1;
|
int fieldCount = 2;
|
||||||
return fieldCount * EditorGUIUtility.singleLineHeight;
|
return fieldCount * EditorGUIUtility.singleLineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@ -44,9 +44,12 @@ namespace Spine.Unity.Playables {
|
|||||||
public SkeletonAnimation skeletonAnimation;
|
public SkeletonAnimation skeletonAnimation;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
void Reset () {
|
||||||
|
InitializeReference();
|
||||||
|
}
|
||||||
|
|
||||||
void OnValidate () {
|
void OnValidate () {
|
||||||
if (this.skeletonAnimation == null)
|
InitializeReference();
|
||||||
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -56,6 +59,10 @@ namespace Spine.Unity.Playables {
|
|||||||
public override SkeletonData SkeletonData { get { return skeletonAnimation.Skeleton.Data; } }
|
public override SkeletonData SkeletonData { get { return skeletonAnimation.Skeleton.Data; } }
|
||||||
|
|
||||||
void Awake () {
|
void Awake () {
|
||||||
|
InitializeReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeReference () {
|
||||||
if (skeletonAnimation == null)
|
if (skeletonAnimation == null)
|
||||||
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
skeletonAnimation = GetComponent<SkeletonAnimation>();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,70 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes License Agreement
|
||||||
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
|
*
|
||||||
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
|
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||||
|
* http://esotericsoftware.com/spine-editor-license
|
||||||
|
*
|
||||||
|
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||||
|
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||||
|
* "Products"), provided that each user of the Products must obtain their own
|
||||||
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
|
* include this license and copyright notice.
|
||||||
|
*
|
||||||
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
//using UnityEngine.Playables;
|
||||||
|
|
||||||
|
using Spine;
|
||||||
|
using Spine.Unity;
|
||||||
|
using Spine.Unity.Playables;
|
||||||
|
|
||||||
|
namespace Spine.Unity.Playables {
|
||||||
|
|
||||||
|
[AddComponentMenu("Spine/Playables/SkeletonGraphic Playable Handle (Playables)")]
|
||||||
|
public class SkeletonGraphicPlayableHandle : SpinePlayableHandleBase {
|
||||||
|
#region Inspector
|
||||||
|
public SkeletonGraphic skeletonGraphic;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
void Reset () {
|
||||||
|
InitializeReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnValidate () {
|
||||||
|
InitializeReference();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override Skeleton Skeleton { get { return skeletonGraphic.Skeleton; } }
|
||||||
|
public override SkeletonData SkeletonData { get { return skeletonGraphic.Skeleton.Data; } }
|
||||||
|
|
||||||
|
void Awake () {
|
||||||
|
InitializeReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeReference () {
|
||||||
|
if (skeletonGraphic == null)
|
||||||
|
skeletonGraphic = GetComponent<SkeletonGraphic>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 51a0223d4dee020468302946c8ccd329
|
||||||
|
timeCreated: 1595439279
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@ -0,0 +1,48 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes License Agreement
|
||||||
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
|
*
|
||||||
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
|
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||||
|
* http://esotericsoftware.com/spine-editor-license
|
||||||
|
*
|
||||||
|
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||||
|
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||||
|
* "Products"), provided that each user of the Products must obtain their own
|
||||||
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
|
* include this license and copyright notice.
|
||||||
|
*
|
||||||
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Playables;
|
||||||
|
using UnityEngine.Timeline;
|
||||||
|
|
||||||
|
namespace Spine.Unity.Playables {
|
||||||
|
[TrackColor(0.9960785f, 0.2509804f, 0.003921569f)]
|
||||||
|
[TrackClipType(typeof(SpineAnimationStateClip))]
|
||||||
|
[TrackBindingType(typeof(SkeletonGraphic))]
|
||||||
|
public class SpineAnimationStateGraphicTrack : TrackAsset {
|
||||||
|
public int trackIndex = 0;
|
||||||
|
|
||||||
|
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) {
|
||||||
|
var scriptPlayable = ScriptPlayable<SpineAnimationStateMixerBehaviour>.Create(graph, inputCount);
|
||||||
|
var mixerBehaviour = scriptPlayable.GetBehaviour();
|
||||||
|
mixerBehaviour.trackIndex = this.trackIndex;
|
||||||
|
return scriptPlayable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 72a1f4f2e8b6c194bbdabda6998a77e1
|
||||||
|
timeCreated: 1595440391
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#define SPINE_EDITMODEPOSE
|
#define SPINE_EDITMODEPOSE
|
||||||
@ -42,15 +42,20 @@ namespace Spine.Unity.Playables {
|
|||||||
|
|
||||||
// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties.
|
// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties.
|
||||||
public override void ProcessFrame (Playable playable, FrameData info, object playerData) {
|
public override void ProcessFrame (Playable playable, FrameData info, object playerData) {
|
||||||
var spineComponent = playerData as SkeletonAnimation;
|
|
||||||
if (spineComponent == null) return;
|
|
||||||
|
|
||||||
var skeleton = spineComponent.Skeleton;
|
var skeletonAnimation = playerData as SkeletonAnimation;
|
||||||
var state = spineComponent.AnimationState;
|
var skeletonGraphic = playerData as SkeletonGraphic;
|
||||||
|
var animationStateComponent = playerData as IAnimationStateComponent;
|
||||||
|
var skeletonComponent = playerData as ISkeletonComponent;
|
||||||
|
if (animationStateComponent == null || skeletonComponent == null) return;
|
||||||
|
|
||||||
|
var skeleton = skeletonComponent.Skeleton;
|
||||||
|
var state = animationStateComponent.AnimationState;
|
||||||
|
|
||||||
if (!Application.isPlaying) {
|
if (!Application.isPlaying) {
|
||||||
#if SPINE_EDITMODEPOSE
|
#if SPINE_EDITMODEPOSE
|
||||||
PreviewEditModePose(playable, spineComponent);
|
PreviewEditModePose(playable, skeletonComponent, animationStateComponent,
|
||||||
|
skeletonAnimation, skeletonGraphic);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -97,8 +102,14 @@ namespace Spine.Unity.Playables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the first frame ends with an updated mesh.
|
// Ensure that the first frame ends with an updated mesh.
|
||||||
spineComponent.Update(0);
|
if (skeletonAnimation) {
|
||||||
spineComponent.LateUpdate();
|
skeletonAnimation.Update(0);
|
||||||
|
skeletonAnimation.LateUpdate();
|
||||||
|
}
|
||||||
|
else if (skeletonGraphic) {
|
||||||
|
skeletonGraphic.Update(0);
|
||||||
|
skeletonGraphic.LateUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,9 +118,12 @@ namespace Spine.Unity.Playables {
|
|||||||
|
|
||||||
AnimationState dummyAnimationState;
|
AnimationState dummyAnimationState;
|
||||||
|
|
||||||
public void PreviewEditModePose (Playable playable, SkeletonAnimation spineComponent) {
|
public void PreviewEditModePose (Playable playable,
|
||||||
|
ISkeletonComponent skeletonComponent, IAnimationStateComponent animationStateComponent,
|
||||||
|
SkeletonAnimation skeletonAnimation, SkeletonGraphic skeletonGraphic) {
|
||||||
|
|
||||||
if (Application.isPlaying) return;
|
if (Application.isPlaying) return;
|
||||||
if (spineComponent == null) return;
|
if (skeletonComponent == null || animationStateComponent == null) return;
|
||||||
|
|
||||||
int inputCount = playable.GetInputCount();
|
int inputCount = playable.GetInputCount();
|
||||||
int lastNonZeroWeightTrack = -1;
|
int lastNonZeroWeightTrack = -1;
|
||||||
@ -120,14 +134,17 @@ namespace Spine.Unity.Playables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lastNonZeroWeightTrack != -1) {
|
if (lastNonZeroWeightTrack != -1) {
|
||||||
ScriptPlayable<SpineAnimationStateBehaviour> inputPlayableClip = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(lastNonZeroWeightTrack);
|
ScriptPlayable<SpineAnimationStateBehaviour> inputPlayableClip =
|
||||||
|
(ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(lastNonZeroWeightTrack);
|
||||||
SpineAnimationStateBehaviour clipData = inputPlayableClip.GetBehaviour();
|
SpineAnimationStateBehaviour clipData = inputPlayableClip.GetBehaviour();
|
||||||
|
|
||||||
var skeleton = spineComponent.Skeleton;
|
var skeleton = skeletonComponent.Skeleton;
|
||||||
|
|
||||||
bool skeletonDataMismatch = clipData.animationReference != null && spineComponent.SkeletonDataAsset.GetSkeletonData(true) != clipData.animationReference.SkeletonDataAsset.GetSkeletonData(true);
|
bool skeletonDataMismatch = clipData.animationReference != null &&
|
||||||
|
skeletonComponent.SkeletonDataAsset.GetSkeletonData(true) != clipData.animationReference.SkeletonDataAsset.GetSkeletonData(true);
|
||||||
if (skeletonDataMismatch) {
|
if (skeletonDataMismatch) {
|
||||||
Debug.LogWarningFormat("SpineAnimationStateMixerBehaviour tried to apply an animation for the wrong skeleton. Expected {0}. Was {1}", spineComponent.SkeletonDataAsset, clipData.animationReference.SkeletonDataAsset);
|
Debug.LogWarningFormat("SpineAnimationStateMixerBehaviour tried to apply an animation for the wrong skeleton. Expected {0}. Was {1}",
|
||||||
|
skeletonComponent.SkeletonDataAsset, clipData.animationReference.SkeletonDataAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting the from-animation here because it's required to get the mix information from AnimationStateData.
|
// Getting the from-animation here because it's required to get the mix information from AnimationStateData.
|
||||||
@ -147,12 +164,15 @@ namespace Spine.Unity.Playables {
|
|||||||
float mixDuration = clipData.mixDuration;
|
float mixDuration = clipData.mixDuration;
|
||||||
|
|
||||||
if (!clipData.customDuration && fromAnimation != null && toAnimation != null) {
|
if (!clipData.customDuration && fromAnimation != null && toAnimation != null) {
|
||||||
mixDuration = spineComponent.AnimationState.Data.GetMix(fromAnimation, toAnimation);
|
mixDuration = animationStateComponent.AnimationState.Data.GetMix(fromAnimation, toAnimation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (trackIndex == 0)
|
||||||
|
skeleton.SetToSetupPose();
|
||||||
|
|
||||||
// Approximate what AnimationState might do at runtime.
|
// Approximate what AnimationState might do at runtime.
|
||||||
if (fromAnimation != null && mixDuration > 0 && toClipTime < mixDuration) {
|
if (fromAnimation != null && mixDuration > 0 && toClipTime < mixDuration) {
|
||||||
dummyAnimationState = dummyAnimationState ?? new AnimationState(spineComponent.skeletonDataAsset.GetAnimationStateData());
|
dummyAnimationState = dummyAnimationState ?? new AnimationState(skeletonComponent.SkeletonDataAsset.GetAnimationStateData());
|
||||||
|
|
||||||
var toTrack = dummyAnimationState.GetCurrent(0);
|
var toTrack = dummyAnimationState.GetCurrent(0);
|
||||||
var fromTrack = toTrack != null ? toTrack.MixingFrom : null;
|
var fromTrack = toTrack != null ? toTrack.MixingFrom : null;
|
||||||
@ -174,15 +194,18 @@ namespace Spine.Unity.Playables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply Pose
|
// Apply Pose
|
||||||
skeleton.SetToSetupPose();
|
|
||||||
dummyAnimationState.Update(0);
|
dummyAnimationState.Update(0);
|
||||||
dummyAnimationState.Apply(skeleton);
|
dummyAnimationState.Apply(skeleton);
|
||||||
} else {
|
} else {
|
||||||
skeleton.SetToSetupPose();
|
|
||||||
if (toAnimation != null)
|
if (toAnimation != null)
|
||||||
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, null, 1f, MixBlend.Setup, MixDirection.In);
|
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, null, 1f, MixBlend.Setup, MixDirection.In);
|
||||||
}
|
}
|
||||||
|
skeleton.UpdateWorldTransform();
|
||||||
|
|
||||||
|
if (skeletonAnimation)
|
||||||
|
skeletonAnimation.LateUpdate();
|
||||||
|
else if (skeletonGraphic)
|
||||||
|
skeletonGraphic.LateUpdate();
|
||||||
}
|
}
|
||||||
// Do nothing outside of the first clip and the last clip.
|
// Do nothing outside of the first clip and the last clip.
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes License Agreement
|
* Spine Runtimes License Agreement
|
||||||
* Last updated May 1, 2019. Replaces all prior versions.
|
* Last updated January 1, 2020. Replaces all prior versions.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2019, Esoteric Software LLC
|
* Copyright (c) 2013-2020, Esoteric Software LLC
|
||||||
*
|
*
|
||||||
* Integration of the Spine Runtimes into software or otherwise creating
|
* Integration of the Spine Runtimes into software or otherwise creating
|
||||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||||
@ -15,16 +15,16 @@
|
|||||||
* Spine Editor license and redistribution of the Products in any form must
|
* Spine Editor license and redistribution of the Products in any form must
|
||||||
* include this license and copyright notice.
|
* include this license and copyright notice.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS
|
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||||
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY
|
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.timeline",
|
"name": "com.esotericsoftware.spine.timeline",
|
||||||
"displayName": "Spine Timeline Extensions",
|
"displayName": "Spine Timeline Extensions",
|
||||||
"description": "This plugin provides integration of spine-unity for the Unity Timeline.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 3.8 from 2019-10-03 or newer.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
|
"description": "This plugin provides integration of spine-unity for the Unity Timeline.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 3.8 from 2019-10-03 or newer.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
|
||||||
"version": "3.8.1",
|
"version": "3.8.2",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
@ -44,6 +44,15 @@ VertexOutput vert(appdata v) {
|
|||||||
float3 positionWS = TransformObjectToWorld(v.pos);
|
float3 positionWS = TransformObjectToWorld(v.pos);
|
||||||
half3 fixedNormal = half3(0, 0, -1);
|
half3 fixedNormal = half3(0, 0, -1);
|
||||||
half3 normalWS = normalize(mul((float3x3)unity_ObjectToWorld, fixedNormal));
|
half3 normalWS = normalize(mul((float3x3)unity_ObjectToWorld, fixedNormal));
|
||||||
|
|
||||||
|
#ifdef _DOUBLE_SIDED_LIGHTING
|
||||||
|
// unfortunately we have to compute the sign here in the vertex shader
|
||||||
|
// instead of using VFACE in fragment shader stage.
|
||||||
|
half3 viewDirWS = UNITY_MATRIX_V[2].xyz;
|
||||||
|
half faceSign = sign(dot(viewDirWS, normalWS));
|
||||||
|
normalWS *= faceSign;
|
||||||
|
#endif
|
||||||
|
|
||||||
color.rgb = LightweightLightVertexSimplified(positionWS, normalWS);
|
color.rgb = LightweightLightVertexSimplified(positionWS, normalWS);
|
||||||
|
|
||||||
// Note: ambient light is also handled via SH.
|
// Note: ambient light is also handled via SH.
|
||||||
|
|||||||
@ -105,7 +105,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
|||||||
finalColor += inputData.vertexLighting * brdfData.diffuse;
|
finalColor += inputData.vertexLighting * brdfData.diffuse;
|
||||||
#endif
|
#endif
|
||||||
finalColor += emission;
|
finalColor += emission;
|
||||||
return prepareLitPixelForOutput(half4(finalColor, texAlbedoAlpha.a), vertexColor);
|
return prepareLitPixelForOutput(half4(finalColor, albedo.a), vertexColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // !SPECULAR
|
#else // !SPECULAR
|
||||||
@ -148,7 +148,7 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
|||||||
diffuseLighting += emission;
|
diffuseLighting += emission;
|
||||||
//half3 finalColor = diffuseLighting * diffuse + emission;
|
//half3 finalColor = diffuseLighting * diffuse + emission;
|
||||||
half3 finalColor = diffuseLighting * diffuse.rgb;
|
half3 finalColor = diffuseLighting * diffuse.rgb;
|
||||||
return prepareLitPixelForOutput(half4(finalColor, texDiffuseAlpha.a), vertexColor);
|
return prepareLitPixelForOutput(half4(finalColor, diffuse.a), vertexColor);
|
||||||
}
|
}
|
||||||
#endif // SPECULAR
|
#endif // SPECULAR
|
||||||
|
|
||||||
@ -261,6 +261,7 @@ half4 ForwardPassFragmentSprite(VertexOutputLWRP input) : SV_Target
|
|||||||
|
|
||||||
COLORISE(pixel)
|
COLORISE(pixel)
|
||||||
APPLY_FOG_LWRP(pixel, input.fogFactorAndVertexLight.x)
|
APPLY_FOG_LWRP(pixel, input.fogFactorAndVertexLight.x)
|
||||||
|
|
||||||
return pixel;
|
return pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
|
[Toggle(_DOUBLE_SIDED_LIGHTING)] _DoubleSidedLighting("Double-Sided Lighting", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||||
}
|
}
|
||||||
@ -55,6 +56,7 @@
|
|||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
// Spine related keywords
|
// Spine related keywords
|
||||||
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
|
||||||
|
#pragma shader_feature _ _DOUBLE_SIDED_LIGHTING
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
#pragma fragment frag
|
#pragma fragment frag
|
||||||
|
|
||||||
|
|||||||