C++ and Lua support for creator alpha0 released

Hi,

  1. i am trying out this plugin for my project that is imported from .ccs
    However, after ‘exporting’, i only get the image files and but it does not generate the .ccreator files

  2. i am testing out the example project that comes with the git repo.
    first time opening the project has no issues, and i am also able to export.
    But after closing the project and trying to open it the 2nd time, the ‘Node Tree’ window is stuck with this ‘Loading…’ forever. And when i double click on any of the scenes, i also get this ‘Loading…’ forever.

Anyone else experiencing this same issue?
I’m using the latest cocos creator version.

@yaaashua I asked my colleague about the documentation.
@Darren_86 About issue 1, i think it is because there are some error happened. Is there any log?
About issue 2, i think it is an bug of creator. @jare @pandamicro any idea?

@zhangxm the only log i see is this:
preview server running at http://localhost:7456
1.4.2
ScaleX != ScaleY. Don’t know which one to return

which is shown when the project is opened.
Anyway, this issue is not a concern for my project as we are going to have a new UI… just considering if we should migrate to cocos creator.

Just to confirm, the cocos studio will no longer be usable after the flatbuffer upgrade in cocos2d-x 3.15 is that correct?

1 Like

If I create an empty node as child of a sprite,
. . . and I add a collider component to that child.

In C++ i dont even see the child of the sprite :confused:

how can I get the collider info in C++?
Is it even supported (or will it be) ?

Currently, convert_file_to_json.py parse uuid files from temp folder or assets folder. It is not enough, because many informations should get from creator. So i am working to rewrite it in the plugin, which means i will rewrite it in js and use creator’s API. First, i will make it work correctly with current examples, then i will add missing features.

PS: the original implementation is done by ricardo. It is done as a hack way, it parses .fire and use other meta files (the meta files in temp folder) to get filepath. What i have done currently is making it as a creator plugin. But i found i have to rewrite convert_file_to_json.py in plugin or it can not work correctly. For example, the files in temp folder may change, that’s why i found sometimes the plugin can not work without any modification.

2 Likes

Sorry you should not popup or close the Scene panel. We will improve it in next version.

Progress of rewriting convert_file_to_json.py in plugin:

  • CreatorSprites scene can work correctly

things left:

  • other scenes can work
  • copy resources based on parsing result instead of copy assets folder and temp/internal folder

Hi!

im trying to export a creator scene to android, just for testing, and I can see a lot of warnings like this:
D/cocos2d-x debug info: cocos2d: fullPathForFilename: No file found at creator/image\default_radio_button_on.png. Possible missing file.

The missing files are always from the (auto-generated) folder “creator/image”. I just noticed the path of the file says "creator/image \ BACKSLASH maybe thats a simple mistake when exporting the path or something.

and also I have a crash :weary: : (useful log):

  • Assert failed: spriteFrame can’t be nullptr!
  • Could not allocate Scale9Sprite() spriteFrameName = default_progressbar
  • [Edit text] content size = (50.000000, 24.000000)
  • com.Company.game2 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 6455 (GLThread 19574)

And I guess the reason is this: (UIEditBox line 154)

  • since the line : _backgroundSprite = Scale9Sprite::createWithSpriteFrameName(pNormal9SpriteBg);
    will fail (because of wrong path, as i mentioned before in this post).
    … _backgroundSprite is assigned NULLPTR
  • and then… in line _backgroundSprite->setPosition … well… this will crash

I hope this helps.

@yaaashua thanks for the information. I will fix these issues after the rewriting. And these issues may be fixed after rewriting.

when a button is exported to c++ its not exported with (pressed) and (hover) functionality or sprites
mmm… wait…

  • is it even supported by buttons in C++? will it be in next versions?
  • if yes … could u please tell me how to set it?

Yep, c++ supports pressed if you mean showing pressed image when clicking a button.
@owen Does cocos2d-x Button supports hover?

