apple

  • 25 mai 2017
  • Inscrit 19 mai 2015
  • Hello,

    All binary (.skel) files were throwing errors. so I changed back to 3.5.


    error was related to path constraints. My bad i didn't took the screenshots. I can post some thing in few hours about errors.

  • Yes you are right, sadly I spent some time to upgrade to 3.6 beta but I am getting errors. So is it possible if you can patch the master branch code for this error? Your efforts in this regard will be much appreciated! thanks.

  • if I upgrade to 3.6 beta runtimes, will it work with Spine 3.5.51?

  • spine-cocos2dx runtime version 2.5 is the latest version on the master branch and I am using that one. Can you please test the tint functioning at your end please?

    I already have updated code to the latest commit you made on 20th dec 2016.

    Thanks

  • Hi,

    Spine-c and spine-cocos2dx run time v2.5
    cocos2dx 3.15
    spine editor 3.5.51

    we are using API provided by you guys and not that is shipped with cocos2dx it self.

    thanks

  • Hi Nate,

    in cocos2dx tint is not working. I am trying to color my skeleton but it does not take effects on it self.
    Here is the code

    spinner= spine::SkeletonAnimation::createWithData(_skeletonDataIcon, false);
    spinner->getSkeleton()->r=1.0f;
    spinner->getSkeleton()->g=1.0f;
    spinner->getSkeleton()->b=0.0f;
    spinner->getSkeleton()->a=1.0f;
    
    

    original color is white and skeleton never turn yellow. Also we don't key color in Spine Animation in editor. We will really appreciate if you can help us out. 🙂

    Thanks

    • Modifié
  • Hello All,

    I am trying to make a button out of spine Skeleton animation in cocos2dx. Its a simple, flat animation, that repeats over and over again. Here what I am doing

    spAtlas* _atlasIcon;
    spAttachmentLoader* _attachmentLoaderIcon;
    spSkeletonData* _skeletonDataIcon;
    spAnimationStateData* _stateDataIcon;
    
    
    _atlasIcon=spAtlas_createFromFile("icon.atlas", 0);
    _attachmentLoaderIcon=(spAttachmentLoader*)Cocos2dAttachmentLoader_create(_atlasIcon);
    spSkeletonJson* jsonIcon= spSkeletonJson_createWithLoader(_attachmentLoaderIcon);
    jsonIcon->scale = 1.0f;
    _skeletonDataIcon=spSkeletonJson_readSkeletonDataFile(jsonIcon, "icon.json");
    spSkeletonJson_dispose(jsonIcon);
    _stateDataIcon=spAnimationStateData_create(_skeletonDataIcon);
    
    auto spinner= spine::SkeletonAnimation::createWithData(_skeletonDataIcon, false);
    spinner->addAnimation(0, "animation", true);
    spinner->setPosition(Vec2(visibleSize.width/2, visibleSize.height/2));
    spinner->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
    this->addChild(spinner, 100);
    
    auto listenerSpinner = cocos2d::EventListenerTouchOneByOne::create();
    listenerSpinner->setSwallowTouches(true);
    
    listenerSpinner->onTouchBegan = [&, spinner](cocos2d::Touch* touch, cocos2d::Event* event)
    {
      
         auto target = static_cast<spine::SkeletonAnimation*>(event->getCurrentTarget());
         Point locationInNode = target->convertToNodeSpace(touch->getLocation());
        
        auto s = target->getBoundingBox();
        Rect rect = Rect(0,0, s.size.width, s.size.height);
         if (rect.containsPoint(locationInNode))
        {
            log("spinner began... x = %f, y = %f", locationInNode.x, locationInNode.y);
            // do something here
            return true;  // consume touch for button
        }
        
        return false;
        
        
    };
    
    listenerSpinner->onTouchEnded = [=](cocos2d::Touch* touch, cocos2d::Event* event)
    {
        log("spinner touch ended");
    };
    
    _eventDispatcher->addEventListenerWithSceneGraphPriority(listenerSpinner, spinner);

    the issue with this code is that it only consume touch at top right corner of the skeleton animation and not on the center and other corners. I cant understand what could be the issue, its has something to do with world transform or something but I just cant figure out what it is, having tried every thing. We still need to test bounding box made from the editor. I have also tested it by getting the spRegionAttachment* of the main image, but result are same. Please help/guide us to get the correct touch position.

    thanks


    Hello ALL,

    So I was able to fix this problem/issue by using bounding box made in editor on skeleton.
    here is the touch detection code. Enjoy!

    spinner= spine::SkeletonAnimation::createWithData(_skeletonDataIcon, false);
    spinner->addAnimation(0, "animation", true);
    spinner->setPosition(Vec2(visibleSize.width/2, visibleSize.height /2));
    spinner->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
    this->addChild(spinner, 100);

    auto spinnerBound = spSkeletonBounds_create();
    
    auto listenerSpinner = cocos2d::EventListenerTouchOneByOne::create();
    listenerSpinner->setSwallowTouches(true);
    
    listenerSpinner->onTouchBegan = [&, spinnerBound](cocos2d::Touch* touch, cocos2d::Event* event)
    {
       
        spSkeletonBounds_update(spinnerBound, spinner->getSkeleton(), true);
        auto target = event->getCurrentTarget();
        Vec2 locationInNode = target->convertToNodeSpace(touch->getLocation());
        if (spSkeletonBounds_containsPoint(spinnerBound, locationInNode.x, locationInNode.y))
        {
          return true; // consume touch
        }
        
        return false;
        
        
    };
    
    listenerSpinner->onTouchEnded = [&, spinnerBound](cocos2d::Touch* touch, cocos2d::Event* event)
    {
        log("spinner touch ended");
        
        spSkeletonBounds_update(spinnerBound, spinner->getSkeleton(), true);
        auto target = event->getCurrentTarget();
        Vec2 locationInNode = target->convertToNodeSpace(touch->getLocation());
        if (spSkeletonBounds_containsPoint(spinnerBound, locationInNode.x, locationInNode.y))
        {
            log("spinner began... x = %f, y = %f", locationInNode.x, locationInNode.y);
    
        // do some thing
       }
    
    };
    
    _eventDispatcher->addEventListenerWithSceneGraphPriority(listenerSpinner, spinner);
    • Modifié
  • Hello ,

    Thanks gents for replying. I have been working on it all night, so I have figured out the issue and corrected and it was a mistake on our part.

    In scene1 before calling
    auto director = Director::getInstance();
    director->replaceScene(Scene);

    I was calling
    this->getEventDispatcher()->removeAllEventListeners();

    Calling removeAllEventListeners(); before replaceScene in a scene that has spine animations cause extreme memory leaks. I did not knew about it. Now we are removing event listeners by name and every thing works fine.

    Just out of interest: why do calling removeAllEventListeners(); cause memory leak?

    Thanks

  • Hello all,
    Our game has loads of spine animations and they are causing sever memory leaks and game crashes like in 5 secs (memory goes up to 1.5 gb (ram usage on iphone 6s Plus device and same happens on android)). We are using Cocos2dx 3.10 - 3.14.1, and we checked it with API provided by esoteric software and not that is shipped by cocos2dx it self. I am patching your example code right now, cocos2dx is taking loads of time to download using your commands.

    The way we are using your API is by just replacing the files you have provided with the old file that is shipped with cocos2dx. We used file from spine-c/spine-c (both src and include) and spine-cocos2dx/src/spine. All animations works fantastic except for memory leak issue.

    But People Using API Shipped with cocos2dx are facing same issue as well. I have checked with them on cocos2dx forum.

    Scenario

    We have 2 scenes. Our game starts at scene1, scene1 has loads of spine animation and scene2 currently don't have any animation. When we arrive at scene1 game works fine with no memory leak. When we go to scene2 still no memory leak happens. When we go back from scene2 to scene1 than all animations are loaded again and it now that memory leaks occurs. We are implementing the animations as you guys are doing it in BatchingExample in cocos2dx example. Like making skeletondata and than using that skeletondata in SkeletonAnimation* and when replacing scene we dispose everything (atlas, sekeloton data and etc as you guys are doing) in destructor method of the scene1. Even when copying your code still memory leak occur.

    Also some files cause memory leak even without scene replacing. These file are big in .json and .png. Meaning they have loads of animations and spine character is big.

    But I have also tested with binary data file and issue is same.

    Also please explain me what is the purpose of scheduleUpdate(); and why it is being used in every example.

    We have professional spine license and will really appreciate if you guys can help us.

    thanks


    sorry sever is severe,
    and we are using "spine":"3.5.46" to export related file.

    • Modifié
  • Hi,

    I am new to spine animations. I have successfully created an animation sequence but the issue is, once the sequence is over its stops. How do we make it to work endlessly. Like start over again from 1st animation after the last animation.

    Thanks