filterSekai

Hi, i am running example project from spine-runtimes/spine-cocos2d-objc at 3.7
after successfully running, I replace the skeleton .json, texture atlas .atlas, and asset .png with my own.
-(id) init {
self = [super init];
if (!self) return nil;

skeletonNode = [SkeletonAnimation skeletonWithFile:@"myskeleton.json" atlasFile:@"myskeleton.atlas" scale:0.3];
[skeletonNode setSkin:@"default"];
[skeletonNode setAnimationForTrack:0 name:@"run" loop:YES];

CGSize windowSize = [[CCDirector sharedDirector] viewSize];
[skeletonNode setPosition:ccp(windowSize.width / 2, 10)];
[self addChild:skeletonNode];

self.userInteractionEnabled = YES;
self.contentSize = windowSize;

return self;
}
Now it only show the bones. Did I miss something? Or load the animation incorrectly? Thank you!
filterSekai
  • Beiträge: 17

badlogic

Does your skeleton not have attachments in its default skin? Do you have other skins than the empty default skin? Then you have to set a skin first, e.g. like this:
[skeletonNode setSkin:@"your-skin-name-here"];
You are setting the skin in the 5th code line in your code above. Just change the name to the skin you want to use.
Benutzeravatar
badlogic

Mario
  • Beiträge: 1924

filterSekai

