[Solved] Cocostudio: percentage positions and sizes issue

Hi, just want to experiment with cocostudio (currently still using cocosbuilder :smile:)
Downloaded version 2.3.3 with framework version 3.9.

Can’t understand am i doing all correct:
Created simple layer (size 100x100) with one panel.

Using next code to add it on the screen twice:

...
{
auto testItem = CSLoader::createNode("Item.csb");
testItem->setPosition(0, 0);
testItem->setContentSize(Size(200, 200));
ui::Helper::doLayout(testItem);
addChild(testItem);
}
{
auto testItem = CSLoader::createNode("Item.csb");
testItem->setPosition(200, 200);
testItem->setContentSize(Size(200, 200));
ui::Helper::doLayout(testItem);
addChild(testItem);
}
...

it works as intended with next properties:

  • anchor point - zero, position - zero, size = 100%

Looks okay - first on the most left bottom corner, next with offset 200/200.

Now if i change position of panel to 10%… nothing changes… First panel still located in the corner.

If i change size to (50%, 100%) - them will disappear at all.
If i change size to (150%, 100%) them will appear at 100% width as on screenshot above.
If i change size to (250%, 100%) them will appear at 200% width.

P.S. Using OS X 10.11.2

After some debugging i found that in method

void WidgetReader::setLayoutComponentPropsWithFlatBuffers
    ....
    float sizeXPercent = layoutComponentTable->sizeXPercent();
    float sizeYPercent = layoutComponentTable->sizeYPercent();

sizeXPercent = 2.0; (when in cocostudio was set 250%)
sizeYPercent = 1.0; (when in cocostudio was set 100%)

If in cocostudio setup size < 100% then sizeXPercent will be zero;

The same thing for position percentages…

Is it issue of cocostudio 2.3.3 or cocos2d-x 3.9 itself?
What combination should be used on mac to get reliable functionality?

Have anybody else experienced this issue?

If use springs and pins instead of percentages - almost all work as intended… in some configurations.

If use pins for both sides and spring - all works well. If use pin for one side and spring - panels disappear (have zero size).

This one works well, and panels resized and positioned as intended:

This one doesn’t work, panels just disappear:

P.S. I would be glad to submit this issue via Cocos app, but i always get an error when trying to do that…

Also noticed weird behavior for MainScene that created when starting new project in cocostudio:

if run this project without any modifications - “HelloWorld” sprite will appear as intended;
but if publish this project - and run again - sprite will have anchor point (0, 0) at runtime instead of (0.5, 0.5) that is specified in cocostudio.
So there is possibly some issue with Cocostudio for mac, as default scene bundled with new project parsed and presented by cocos2d-x successfully.

After checking binary data of bundled MainScene.csb and published one - them have differences in some values and total length.

What system language do you use? I see you have “,” delimiter. So do I. And there’s a bug when you use it. I had to change system language to english and then I had “.” as a delimiter.

edit:
check out this topic:

WOW! Thanks, that was the reason. I really used other system language. I think it should be documented somewhere.

This is a bug,. Next version we will fix it.