CocosBuilder Issue

Hi Walzer,

I am very near to port the CocosDragon in Coocs2D-X. However, currently there are three issues in cocosbuilder reader that are slowing me down.
Let me know if I can assist you in producing these issues.

Issues List

1. If a CCLayer read from CCBI then it takes by default the device size
In reality it should read the size from the CCBI file. See the attached image. I set the position of each game object element based upon the percentage of the layer size. Since layer size is going to be different for different for Android and iOS device. It is taking default iPhone screen size. :frowning:
The same CCBI file works fine if I use cocos2d-iphone.

2. While reading customMemberVariable the code is keep on crashing if I don’t let the animation of previous CCScene completed.

For example, in CocosDragon game, if I click on Play button in mainMenuScene while it is animating or even clouds animation is once not completed then code crash while loading the GameScene upon reading the first member variable.
IMO, This gives very bad user experience and required immediate fix.

I have attached the stack trace for the second issue.

bool GameScene::onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode) { *CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "levelLayer", CCLayer *, this->levelLayer); CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "scoreLabel", CCLabelTTF *, this->scoreLabel); * return false; }

BTW, I already checked by interchanging the lines in above code and it is happening while assigning the first member variable. And this issue is reproducible in both 2.0.3 and 2.0.4 versions.

`void CCObject::release(void)
{
CCAssert(m_uReference > 0, “reference count should greater than 0”); +// Code crashes at this point by giving EXC_BAD_ACCESS+
–m_uReference;

if (m_uReference == 0)
{
    delete this;
}

}
`

3. CustomProperty is not supported
It is already reported here by Zilong. http://www.cocos2d-x.org/boards/18/topics/17554
I can manage this by manipulating it in the game code. Though would like to maintain is CCBReader code in future.

Let me know how soon we can solve this or point me right direction to move forward?

Thanks,
Paras

Skype:codesnooker


Issue_1.png (172.1 KB)


Issue_2.png (186.1 KB)


StackTrace_Issue_2.png (596.7 KB)

Hey Walzer and Cocos2D-X team,

Any update on this?

Thanks,
Paras

I think we should update CCBReader to port CocosGragon.
I am updating cocos2d-x to cocos2d-iphone v2.1 beta3.
You are appreciated if you can help to updating CCBReader.

I have solved thousands of problems in cocos2d-x with cocosbuilder

first, there is some problem in animationmanager,if you run your sequence. SO REMEMBER THIS CODE, the pool would not delete the manager::

CCNode **node = ccbReader~~>readNodeGraphFromFile;
animationManager~~>retain;
RETAIN ONCE!

secondly, if you want to getUserObject from CCNOde and animationManager, you need to change the CBBReader::
CCNode** CCBReader::readNodeGraph(CCNode * pParent) {

……

/* 2012-11-19 set animationManager */
node~~>setUserObject;
// Call onNodeLoaded
CCNodeLoaderListener * nodeAsCCNodeLoaderListener = dynamic_cast<CCNodeLoaderListener *>;
if {
nodeAsCCNodeLoaderListener~~>onNodeLoaded(node, ccNodeLoader);
} else if(this~~>mCCNodeLoaderListener != NULL) {
this~~>mCCNodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
}

return node;
}

finally, if you want to use cocosbuilder freely, I suggest you read the SOURCE CODE… it is not very difficult. and you would find that cocosbuilder IS VERY TROUBLE

张 辰 wrote:

I have solved thousands of problems in cocos2d-x with cocosbuilder
>
>
first, there is some problem in animationmanager,if you run your sequence. SO REMEMBER THIS CODE, the pool would not delete the manager::
>
CCNode node = ccbReader~~>readNodeGraphFromFile;
animationManager~~>retain;
>
RETAIN ONCE!
>
>
secondly, if you want to getUserObject from CCNOde and animationManager, you need to change the CBBReader::
CCNode
CCBReader::readNodeGraph(CCNode * pParent) {
>
……
>
/* 2012-11-19 set animationManager */
node~~>setUserObject;
>
// Call onNodeLoaded
CCNodeLoaderListener * nodeAsCCNodeLoaderListener = dynamic_cast<CCNodeLoaderListener *>;
if {
nodeAsCCNodeLoaderListener~~>onNodeLoaded(node, ccNodeLoader);
} else if(this~~>mCCNodeLoaderListener != NULL) {
this~~>mCCNodeLoaderListener~~>onNodeLoaded;
}
>
return node;
}
>
>
>
finally, if you want to use cocosbuilder freely, I suggest you read the SOURCE CODE… it is not very difficult. and you would find that cocosbuilder IS VERY TROUBLE
there is a discussion in the thread http://www.cocos2d-x.org/boards/6/topics/17691?r=18583#message-18583.
you cann’t only set the node~~>setUserObject(this->mActionManager); it will be cleaned by cleanup func. Unfortunately, if set cleanup to false, it turns out memory leak. Hope for engine author’s work.

>

there is a discussion in the thread http://www.cocos2d-x.org/boards/6/topics/17691?r=18583#message-18583.
you cann’t only set the node->setUserObject(this->mActionManager); it will be cleaned by cleanup func. Unfortunately, if set cleanup to false, it turns out memory leak. Hope for engine author’s work.

I think it would be fine. as the post you provided, I just set cleanUpNodeGraph(false) when read node from file.

this function just set node.setUserObject(NULL);

so during initialization process, it would be ok.

since this is the first useful google result for “onAssignCCBMemberVariable crash”, i figured i would throw my input in here for what I’ve found.

If the member variable that you are gluing hasn’t been initialized, the glue macro will try to release whatever junk value is in there, and will crash - about half the time, depending on if the junk value just happens to be NULL or not.

My workaround/solution was to simply initialize all glued member variables to null.

-joe

1 Like

I am kind of agree with you. I almost give up cocosbuilder on cocos2d-x project. I have a lot of trouble with them. I don’t think they are working on the latest release.

张 辰 wrote:

I have solved thousands of problems in cocos2d-x with cocosbuilder
>
>
first, there is some problem in animationmanager,if you run your sequence. SO REMEMBER THIS CODE, the pool would not delete the manager::
>
CCNode node = ccbReader~~>readNodeGraphFromFile;
animationManager~~>retain;
>
RETAIN ONCE!
>
>
secondly, if you want to getUserObject from CCNOde and animationManager, you need to change the CBBReader::
CCNode
CCBReader::readNodeGraph(CCNode * pParent) {
>
……
>
/* 2012-11-19 set animationManager */
node~~>setUserObject;
>
// Call onNodeLoaded
CCNodeLoaderListener * nodeAsCCNodeLoaderListener = dynamic_cast<CCNodeLoaderListener *>;
if {
nodeAsCCNodeLoaderListener~~>onNodeLoaded(node, ccNodeLoader);
} else if(this~~>mCCNodeLoaderListener != NULL) {
this~~>mCCNodeLoaderListener->onNodeLoaded(node, ccNodeLoader);
}
>
return node;
}
>
>
>
finally, if you want to use cocosbuilder freely, I suggest you read the SOURCE CODE… it is not very difficult. and you would find that cocosbuilder IS VERY TROUBLE