badlogic hat geschrieben:Does your skeleton not have attachments in its default skin? Do you have other skins than the empty default skin? Then you have to set a skin first, e.g. like this:
[skeletonNode setSkin:@"your-skin-name-here"];
You are setting the skin in the 5th code line in your code above. Just change the name to the skin you want to use.
Really appreciate for your reply. My myskeleton.json has default skins, followed by another skin json node, see this
"skins": {
"default": {
"1x/shadow": {
"shadow": {
"y": 6.15,
"scaleX": 0.542,
"rotation": 360,
"width": 203,
"height": 27
}
},
"base_body": {
"body": {
"color": "ce7272ff",
"x": 56.64,
"rotation": -90,
"width": 36,
"height": 99
}
},
"base_head": {
"head": {
"color": "ce7272ff",
"x": 51.38,
"rotation": -90,
"width": 54,
"height": 55
}
},
"base_left_foot": {
"foot_left": {
"color": "ce7272ff",
"x": 14.43,
"y": -8.58,
"scaleX": 0.995,
"rotation": 89.42,
"width": 29,
"height": 24
}
},
"base_left_hand": {
"left_hand": {
"color": "ce7272ff",
"x": 1.59,
"y": -0.2,
"scaleX": 0.5,
"scaleY": 0.5,
"rotation": -89.27,
"width": 20,
"height": 20
}
},
"base_left_lower_arm": {
"left_lower_arm": {
"color": "ce7272ff",
"x": 23.11,
"y": 0.46,
"rotation": 103.96,
"width": 25,
"height": 55
}
},
"base_left_lower_leg": {
"left_lower_leg": {
"color": "ce7272ff",
"x": 38.31,
"y": 0.06,
"rotation": 89.87,
"width": 10,
"height": 72
}
},
"base_left_upper_arm": {
"left_upper_arm": {
"color": "ce7272ff",
"x": 33.48,
"y": -0.05,
"rotation": 106.91,
"width": 25,
"height": 57
}
},
"base_left_upper_leg": {
"lower_upper_leg": {
"color": "ce7272ff",
"x": 28.81,
"y": -0.8,
"rotation": 89.11,
"width": 10,
"height": 74
}
},
"base_right_foot": {
"foot_right": {
"color": "ce7272ff",
"x": 14.41,
"y": 8.3,
"rotation": 90.87,
"width": 29,
"height": 24
}
},
"base_right_hand": {
"right_hand": {
"color": "ce7171ff",
"x": 2.75,
"y": 2.14,
"scaleX": 0.5,
"scaleY": 0.5,
"rotation": -89.55,
"width": 20,
"height": 20
}
},
"base_right_lower_arm": {
"right_lower_arm": {
"color": "ce7171ff",
"x": 23.28,
"y": -1.34,
"rotation": 72.02,
"width": 24,
"height": 55
}
},
"base_right_lower_leg": {
"right_lower_leg": {
"color": "ce7171ff",
"x": 38.32,
"y": -0.83,
"rotation": 89.69,
"width": 10,
"height": 72
}
},
"base_right_upper_arm": {
"right_upper_arm": {
"color": "ce7171ff",
"x": 33.47,
"y": -0.98,
"rotation": 72.2,
"width": 25,
"height": 57
}
},
"base_right_upper_leg": {
"right_upper_leg": {
"color": "ce7171ff",
"x": 28.82,
"y": 0.23,
"rotation": 90.44,
"width": 10,
"height": 74
}
},
"base_waist": {
"waist": {
"color": "ce7171ff",
"y": 3.57,
"scaleX": 0.471,
"scaleY": 0.392,
"width": 34,
"height": 34
}
}
},
I already set the skin to default with
[skeletonNode setSkin:@"default"];
Or should I manually set all skin listed in my myskeleton.json'skin?
filterSekai
  • Beiträge: 17

badlogic

No, if your skeleton has a default skin with attachments (and based on your copy & paste it does), then just calling setSkin:@"default" should do the trick.

Could you maybe try to load and display your skeleton with your spine-cocos2d-objc project? It's hard to diagnose what's going on without having access to your exact setup.
Benutzeravatar
badlogic

Mario
  • Beiträge: 1924

filterSekai

badlogic hat geschrieben:No, if your skeleton has a default skin with attachments (and based on your copy & paste it does), then just calling setSkin:@"default" should do the trick.

Could you maybe try to load and display your skeleton with your spine-cocos2d-objc project? It's hard to diagnose what's going on without having access to your exact setup.
Already tried my skeleton in the spine-cocos2d-objc project example, but still only bones. I replaced the asset from RaptorExample scene. Is there any something that cause it happen?
filterSekai
  • Beiträge: 17

badlogic

I can not tell without your .json, .atlas, and .png files I'm afraid.
Benutzeravatar
badlogic

Mario
  • Beiträge: 1924

filterSekai

badlogic hat geschrieben:I can not tell without your .json, .atlas, and .png files I'm afraid.
Here is my asset, looking forward to see your help. Thank you.
filterSekai
  • Beiträge: 17

badlogic

This is what I see when loading your skeleton into our spine-cocos2d-objc example project, modifying "SpineboyExample.m":

https://marioslab.io/uploads/screenshots/vUHxoNdYRH.png

This is what is to be expected based on the "default" skin. E.g. this is what you see in the Spine Editor when the "default" skin is activated.

https://marioslab.io/uploads/screenshots/oWhvLQlTU5.png

This is correct.
Benutzeravatar
badlogic

Mario
  • Beiträge: 1924

filterSekai

How to open that asset in spine editor?
filterSekai
  • Beiträge: 17

badlogic

You can import .json files in the editor: Import - Spine User Guide

You can also unpack the .atlas files into a folder. Then set the Images node in the editor to the folder to which you unpacked the atlas.
Benutzeravatar
badlogic

Mario
  • Beiträge: 1924

filterSekai

badlogic hat geschrieben:This is what I see when loading your skeleton into our spine-cocos2d-objc example project, modifying "SpineboyExample.m":

https://marioslab.io/uploads/screenshots/vUHxoNdYRH.png

This is what is to be expected based on the "default" skin. E.g. this is what you see in the Spine Editor when the "default" skin is activated.

https://marioslab.io/uploads/screenshots/oWhvLQlTU5.png

This is correct.
I think i need to add some of the skin manually. Is there any way to do it? Something like
Skin newSkin = new Skin("new-skin"); // 1. Create a new empty skin
newSkin.addSkin(skeletonData.findSkin("shirt/pink"); // 2. Add items
newSkin.addSkin(skeletonData.findSkin("pants/green");
newSkin.addSkin(skeletonData.findSkin("shoes/sneakers");
filterSekai
  • Beiträge: 17

badlogic

Sure! Assuming you are working with Spine 3.8 and the corresponding runtimes, you can use the spine-c Skin API as illustrated here:

spine-runtimes/main.cpp at 3.8
Benutzeravatar
badlogic

Mario
  • Beiträge: 1924


Zurück zu Bugs