diff --git a/spine-c/codegen/exclusions.txt b/spine-c/codegen/exclusions.txt index 166455ba7..8b40cee83 100644 --- a/spine-c/codegen/exclusions.txt +++ b/spine-c/codegen/exclusions.txt @@ -56,6 +56,7 @@ method: Bone::pose # Methods that return objects by value (not supported - would need heap allocation) method: Color::valueOf +method: DrawOrderTimeline::getPropertyId # Exclude const versions of getSetupPose() - we'll only expose the non-const version method: BoneData::getSetupPose const diff --git a/spine-c/src/generated/property.h b/spine-c/src/generated/property.h index f2c9c69ac..89a547f7d 100644 --- a/spine-c/src/generated/property.h +++ b/spine-c/src/generated/property.h @@ -6,37 +6,38 @@ extern "C" { #endif typedef enum spine_property { - SPINE_PROPERTY_ROTATE = 1 << 0, - SPINE_PROPERTY_X = 1 << 1, - SPINE_PROPERTY_Y = 1 << 2, - SPINE_PROPERTY_SCALE_X = 1 << 3, - SPINE_PROPERTY_SCALE_Y = 1 << 4, - SPINE_PROPERTY_SHEAR_X = 1 << 5, - SPINE_PROPERTY_SHEAR_Y = 1 << 6, - SPINE_PROPERTY_INHERIT = 1 << 7, - SPINE_PROPERTY_RGB = 1 << 8, - SPINE_PROPERTY_ALPHA = 1 << 9, - SPINE_PROPERTY_RGB2 = 1 << 10, - SPINE_PROPERTY_ATTACHMENT = 1 << 11, - SPINE_PROPERTY_DEFORM = 1 << 12, - SPINE_PROPERTY_EVENT = 1 << 13, - SPINE_PROPERTY_DRAW_ORDER = 1 << 14, - SPINE_PROPERTY_IK_CONSTRAINT = 1 << 15, - SPINE_PROPERTY_TRANSFORM_CONSTRAINT = 1 << 16, - SPINE_PROPERTY_PATH_CONSTRAINT_POSITION = 1 << 17, - SPINE_PROPERTY_PATH_CONSTRAINT_SPACING = 1 << 18, - SPINE_PROPERTY_PATH_CONSTRAINT_MIX = 1 << 19, - SPINE_PROPERTY_PHYSICS_CONSTRAINT_INERTIA = 1 << 20, - SPINE_PROPERTY_PHYSICS_CONSTRAINT_STRENGTH = 1 << 21, - SPINE_PROPERTY_PHYSICS_CONSTRAINT_DAMPING = 1 << 22, - SPINE_PROPERTY_PHYSICS_CONSTRAINT_MASS = 1 << 23, - SPINE_PROPERTY_PHYSICS_CONSTRAINT_WIND = 1 << 24, - SPINE_PROPERTY_PHYSICS_CONSTRAINT_GRAVITY = 1 << 25, - SPINE_PROPERTY_PHYSICS_CONSTRAINT_MIX = 1 << 26, - SPINE_PROPERTY_PHYSICS_CONSTRAINT_RESET = 1 << 27, - SPINE_PROPERTY_SEQUENCE = 1 << 28, - SPINE_PROPERTY_SLIDER_TIME = 1 << 29, - SPINE_PROPERTY_SLIDER_MIX = 1 << 30 + SPINE_PROPERTY_ROTATE = 0, + SPINE_PROPERTY_X, + SPINE_PROPERTY_Y, + SPINE_PROPERTY_SCALE_X, + SPINE_PROPERTY_SCALE_Y, + SPINE_PROPERTY_SHEAR_X, + SPINE_PROPERTY_SHEAR_Y, + SPINE_PROPERTY_INHERIT, + SPINE_PROPERTY_RGB, + SPINE_PROPERTY_ALPHA, + SPINE_PROPERTY_RGB2, + SPINE_PROPERTY_ATTACHMENT, + SPINE_PROPERTY_DEFORM, + SPINE_PROPERTY_EVENT, + SPINE_PROPERTY_DRAW_ORDER, + SPINE_PROPERTY_IK_CONSTRAINT, + SPINE_PROPERTY_TRANSFORM_CONSTRAINT, + SPINE_PROPERTY_PATH_CONSTRAINT_POSITION, + SPINE_PROPERTY_PATH_CONSTRAINT_SPACING, + SPINE_PROPERTY_PATH_CONSTRAINT_MIX, + SPINE_PROPERTY_PHYSICS_CONSTRAINT_INERTIA, + SPINE_PROPERTY_PHYSICS_CONSTRAINT_STRENGTH, + SPINE_PROPERTY_PHYSICS_CONSTRAINT_DAMPING, + SPINE_PROPERTY_PHYSICS_CONSTRAINT_MASS, + SPINE_PROPERTY_PHYSICS_CONSTRAINT_WIND, + SPINE_PROPERTY_PHYSICS_CONSTRAINT_GRAVITY, + SPINE_PROPERTY_PHYSICS_CONSTRAINT_MIX, + SPINE_PROPERTY_PHYSICS_CONSTRAINT_RESET, + SPINE_PROPERTY_SEQUENCE, + SPINE_PROPERTY_SLIDER_TIME, + SPINE_PROPERTY_SLIDER_MIX, + SPINE_PROPERTY_DRAW_ORDER_FOLDER } spine_property; #ifdef __cplusplus diff --git a/spine-cpp/include/spine/DrawOrderTimeline.h b/spine-cpp/include/spine/DrawOrderTimeline.h index e3fe95c9d..62ea54637 100644 --- a/spine-cpp/include/spine/DrawOrderTimeline.h +++ b/spine-cpp/include/spine/DrawOrderTimeline.h @@ -42,6 +42,8 @@ namespace spine { RTTI_DECL public: + static PropertyId getPropertyId(); + explicit DrawOrderTimeline(size_t frameCount); virtual void apply(Skeleton &skeleton, float lastTime, float time, Array *events, float alpha, MixBlend blend, diff --git a/spine-cpp/include/spine/Property.h b/spine-cpp/include/spine/Property.h index 978f5c7f5..030e27e49 100644 --- a/spine-cpp/include/spine/Property.h +++ b/spine-cpp/include/spine/Property.h @@ -33,37 +33,38 @@ namespace spine { typedef long long PropertyId; enum Property { - Property_Rotate = 1 << 0, - Property_X = 1 << 1, - Property_Y = 1 << 2, - Property_ScaleX = 1 << 3, - Property_ScaleY = 1 << 4, - Property_ShearX = 1 << 5, - Property_ShearY = 1 << 6, - Property_Inherit = 1 << 7, - Property_Rgb = 1 << 8, - Property_Alpha = 1 << 9, - Property_Rgb2 = 1 << 10, - Property_Attachment = 1 << 11, - Property_Deform = 1 << 12, - Property_Event = 1 << 13, - Property_DrawOrder = 1 << 14, - Property_IkConstraint = 1 << 15, - Property_TransformConstraint = 1 << 16, - Property_PathConstraintPosition = 1 << 17, - Property_PathConstraintSpacing = 1 << 18, - Property_PathConstraintMix = 1 << 19, - Property_PhysicsConstraintInertia = 1 << 20, - Property_PhysicsConstraintStrength = 1 << 21, - Property_PhysicsConstraintDamping = 1 << 22, - Property_PhysicsConstraintMass = 1 << 23, - Property_PhysicsConstraintWind = 1 << 24, - Property_PhysicsConstraintGravity = 1 << 25, - Property_PhysicsConstraintMix = 1 << 26, - Property_PhysicsConstraintReset = 1 << 27, - Property_Sequence = 1 << 28, - Property_SliderTime = 1 << 29, - Property_SliderMix = 1 << 30 + Property_Rotate = 0, + Property_X, + Property_Y, + Property_ScaleX, + Property_ScaleY, + Property_ShearX, + Property_ShearY, + Property_Inherit, + Property_Rgb, + Property_Alpha, + Property_Rgb2, + Property_Attachment, + Property_Deform, + Property_Event, + Property_DrawOrder, + Property_IkConstraint, + Property_TransformConstraint, + Property_PathConstraintPosition, + Property_PathConstraintSpacing, + Property_PathConstraintMix, + Property_PhysicsConstraintInertia, + Property_PhysicsConstraintStrength, + Property_PhysicsConstraintDamping, + Property_PhysicsConstraintMass, + Property_PhysicsConstraintWind, + Property_PhysicsConstraintGravity, + Property_PhysicsConstraintMix, + Property_PhysicsConstraintReset, + Property_Sequence, + Property_SliderTime, + Property_SliderMix, + Property_DrawOrderFolder }; } diff --git a/spine-cpp/src/spine/AnimationState.cpp b/spine-cpp/src/spine/AnimationState.cpp index c302e0ff6..b92c86b28 100644 --- a/spine-cpp/src/spine/AnimationState.cpp +++ b/spine-cpp/src/spine/AnimationState.cpp @@ -951,7 +951,7 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton) { if (from->_mixingFrom != NULL) applyMixingFrom(from, skeleton); float mix; - if (to->_mixDuration == 0) // Single frame mix to undo mixingFrom changes. + if (to->_mixDuration == 0)// Single frame mix to undo mixingFrom changes. mix = 1; else { mix = to->_mixTime / to->_mixDuration; @@ -1187,10 +1187,14 @@ void AnimationState::computeHold(TrackEntry *entry) { timelineMode.setSize(timelinesCount, 0); Array &timelineHoldMix = entry->_timelineHoldMix; timelineHoldMix.setSize(timelinesCount, 0); + PropertyId drawOrderPropertyId = DrawOrderTimeline::getPropertyId(); if (to != NULL && to->_holdPrevious) { for (size_t i = 0; i < timelinesCount; i++) { - timelineMode[i] = _propertyIDs.addAll(timelines[i]->getPropertyIds(), true) ? HoldFirst : HoldSubsequent; + bool first = _propertyIDs.addAll(timelines[i]->getPropertyIds(), true); + if (first && timelines[i]->getRTTI().isExactly(DrawOrderFolderTimeline::rtti) && _propertyIDs.containsKey(drawOrderPropertyId)) + first = false; + timelineMode[i] = first ? HoldFirst : HoldSubsequent; } return; } @@ -1203,6 +1207,8 @@ continue_outer: Array &ids = timeline->getPropertyIds(); if (!_propertyIDs.addAll(ids, true)) { timelineMode[i] = Subsequent; + } else if (timeline->getRTTI().isExactly(DrawOrderFolderTimeline::rtti) && _propertyIDs.containsKey(drawOrderPropertyId)) { + timelineMode[i] = Subsequent; } else { if (to == NULL || timeline->getRTTI().isExactly(AttachmentTimeline::rtti) || timeline->getRTTI().isExactly(DrawOrderTimeline::rtti) || timeline->getRTTI().isExactly(DrawOrderFolderTimeline::rtti) || timeline->getRTTI().isExactly(EventTimeline::rtti) || diff --git a/spine-cpp/src/spine/DrawOrderFolderTimeline.cpp b/spine-cpp/src/spine/DrawOrderFolderTimeline.cpp index 723b226d3..6ee2f623c 100644 --- a/spine-cpp/src/spine/DrawOrderFolderTimeline.cpp +++ b/spine-cpp/src/spine/DrawOrderFolderTimeline.cpp @@ -41,8 +41,9 @@ using namespace spine; RTTI_IMPL(DrawOrderFolderTimeline, Timeline) DrawOrderFolderTimeline::DrawOrderFolderTimeline(size_t frameCount, Array &slots, size_t slotCount) : Timeline(frameCount, 1) { - PropertyId ids[] = {((PropertyId) Property_DrawOrder << 32)}; - setPropertyIds(ids, 1); + Array ids(slots.size()); + for (size_t i = 0; i < slots.size(); ++i) ids.add(((PropertyId) Property_DrawOrderFolder << 32) | (PropertyId) slots[i]); + setPropertyIds(ids.buffer(), ids.size()); _slots.addAll(slots); _drawOrders.ensureCapacity(frameCount); diff --git a/spine-cpp/src/spine/DrawOrderTimeline.cpp b/spine-cpp/src/spine/DrawOrderTimeline.cpp index 1a221b4aa..e7133a247 100644 --- a/spine-cpp/src/spine/DrawOrderTimeline.cpp +++ b/spine-cpp/src/spine/DrawOrderTimeline.cpp @@ -41,8 +41,12 @@ using namespace spine; RTTI_IMPL(DrawOrderTimeline, Timeline) +PropertyId DrawOrderTimeline::getPropertyId() { + return ((PropertyId) Property_DrawOrder << 32); +} + DrawOrderTimeline::DrawOrderTimeline(size_t frameCount) : Timeline(frameCount, 1) { - PropertyId ids[] = {((PropertyId) Property_DrawOrder << 32)}; + PropertyId ids[] = {getPropertyId()}; setPropertyIds(ids, 1); _drawOrders.ensureCapacity(frameCount); diff --git a/spine-flutter/lib/assets/libspine_flutter.wasm b/spine-flutter/lib/assets/libspine_flutter.wasm index 470c8efd3..48dbe5e22 100755 Binary files a/spine-flutter/lib/assets/libspine_flutter.wasm and b/spine-flutter/lib/assets/libspine_flutter.wasm differ diff --git a/spine-flutter/lib/generated/property.dart b/spine-flutter/lib/generated/property.dart index 4ca8eeb37..fa4f320d3 100644 --- a/spine-flutter/lib/generated/property.dart +++ b/spine-flutter/lib/generated/property.dart @@ -31,37 +31,38 @@ /// Property enum enum Property { - rotate(1), + rotate(0), x(1), - y(1), - scaleX(1), - scaleY(1), - shearX(1), - shearY(1), - inherit(1), - rgb(1), - alpha(1), - rgb2(1), - attachment(1), - deform(1), - event(1), - drawOrder(1), - ikConstraint(1), - transformConstraint(1), - pathConstraintPosition(1), - pathConstraintSpacing(1), - pathConstraintMix(1), - physicsConstraintInertia(1), - physicsConstraintStrength(1), - physicsConstraintDamping(1), - physicsConstraintMass(1), - physicsConstraintWind(1), - physicsConstraintGravity(1), - physicsConstraintMix(1), - physicsConstraintReset(1), - sequence(1), - sliderTime(1), - sliderMix(1); + y(2), + scaleX(3), + scaleY(4), + shearX(5), + shearY(6), + inherit(7), + rgb(8), + alpha(9), + rgb2(10), + attachment(11), + deform(12), + event(13), + drawOrder(14), + ikConstraint(15), + transformConstraint(16), + pathConstraintPosition(17), + pathConstraintSpacing(18), + pathConstraintMix(19), + physicsConstraintInertia(20), + physicsConstraintStrength(21), + physicsConstraintDamping(22), + physicsConstraintMass(23), + physicsConstraintWind(24), + physicsConstraintGravity(25), + physicsConstraintMix(26), + physicsConstraintReset(27), + sequence(28), + sliderTime(29), + sliderMix(30), + drawOrderFolder(31); const Property(this.value); final int value; diff --git a/spine-flutter/lib/generated/spine_dart_bindings_generated.dart b/spine-flutter/lib/generated/spine_dart_bindings_generated.dart index 2be0c42b0..7ecac3921 100644 --- a/spine-flutter/lib/generated/spine_dart_bindings_generated.dart +++ b/spine-flutter/lib/generated/spine_dart_bindings_generated.dart @@ -49808,37 +49808,38 @@ abstract class spine_position_mode { } abstract class spine_property { - static const int SPINE_PROPERTY_ROTATE = 1; - static const int SPINE_PROPERTY_X = 2; - static const int SPINE_PROPERTY_Y = 4; - static const int SPINE_PROPERTY_SCALE_X = 8; - static const int SPINE_PROPERTY_SCALE_Y = 16; - static const int SPINE_PROPERTY_SHEAR_X = 32; - static const int SPINE_PROPERTY_SHEAR_Y = 64; - static const int SPINE_PROPERTY_INHERIT = 128; - static const int SPINE_PROPERTY_RGB = 256; - static const int SPINE_PROPERTY_ALPHA = 512; - static const int SPINE_PROPERTY_RGB2 = 1024; - static const int SPINE_PROPERTY_ATTACHMENT = 2048; - static const int SPINE_PROPERTY_DEFORM = 4096; - static const int SPINE_PROPERTY_EVENT = 8192; - static const int SPINE_PROPERTY_DRAW_ORDER = 16384; - static const int SPINE_PROPERTY_IK_CONSTRAINT = 32768; - static const int SPINE_PROPERTY_TRANSFORM_CONSTRAINT = 65536; - static const int SPINE_PROPERTY_PATH_CONSTRAINT_POSITION = 131072; - static const int SPINE_PROPERTY_PATH_CONSTRAINT_SPACING = 262144; - static const int SPINE_PROPERTY_PATH_CONSTRAINT_MIX = 524288; - static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_INERTIA = 1048576; - static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_STRENGTH = 2097152; - static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_DAMPING = 4194304; - static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_MASS = 8388608; - static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_WIND = 16777216; - static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_GRAVITY = 33554432; - static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_MIX = 67108864; - static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_RESET = 134217728; - static const int SPINE_PROPERTY_SEQUENCE = 268435456; - static const int SPINE_PROPERTY_SLIDER_TIME = 536870912; - static const int SPINE_PROPERTY_SLIDER_MIX = 1073741824; + static const int SPINE_PROPERTY_ROTATE = 0; + static const int SPINE_PROPERTY_X = 1; + static const int SPINE_PROPERTY_Y = 2; + static const int SPINE_PROPERTY_SCALE_X = 3; + static const int SPINE_PROPERTY_SCALE_Y = 4; + static const int SPINE_PROPERTY_SHEAR_X = 5; + static const int SPINE_PROPERTY_SHEAR_Y = 6; + static const int SPINE_PROPERTY_INHERIT = 7; + static const int SPINE_PROPERTY_RGB = 8; + static const int SPINE_PROPERTY_ALPHA = 9; + static const int SPINE_PROPERTY_RGB2 = 10; + static const int SPINE_PROPERTY_ATTACHMENT = 11; + static const int SPINE_PROPERTY_DEFORM = 12; + static const int SPINE_PROPERTY_EVENT = 13; + static const int SPINE_PROPERTY_DRAW_ORDER = 14; + static const int SPINE_PROPERTY_IK_CONSTRAINT = 15; + static const int SPINE_PROPERTY_TRANSFORM_CONSTRAINT = 16; + static const int SPINE_PROPERTY_PATH_CONSTRAINT_POSITION = 17; + static const int SPINE_PROPERTY_PATH_CONSTRAINT_SPACING = 18; + static const int SPINE_PROPERTY_PATH_CONSTRAINT_MIX = 19; + static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_INERTIA = 20; + static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_STRENGTH = 21; + static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_DAMPING = 22; + static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_MASS = 23; + static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_WIND = 24; + static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_GRAVITY = 25; + static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_MIX = 26; + static const int SPINE_PROPERTY_PHYSICS_CONSTRAINT_RESET = 27; + static const int SPINE_PROPERTY_SEQUENCE = 28; + static const int SPINE_PROPERTY_SLIDER_TIME = 29; + static const int SPINE_PROPERTY_SLIDER_MIX = 30; + static const int SPINE_PROPERTY_DRAW_ORDER_FOLDER = 31; } abstract class spine_rotate_mode { diff --git a/spine-ios/Sources/SpineSwift/Generated/property.swift b/spine-ios/Sources/SpineSwift/Generated/property.swift index 0504762e8..80a48871b 100644 --- a/spine-ios/Sources/SpineSwift/Generated/property.swift +++ b/spine-ios/Sources/SpineSwift/Generated/property.swift @@ -33,37 +33,38 @@ import Foundation /// Property enum public enum Property: Int32, CaseIterable { - case rotate = 1 - case x = 2 - case y = 4 - case scaleX = 8 - case scaleY = 16 - case shearX = 32 - case shearY = 64 - case inherit = 128 - case rgb = 256 - case alpha = 512 - case rgb2 = 1024 - case attachment = 2048 - case deform = 4096 - case event = 8192 - case drawOrder = 16384 - case ikConstraint = 32768 - case transformConstraint = 65536 - case pathConstraintPosition = 131072 - case pathConstraintSpacing = 262144 - case pathConstraintMix = 524288 - case physicsConstraintInertia = 1_048_576 - case physicsConstraintStrength = 2_097_152 - case physicsConstraintDamping = 4_194_304 - case physicsConstraintMass = 8_388_608 - case physicsConstraintWind = 16_777_216 - case physicsConstraintGravity = 33_554_432 - case physicsConstraintMix = 67_108_864 - case physicsConstraintReset = 134_217_728 - case sequence = 268_435_456 - case sliderTime = 536_870_912 - case sliderMix = 1_073_741_824 + case rotate = 0 + case x = 1 + case y = 2 + case scaleX = 3 + case scaleY = 4 + case shearX = 5 + case shearY = 6 + case inherit = 7 + case rgb = 8 + case alpha = 9 + case rgb2 = 10 + case attachment = 11 + case deform = 12 + case event = 13 + case drawOrder = 14 + case ikConstraint = 15 + case transformConstraint = 16 + case pathConstraintPosition = 17 + case pathConstraintSpacing = 18 + case pathConstraintMix = 19 + case physicsConstraintInertia = 20 + case physicsConstraintStrength = 21 + case physicsConstraintDamping = 22 + case physicsConstraintMass = 23 + case physicsConstraintWind = 24 + case physicsConstraintGravity = 25 + case physicsConstraintMix = 26 + case physicsConstraintReset = 27 + case sequence = 28 + case sliderTime = 29 + case sliderMix = 30 + case drawOrderFolder = 31 public static func fromValue(_ value: Int32) -> Property? { return Property(rawValue: value)