How to get studio user data using 3.8 in C++?

I just upgraded from 3.6 to 3.8 and the only issue I have building is with my code to retrieve the user data from a scene node. My old code was like this:

cocostudio::ObjectExtensionData* data = (cocostudio::ObjectExtensionData*)pNode->getUserObject();
std::string d = data->getCustomProperty();

It seems the class ObjectExtensionData and its old header file no longer exist. In visual studio it also seems my objects _userData and _userObject fields are both NULL, so perhaps it’s not even parsed in anymore?

Does anyone know how we’re supposed to read the user data now?
Thanks

They made some changes in this. This is how you get the data now:

#include "cocostudio/CCComExtensionData.h"

ComExtensionData* data = (ComExtensionData*)object->getComponent("ComExtensionData");
CCLOG("%s", data->getCustomProperty().c_str());

Hope it helps.

3 Likes

That looks like it will do the job, thanks!

:smile:

Glad it helps. I am surprised that we have to dig through the source code to find these changes. This change is not even documented in the CHANGELOG.