Browse Source

Allow access to the skin in attachment loader.

NathanSweet 12 years ago
parent
commit
7453edd1e5

+ 2 - 1
spine-c/include/spine/AttachmentLoader.h

@@ -27,6 +27,7 @@
 #define SPINE_ATTACHMENTLOADER_H_
 
 #include <spine/Attachment.h>
+#include <spine/Skin.h>
 
 #ifdef __cplusplus
 namespace spine {
@@ -44,7 +45,7 @@ struct AttachmentLoader {
 void AttachmentLoader_dispose (AttachmentLoader* self);
 
 /* Returns 0 to not load an attachment. If 0 is returned and AttachmentLoader.error1 is set, an error occurred. */
-Attachment* AttachmentLoader_newAttachment (AttachmentLoader* self, AttachmentType type, const char* name);
+Attachment* AttachmentLoader_newAttachment (AttachmentLoader* self, Skin* skin, AttachmentType type, const char* name);
 
 #ifdef __cplusplus
 }

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

@@ -150,7 +150,7 @@ void _AtlasPage_deinit (AtlasPage* self);
 
 void _AttachmentLoader_init (AttachmentLoader* self, //
 		void (*dispose) (AttachmentLoader* self), //
-		Attachment* (*newAttachment) (AttachmentLoader* self, AttachmentType type, const char* name));
+		Attachment* (*newAttachment) (AttachmentLoader* self, Skin* skin, AttachmentType type, const char* name));
 void _AttachmentLoader_deinit (AttachmentLoader* self);
 void _AttachmentLoader_setError (AttachmentLoader* self, const char* error1, const char* error2);
 void _AttachmentLoader_setUnknownTypeError (AttachmentLoader* self, AttachmentType type);

+ 1 - 1
spine-c/src/spine/AtlasAttachmentLoader.c

@@ -34,7 +34,7 @@ void _AtlasAttachmentLoader_dispose (AttachmentLoader* self) {
 	_AttachmentLoader_deinit(self);
 }
 
-Attachment* _AtlasAttachmentLoader_newAttachment (AttachmentLoader* loader, AttachmentType type, const char* name) {
+Attachment* _AtlasAttachmentLoader_newAttachment (AttachmentLoader* loader, Skin* skin, AttachmentType type, const char* name) {
 	AtlasAttachmentLoader* self = SUB_CAST(AtlasAttachmentLoader, loader);
 	switch (type) {
 	case ATTACHMENT_REGION: {

+ 4 - 4
spine-c/src/spine/AttachmentLoader.c

@@ -32,13 +32,13 @@ namespace spine {
 #endif
 
 typedef struct _AttachmentLoaderVtable {
-	Attachment* (*newAttachment) (AttachmentLoader* self, AttachmentType type, const char* name);
+	Attachment* (*newAttachment) (AttachmentLoader* self, Skin* skin, AttachmentType type, const char* name);
 	void (*dispose) (AttachmentLoader* self);
 } _AttachmentLoaderVtable;
 
 void _AttachmentLoader_init (AttachmentLoader* self, //
 		void (*dispose) (AttachmentLoader* self), //
-		Attachment* (*newAttachment) (AttachmentLoader* self, AttachmentType type, const char* name)) {
+		Attachment* (*newAttachment) (AttachmentLoader* self, Skin* skin, AttachmentType type, const char* name)) {
 	CONST_CAST(_AttachmentLoaderVtable*, self->vtable) = NEW(_AttachmentLoaderVtable);
 	VTABLE(AttachmentLoader, self) ->dispose = dispose;
 	VTABLE(AttachmentLoader, self) ->newAttachment = newAttachment;
@@ -54,12 +54,12 @@ void AttachmentLoader_dispose (AttachmentLoader* self) {
 	VTABLE(AttachmentLoader, self) ->dispose(self);
 }
 
-Attachment* AttachmentLoader_newAttachment (AttachmentLoader* self, AttachmentType type, const char* name) {
+Attachment* AttachmentLoader_newAttachment (AttachmentLoader* self, Skin* skin, AttachmentType type, const char* name) {
 	FREE(self->error1);
 	FREE(self->error2);
 	self->error1 = 0;
 	self->error2 = 0;
-	return VTABLE(AttachmentLoader, self) ->newAttachment(self, type, name);
+	return VTABLE(AttachmentLoader, self) ->newAttachment(self, skin, type, name);
 }
 
 void _AttachmentLoader_setError (AttachmentLoader* self, const char* error1, const char* error2) {

+ 1 - 1
spine-c/src/spine/SkeletonJson.c

@@ -349,7 +349,7 @@ SkeletonData* SkeletonJson_readSkeletonData (SkeletonJson* self, const char* jso
 						return 0;
 					}
 
-					Attachment* attachment = AttachmentLoader_newAttachment(self->attachmentLoader, type, attachmentName);
+					Attachment* attachment = AttachmentLoader_newAttachment(self->attachmentLoader, skin, type, attachmentName);
 					if (!attachment) {
 						if (self->attachmentLoader->error1) {
 							SkeletonData_dispose(skeletonData);