Ver código fonte

[c] Listeners on spAnimationState and spTrackEntry will now also be called if a track entry gets disposed as part of disposing an spAnimationState.

badlogic 8 anos atrás
pai
commit
a4a97969e8

+ 1 - 0
CHANGELOG.md

@@ -35,6 +35,7 @@
   * Removed `spBone_worldToLocalRotationX` and `spBone_worldToLocalRotationY`. Replaced by `spBone_worldToLocalRotation` (rotation given relative to x-axis, counter-clockwise, in degrees).
   * Removed `spBone_worldToLocalRotationX` and `spBone_worldToLocalRotationY`. Replaced by `spBone_worldToLocalRotation` (rotation given relative to x-axis, counter-clockwise, in degrees).
   * Replaced `r`, `g`, `b`, `a` fields with instances of new `spColor` struct in `spRegionAttachment`, `spMeshAttachment`, `spSkeleton`, `spSkeletonData`, `spSlot` and `spSlotData`.
   * Replaced `r`, `g`, `b`, `a` fields with instances of new `spColor` struct in `spRegionAttachment`, `spMeshAttachment`, `spSkeleton`, `spSkeletonData`, `spSlot` and `spSlotData`.
   * Removed `spVertexIndex`from public API.
   * Removed `spVertexIndex`from public API.
+  * Listeners on `spAnimationState` or `spTrackEntry` will now be also called in case a track entry is disposed as part of dispoing the `spAnimationState`.
  * **Additions**
  * **Additions**
   * Added support for local and relative transform constraint calculation, including additional fields in `spTransformConstraintData`.  
   * Added support for local and relative transform constraint calculation, including additional fields in `spTransformConstraintData`.  
   * Added `spPointAttachment`, additional method `spAtlasAttachmentLoadeR_newPointAttachment`.
   * Added `spPointAttachment`, additional method `spAtlasAttachmentLoadeR_newPointAttachment`.

+ 1 - 1
spine-c/spine-c/include/spine/dll.h

@@ -45,4 +45,4 @@
 	#define SP_API SPINEPLUGIN_API
 	#define SP_API SPINEPLUGIN_API
 #endif
 #endif
 
 
-#endif /* SPINE_SHAREDLIB_H */
+#endif /* SPINE_SHAREDLIB_H */

+ 4 - 0
spine-c/spine-c/src/spine/AnimationState.c

@@ -193,9 +193,13 @@ void _spAnimationState_disposeTrackEntries (spAnimationState* state, spTrackEntr
 		spTrackEntry* from = entry->mixingFrom;
 		spTrackEntry* from = entry->mixingFrom;
 		while (from) {
 		while (from) {
 			spTrackEntry* nextFrom = from->mixingFrom;
 			spTrackEntry* nextFrom = from->mixingFrom;
+			if (entry->listener) entry->listener(state, SP_ANIMATION_DISPOSE, from, 0);
+			if (state->listener) state->listener(state, SP_ANIMATION_DISPOSE, from, 0);
 			_spAnimationState_disposeTrackEntry(from);
 			_spAnimationState_disposeTrackEntry(from);
 			from = nextFrom;
 			from = nextFrom;
 		}
 		}
+		if (entry->listener) entry->listener(state, SP_ANIMATION_DISPOSE, entry, 0);
+		if (state->listener) state->listener(state, SP_ANIMATION_DISPOSE, entry, 0);
 		_spAnimationState_disposeTrackEntry(entry);
 		_spAnimationState_disposeTrackEntry(entry);
 		entry = next;
 		entry = next;
 	}
 	}