Hello Mario, I was sent sample project to your mail. is there any update ?
filterSekai

- 5 janv. 2022
- Inscrit 26 mai 2019
Sure, I'll share resources and small program to your email. I'm not sure whether that was affected by memory warning. but I'm still findings out too. Wondering, could you give me example or reference about resource purging ?
Please put your email. Thank you- Modifié
We have some of the characters that have rendering issue. Sometimes one of attachment is missing/glitching and occurred is not consistent (intermittent). We suspect issue caused by memory warning but not sure whether material will be purge automatically when device has leak memory. The missing material is randomly sometime body part, leg, hand and others. Could you give clue or insight why that issue happened ?
Here I attached the actual result that happened on our iOS Platform
it should be work fine like our expected result.
We implemented spine by using spine-cocos2d-objc and spine-c version 3.7 as spine runtimes.
https://github.com/EsotericSoftware/spine-runtimes/tree/3.7
I really appreciate you listening
- badlogic a écrit
You don't need to create a new
spSkeleton
. Just get thespSkeleton
from theSkeletonAnimation
. The property is calledskeleton
, see spine-runtimes/SkeletonRenderer.h at 3.8I called
skeleton
from myskeletonNode
, but the instance variableskeleton
is protected (readonly).
spSkeleton_setSkin(skeletonNode->_skeleton, skin); spSkeleton_setSlotsToSetupPose(skeletonNode->_skeleton);
Any idea?
- Nate a écrit
You use the skin by setting it on the skeleton, this line:
spine-runtimes/main.cpp at 3.8spSkeleton_setSkin(skeleton, skin);
Note you often want to call Skeleton
setSlotsToSetupPose
after changing the skin (see SkeletonsetSkin
).You don't need to add it to the SkeletonData (though you could).
I created
drawable
as my skeletonspSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(myJson, skeletonStr); spSkin* skin = spSkin_create("default"); spSkin_addSkin(skin, spSkeletonData_findSkin(skeletonData, "face")); spSkin_addSkin(skin, spSkeletonData_findSkin(skeletonData, "bottom_short")); spSkeleton* drawable = spSkeleton_create(skeletonData); spSkeleton_setSkin(drawable, skin); spSkeleton_setSlotsToSetupPose(drawable);
But how can I create
SkeletonAnimation
withspSkeleton
object? I need that for myCCNode
properties (as the example said).@interface CharPreviewNode : CCNode { SkeletonAnimation* skeletonNode; }
Thank you, Nate!
- badlogic a écrit
Please post the full stack trace for the exception. My guess is that
spSkeletonData_findSkin()
returnsNULL
, which means the skin couldn't be found.After debug then I realized, there is something wrong in
spSkin_addSkin
function, in this lineentry = spSkin_getAttachments(other); while (entry) { spSkin_setAttachment(self, entry->slotIndex, entry->name, entry->attachment); entry = entry->next; }
while
block is running for a while,entry
perentry
, then after theentry.name
isface1
, then theentry
is NULL and crashed. This is my asset https://drive.google.com/open?id=1CSXknVpcQ2RL8FGi8HVIg9g0Dp6mbtdi Thank you!
filterSekai a écritbadlogic a écritPlease post the full stack trace for the exception. My guess is that
spSkeletonData_findSkin()
returnsNULL
, which means the skin couldn't be found.After debug then I realized, there is something wrong in
spSkin_addSkin
function, in this lineentry = spSkin_getAttachments(other); while (entry) { spSkin_setAttachment(self, entry->slotIndex, entry->name, entry->attachment); entry = entry->next; }
while
block is running for a while,entry
perentry
, then after theentry.name
isface1
, then theentry
is NULL and crashed. This is my asset https://drive.google.com/open?id=1CSXknVpcQ2RL8FGi8HVIg9g0Dp6mbtdi Thank you!Hi @badlogic,
My fault. There are no "base_head" and "base_body" in my json skeleton skin. But I think I still have a question, how to apply
spSkin
object into our skeletonData?spSkin* skin = spSkin_create("default"); spSkin_addSkin(skin, spSkeletonData_findSkin(skeletonData, "face")); spSkin_addSkin(skin, spSkeletonData_findSkin(skeletonData, "bottom_short"));
I created custom
skin
and I read in spine-runtimes/main.cpp at 3.8 but still have no clue how to add into our skeletonData. Tried to look at the example code, but found nothing. Thank you. Hi.
I want to apply some skins into my skeleton in my objective c project, but i got an error in
spSkin_addSkin
.Thread 1: EXC_BAD_ACCESS (code=1, address=0x8)
This is how I created my skeleton
const char *atlasStr = [atlas UTF8String]; spAtlas* myAtlas = spAtlas_createFromFile(atlasStr, 0);
const char *skeletonStr = [skeleton UTF8String]; spSkeletonJson* myJson = spSkeletonJson_create(myAtlas); myJson->scale = 1; spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(myJson, skeletonStr); spSkin* skin = spSkin_create("mix-and-match"); spSkin_addSkin(skin, spSkeletonData_findSkin(skeletonData, "face")); spSkin_addSkin(skin, spSkeletonData_findSkin(skeletonData, "base_head")); spSkin_addSkin(skin, spSkeletonData_findSkin(skeletonData, "base_body")); spSkeleton* drawable = spSkeleton_create(skeletonData); spSkeleton_setSkin(drawable, skin); spSkeleton_setSlotsToSetupPose(drawable); skeletonNode = [SkeletonAnimation skeletonWithData:skeletonData ownsSkeletonData:TRUE];My assets are exported using spine 3.8.59, and I am using runtimes from branch 3.8. Any ideas? Thank you
- Modifié
- badlogic a écrit
This is what I see when loading your skeleton into our spine-cocos2d-objc example project, modifying "SpineboyExample.m":
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.
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");
How to open that asset in spine editor?
- Modifié
badlogic a écritI 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.
- badlogic a écrit
No, if your skeleton has a
default
skin with attachments (and based on your copy & paste it does), then just callingsetSkin:@"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? - badlogic a écrit
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
hasdefault
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? - Modifié
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!
- badlogic a écrit
You haven't told us what the problem is
Forget to mention it :grinteeth:
My problem actually the goblins scene doesn't show up at UIView, only blank white page.
filterSekai a écritbadlogic a écritYou haven't told us what the problem is
Forget to mention it :grinteeth:
My problem actually the goblins scene doesn't show up at
UIView
, only blank white page.
Solved
I solved the problem with manually start the animation:
[[CCDirector sharedDirector] startAnimation];
I have successfully add the scene above
UIView
. But i have another problem, the goblins cannot resize into myUIView
. This is what i did to resize, I setglView.autoresizingMask
but the result is still the sameCCGLView *glView = [CCGLView viewWithFrame:[self.eggView bounds] pixelFormat:kEAGLColorFormatRGB565 // kEAGLColorFormatRGBA8 depthFormat:0 // GL_DEPTH_COMPONENT16_OES ]; glView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.eggView insertSubview:glView atIndex:0];
Any ideas?
Solved by set the scale. Thank you!
- Modifié
Hi, I tried to use cocos2d to load spine assets. Basically, I want to embed CCScene in top of UIView. I found this piece of code
- (void)setupCocos2D { CCGLView *glView = [CCGLView viewWithFrame:[[self view] frame] pixelFormat:kEAGLColorFormatRGB565 // kEAGLColorFormatRGBA8 depthFormat:0 // GL_DEPTH_COMPONENT16_OES ]; glView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.view insertSubview:glView atIndex:0];
[[CCDirector sharedDirector] setView:glView]; CCScene *scene = [GoblinsExample scene]; [[CCDirector sharedDirector] runWithScene:scene]; }After I run, I get this success log in XCode
cocos2d: Cocos2D-ObjC version 3.5.0 cocos2d: compiled with Profiling Support: NO cocos2d: OS version: 12.1 (0x0c010000) cocos2d: 64 bit runtime cocos2d: Multi-threaded rendering: 0 cocos2d: OpenGL Rendering enabled.cocos2d: GL_VENDOR: Apple Inc. cocos2d: GL_RENDERER: Apple Software Renderer cocos2d: GL_VERSION: OpenGL ES 2.0 APPLE-17.0.37 cocos2d: GLSL_VERSION: OpenGL ES GLSL ES 1.00 cocos2d: GL_MAX_TEXTURE_SIZE: 4096 cocos2d: GL_MAX_TEXTURE_UNITS: 8 cocos2d: GL_MAX_SAMPLES: 4 cocos2d: GL supports PVRTC: YES cocos2d: GL supports BGRA8888 textures: YES cocos2d: GL supports NPOT textures: YES cocos2d: GL supports discard_framebuffer: YES cocos2d: GL supports shareable VAO: NO cocos2d: CCGraphicsBufferClass: CCGraphicsBufferGLUnsynchronized cocos2d: CCGraphicsBufferBindingsClass: CCGraphicsBufferBindingsGL cocos2d: CCRenderCommandDrawClass: CCRenderCommandDrawGL 2019-07-29 16:47:21.203056+0700 Ruangguru[72492:4759566] cocos2d: surface size: 750x1624
This log exactly looks like the example project. It also showing
CCDirectorDisplayLink
layer in my view.So my question is, did I miss something here? Any help would be appreciated. Thank you.
Is there any SpriteKit based runtime for Spine that support .png, .json, and .atlas asset files? This runtime https://github.com/maxgribov/Spine does not support that kind of asset sadly.
I know some others http://esotericsoftware.com/spine-runtimes, but it does not support new feature from Spine like Mesh, etc
The only option is to use cocos2d, but it is so hard to integrate with UIKit. Any ideas?