I was epxerimenting, and:
c++ has: button::loadTextures(normal, pressed, disabled)
meanwhile creator has (normal, hover, pressed, disabled)

and anyways… if u set the images from creator, after using the plugin u only have in c++ the (normal) sprite. Not hover, not pressed, not disabled
I tried to search from this values directly from flatbuffers to see if I can retrieve it, but im not familiar with it.
Im just wondering If this will be fixed or I should create a workaround for it.

@yaaashua it is a bug. I will fix it after rewriting. Thank you for the report. Current rewriting progress:

  • Sprites work
  • Labels work
2 Likes

Gents (and Ladies),

I’ve been tackling the setup of the LuaCpp exporter/Cocos Creator for 1/2 a day so far, and it’s not worked for me yet.

I have cocos2d-x 3.15 and Cocos Creator 1.4.2

  • create a new project with Cocos Creator in C:\Temp\myprojectcc
  • close Cocos Creator
  • clone https://github.com/cocos2d/creator_to_cocos2dx.git
  • copy creator-luacpp-support directory to C:\Temp\myprojectcc\packages directory
  • in command prompt, create a new cocos2d-x project in C:\Temp\myproject2dx with the command cocos new -l cpp -d C:\Temp\myproject2dx MyProject
  • start up Cocos Creator again
  • in Cocos Creator, go to Procect->LuaCpp Support->Set Up Target Project and enter/select C:\Temp\myproject2dx for the Project Path
  • press the ‘Build’ button

Under C:\Temp\myproject2dx\Resources there is a creator directory with one subdirectory called Textures and nothing else
Under C:\Temp\myproject2dx\Classes\reader there are the c++ files for the Cocos Creator reader files

Nowhere are the .ccreator files being created

If, after entering the Project Path in Cocos Creator, I go to Project->Build and then press the build button, I still have the same results (I’m not sure if doing that is mean to hook into the LuaCpp plugin or not)

Warning: directories with spaces in them (like your user name for example) are not liked at all by the cocos_lua_cpp plugin or Apache Ant. I got around this by creating symbolic links without spaces.

@kerfufflemonkeygames yep, currently version has some bugs, so i am rewriting convert_fire_to_json.py as i mentioned above. All work have done except the animation. I will finish it in one or two days. I will let you know when i finish it and may ask you to try again. Thanks in advance.

@yaaashua the pressed and disabled issue was fixed in my rewriting. I may finish it soon.

1 Like

Hi @jare , will you be rolling out the fix soon?

@kerfufflemonkeygames @yaaashua i finish the rewriting. Could you please try again? Thanks.

1 Like
  • Exported buttons now have properly the graphics n_n
  • (I ll test tomorrow probably the android crash)

notes: I opened the scene, selected all items from ASSETS and deleted them, and I got 2 log errors ( idk if its relevant or not)

msg1 :
[db-task][delete] Failed to delete imported assets of 56104385-ec6f-414f-9058-bb59031a1285 during clearImports, message: Error: EPERM: operation not permitted, scandir ‘C:\MyFolder\creator_project\library\imports\56’
at Error (native)

msg 2:
Task [save-editor-mode:[scene]] run error, stop running other tasks.
Error: ipc timeout. message: scene:save-scene, session: 2@renderer:2012
at t.Error (native)
at new t (C:\CocosCreator\resources\app.asar\editor-framework\lib\share\ipc.js:1:1667)
at C:\CocosCreator\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:404

note 2:
I created the scene for testing buttons… and then I renamed it
and now i get exported twice the scene (the old name and the new name, I haven’t tried if it keeps the data of the old one)

About msg1 and msg2, i think it is the issue of creator itself. @jare any idea?
About note 2, @jare does the old scene will be removed in assets folder?

everything from the assets folder gets deleted, but this scene is created again (with old name)
I just checked and this “old scene” contains old info, like the scene was before getting renamed.