creator_to_cocos2dx
creator_to_cocos2dx copied to clipboard
Adds partial ui::Layout support
This adds in a Layout and uses the background color from the editor, sort of how it worked in Cocos Studio. The background color use is inconsistent but I'm not sure why, and it doesn't it support the padding/margin and layout options.
You've got to use layout->setBackGroundColorType(cocos2d::ui::Layout::BackGroundColorType::NONE)
when it doesn't hide the background properly.
This PR was enough to get my 3.10 Cocos Studio project going.
The python file was removed before I made this PR so it could be pruned I think. Hasn't been updated in years until it was recently removed.
Right, convert_fire_to_json.py
is useless for the latest plugin, you can remove it.
I would have but I can't change the file via GH haha. Should be deleted now though!
The default Layout Component is created with a Sprite Component, when I try to do a test for this feature, I found it didn't support background image only background color, see:
Another issue, after remove the default Sprite in Layout, the plugin script will crash when export.
@drelaptop I've never used a sprite background for a layout or removed a sprite as a child of a layout (didn't even realize that was possible), but I'll take a look into that and see what needs to be done. Thanks for checking this.
@drelaptop So I've got three test cases, a layout whose sprite's spriteframe is empty, a layout whose spriteframe is disabled, and a layout with an enabled sprite with a custom sprite.
I can't reproduce the crash you're seeing but I can see that the sprite isn't being applied to the layout, I can implement some sort of cheat where it leaves the parsed sprite and puts data onto the Layout buffer and sets it that way.
I'll throw the sample layouts into the Scenes folder of the repo that way so there could be some test case like the rest of the assets. I've got them on a personal repo for now since it's got a logo from my own game. Feel free take a look
I'm stepping away for about a week for Easter but I'll take a look afterwards.