Cocos2dx 2.2.1 release of skeleton Animation

Source: Internet
Author: User

2.2.1 The release of the skeleton animation is incomplete. You need to change the source code to manually release the animation. The release method cannot be placed in the Destructor and onexit () functions.

Step 1 modify the source code: File Location: extensions/cocostudio/armature/utils/ccdatareaderhelper. cpp;

If (pasyncstruct-> ImagePath! = "" & Pasyncstruct-> plistpath! = "") {Pthread_mutex_lock (& s_getfiledatamutex );
(Delete) ccarmaturedatamanager: sharedarmaturedatamanager ()-> addspriteframefromfile (pasyncstruct-> plistpath. c_str (), pasyncstruct-> ImagePath. c_str ());
(Changed to) ccarmaturedatamanager: sharedarmaturedatamanager ()-> addspriteframefromfile (pasyncstruct-> plistpath. c_str (), pasyncstruct-> ImagePath. c_str (), pdatainfo-> filename. c_str (); pthread_mutex_unlock (& s_getfiledatamutex);} ccdatareaderhelper: adddataasynccallback (float DT) {STD: String configpath = pdatainfo-> configfilequeue. front (); pthread_mutex_lock (& s_getfiledatamutex); (delete) ccarmaturedatamanager: Upload ()-> addspriteframefromfile (pasyncstruct-> basefilepath + configpath + ". plist "). c_str (), (pasyncstruct-> basefilepath + configpath + ". PNG "). c_str (); (changed to) ccarmaturedatamanager: sharedarmaturedatamanager ()-> addspriteframefromfile (pasyncstruct-> basefilepath + configpath + ". plist "). c_str (), (pasyncstruct-> basefilepath + configpath + ". PNG "). c_str (), pdatainfo-> filename. c_str (); pthread_mutex_unlock (& s_getfiledatamutex); pdatainfo-> configfilequeue. pop ();}

Step 2: Call the function to delete the skeleton Animation:

Armature-> removefromparent ();
Ccarmaturedatamanager: sharedarmaturedatamanager ()-& gt; removearmaturefileinfo ("armature/123/123. exportjson ");
Cctexturecache: sharedtexturecache ()-> removealltextures ();

The bone animation is released completely.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.