aoxu

  • 3 janv. 2019
  • Inscrit 19 nov. 2014
    Nate a écrit

    This is fixed in 3.5.08-beta. We also did a number of optimizations to be more efficient with a large number of bones and slots. However, it is somewhat abnormal to have 1400+ bones and 1400+ slots in a single skeleton, so Spine has not been optimized for that and you may see slowness in other areas. It should work well up to 1000 bones, though you may need to turn off auto keying.

    Thank you, it's already very helpful.

  • Pharan a écrit

    Thanks for reporting! Maybe it's a bug or limitation. I haven't seen the code behind it.
    But that's extreme! Why do you have 300 slots? :o

    Spine log looks empty. I guess it wasn't an actual crash.

    Thanks for your reply!
    The 300 slots are used in an spine animation to simulate pixel art, every slot stands for a big pixel square on the screen.
    The spine editor won't crash, it just became no response for about 5 minutes and return normal.


    badlogic a écrit

    I can reproduce this locally using your project file, thanks for that. I've opened an issue on the tracker for it here Editor freezes for a long time when keying 300+ slots · Issue #113 · EsotericSoftware/spine-editor · GitHub

    Thanks! Feel free to ask if there is anything you need.

    • Modifié
  • The spine editor became no response when editing over 300 selected slots. It bothers my team for a long time. I tried the latest version, the problem still exists.
    The spine file is small (75kb), you could get the file in the attachment.

    Reproduction steps:
    1.Open the sample spine file.
    2.Select all slots(over 300) in the skeleton.
    3.Add a key frame.
    4.Click the green key button of Colors on the right panel.
    5.The spine editor became no response for minutes. During this, everything except this window of spine editor is running smoothly, even other windows of spine editor(opened other spine files) are OK.

    • Modifié
  • I tried -90, the bones of dragon are all right, but some bones of King of Skeleton are wrong. I exchanged the rotated region's scaleX and scaleY, and I fixed it. 🙂

  • Nate a écrit

    The rotation looks correct, I expect the translation is off. Are you positioning the CCSprite using both slot->bone->worldX/Y and attachment->x/y?

    Yes, you are right, the rotation is right but the position is wrong. Here is my code for positioning CCSprite:

    float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
    float *vertices = (float*)malloc(sizeof(float) * 10);
    spRegionAttachment_computeWorldVertices(attachment,slot->bone,vertices);
    for (int ii = 0; ii < 8; ii += 2) {
        float x = vertices[ii], y = vertices[ii + 1];
        minX = min(minX, x);
        minY = min(minY, y);
        maxX = max(maxX, x);
        maxY = max(maxY, y);
    }
    CGPoint point = ccp((maxX + minX) *0.5, (maxY + minY) *0.5);
    free(vertices);
    
    point = [_skeleton convertToWorldSpace:point];
    point = [batchNode convertToNodeSpace:point];
    sprite.position = point;
    

    Can you show me some details about positioning of the CCSprite using both slot->bone->worldX/Y and attachment->x/y? I don't know how, thank you.


    The rotation looks correct on above, but the rotation angle of some bones are not right when I test another one.

     Loading Image

    The right is the spine skeleton, which is right.
    The left are the sprites I created from the skeleton, the rotation angle of some bones are still not right, such as the neck, the right hand. I don't know why.

    Thanks!

    • Modifié

    How to set the rotation angle for sprite with a bone at current animation frame? I tried with the code but didn't work. Most of the sprites are all right, but some of them are not the same rotation angle with the bone.

    spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment;
    spAtlasRegion *region = (spAtlasRegion *)attachment->rendererObject;
    CGRect rect = CGRectZero;
    if(region->rotate) {
         rect = CGRectMake(region->x * 0.5, region->y * 0.5, region->height * 0.5, region->width * 0.5);
    }
    else {
         rect = CGRectMake(region->x * 0.5, region->y * 0.5, region->width * 0.5, region->height * 0.5);
    }
    CCSprite *sprite = [CCSprite spriteWithTexture:batchNode.texture rect:rect];
    sprite.rotation = ((region->rotate ? 90 : 0) - attachment->rotation - slot->bone->worldRotation);
    

     Loading Image

    The right is the spine skeleton, which is right.
    The left are the sprites I created from the skeleton, but the rotation angle of some bones are not right, such as the right arm, the right leg. I don't know why.

    Thanks!