C++ and Lua support for creator alpha0 released

C++ and Lua support for creator alpha0 released
0

#1

What’s C++ and lua support for creator

It includes two parts:

  • First, it is a Cocos Creator plugin that can export scenes generated by Cocos Creator into .ccreator files.
  • Second, it has a reader that can parse .ccreator files. The reader can be used in cocos2d-x c++/lua project.

Download

How to use it

Requirements:

  • cocos2d-x: v3.14+
  • Cocos Creator: 1.4+

Steps to use:

  • download Cocos Creator
  • try the existing project in repo or copy plugin into your Cocos Creator project
  • use the plugin to generate needed files
  • use output of plugin and reader in your cocos2d-x projects

More detail information please refer to ReadMe.

You are appreciated to test it and report any bugs met. Any pull request is appreciated too.

Edit: the repo address changed from https://github.com/cocos2d/creator_to_cocos2dx_cpp to https://github.com/cocos2d/creator_to_cocos2dx to make it clear, because the plugin also supports Lua.


C++ support for Cocos Creator
We need a friendly ENGINE, not a dysfunction EDITOR
C++ support for Cocos Creator
C++ and Lua support for creator alpha1 released
Cocos2d-x v3.15rc0 is released
Cocos Creator new dev tool?
C++ and Lua support for creator 0.2 released
C++ and Lua support for creator v0.3 released
C++ and Lua support for creator v0.3 released
C++ and Lua support for creator v0.4 released
#2

#3

Finally :smiley: This is great news!


#4

Its not exporting the scene (.fire) inside folders and sub folders. First I assumed the plugin is not working and found this problem.


#5

What’s your path of your .fire? Is there any problem if you put it in assets?


#6

My path was …\CocosC\assets\Main\MainScene.fire
…\CocosC\assets\Popups\InfoPopup.fire

If I move to assets it exports fine.


#7

Thanks for the information. I will fix it ASAP. And you can create an issue in the github repo in future.


#8

yaaashua:

  1. I created a scene, exported and loaded correctly, but after … I made a modification in Creator, several modifications, but the exported scene (*.creator ) remained unchanged, like the first time I exported it. I even restarted the application. The scene in CocosCreator displays all the changes, but the exported data remains like the first save, IDK why.

zhangxm: Did you use the plugin to build again?
----> yes, im only using the plugin.

yaaashua:
update: LOL, I even deleted the scenes and still appear in the exported data hahaha. Ill try the alpha0 now

zhangxm: What did you mean? You tried another version?
—> no, I mean I deleted from the cocosCreator the scenes that were creating problems, created a new scene, and after building the data (exporting using the plugin) the new scene was not exported, but the most interesting part is that the scenes that I previously deleted were actually exported by the plugin.
after some moment, seems like the exported data doesnt change, no matter how much you changes the scene.

as I mentioned, I found out how to reproduce this error:

-I just took everything from the example project and put it inside a folder “example”
-I created a new scene. As long as this scene does NOT use any of the contents of the “example” folder, everything is fine, but as soon as I place one sprite into the new scene… build script fails , and data is not exported.


#9

Maybe is related to what @nicardo said, because it happened after moving things into a different folder,


#10

I hope in this new version the prebuild will be by default


#11

@yaaashua yep, it has problem if .fire is in subfolder.
@OscarLeif what did you mean prebuild. It is not cocos2d-x.


#12

Is there any C++ method for instantiate a prefab?


We need a friendly ENGINE, not a dysfunction EDITOR
#13

Currently not, and i am not sure if it is possible. This plugin will support as more features of creator as possible, but can not support all features.


#14

I experience some errors:
using the alpha0 project I created a scene, to use it in C++, after creating a RichText (i think thats the source of problems) and save it, the plugin fails trying to export.
I deleted the scene, since didnt know what from my scene was creating the error, but the error remains. So all I have is the alpha0 example project and is failing.

I check the files difference against the repository, and all I can see is there are some files created from my already deleted scene ( from folders: /ccreator , /json/ , temp/BackupAssets/assets/). I deleted this files hoping that this helps, but no.

(note: everything was in the same folder, I didnt create any subdirectory)

log:
WARNING: RichText support is an experimental feature
ERROR: convert_fire_to_json.py", line 793, in parse_properties
_ self._properties[‘backgroundImage’] = state.sprite_frames[sprite_frame_uuid][‘frameName’]


#15

what I mean is this.
In order to have prebuild we should first setup the projects after we created, because this is not by default, I think changing that can save a lot of time and space in the hard drives.Well of course I don’t really know if changing this is easy or nor, of course I talk for the C++ version of the engine.
I will check if this new version of cocos creator 1.5 is more faster to develop (I receive an email talking about a release of Cocos Creator 1.5 and Cocos2d-x 3.15)


#16

btw: I think label size (dimensions in C++) are missing when exported.


#17

@yaaashua as the readme and log says, RichText is not completed.

They are two different issues, right? I don’t quite understand the issue. Could you please describe it how to reproduce it step by step? Thanks.

Could you please show me the wrong result or show me how to reproduce it?
Thanks.

@OscarLeif i think the engine used in cocos creator is binary by default, i am not sure. But the plugin is for cocos2d-x, could you please ask questions in creator category?


#18

@zhangxm how to reproduce it? Im not exactly sure. All I did was:

  • open the example alpha0 project
  • added a new scene
  • added a layout
  • added 2 buttons and 1 label as children of layout
  • exported and loaded SUCESFULLY to c++
  • added another richtext label,
  • renamed the buttons and labels

—> and at this point… something went wrong and I could NOT export anymore…
—> then I deleted the scene (I didnt clear the scene, I removed the scene.fire) but still I was unable to export. I was screwed up with that project after that point. Script would always send error.


label size (dimensions in C++) are missing when exported

this is how I set up the label:

and this is the result:

  • c++ says that dimensions are ZERO and produces a one row label
  • you can see that if I manually (by code) set the dimensions to the values it should have from CCreator (500,90) the result is correct :slight_smile:


#19

Thanks, i will try to reproduce it first.


#21

Is it possible to have some documentation ??
I struggled last 2 hrs finding out that the hierarchy in cocoscreator is not the same that the nodes in C++

example: button text

  • creator: /button/label
  • C++: /btn. for changing text need to changing from button->SetString ( since Label doesnt exist)

example: button inside scrollview:

  • creator: scrollview/view/content/button
    this is translated into c++ as:
  • C++: scrollview/button

I know documentation is not the priority right now, and all of these diference can be found out by the programmer in a few days >_> but… really, it would be nice to be aware of all these diferences.
tnx