Skip to content

How to support a new feature of creator

minggo edited this page Feb 8, 2018 · 2 revisions

Workflow

The workflow of this plugin is as follows:

  • find a xxx.fire in CREATOR_PROJECT_ROOT/assets
  • parse each .fire file and generate the corresponding .json file.
  • invoke flatbuffer executable, flatc, to convert generated .json file to .ccreator (a flatbuffer binary format)
  • modify CreatorReader to parse new generated content

parse new feature in .fire

The steps to parse new feature are:

  • modify Node.guess_type() (core/parser/Node.js), to support a new type of node
  • add a new javascript file in creator-luacpp-support/core/parser to parse new feature (ie core/parser/MyNewElement.js)
  • modify Utils.create_node() (core/parser/Utils.js), to support new type (include the new JS file and add it to the type map)

convert .json to .ccreator

The steps to convert .json to .ccreator are:

  • Modify creator-luacpp-support/CreatorReader.fbs to add a new type for new feature. Should add properties that are needed when creating cocos2d-x node to support new feature. For example, if you want to create a new Sprite, then you may need: texture, blend function and so on.
  • invoke creator-cpp-support/bin/flatc or flatc.exe -c creator-luacpp-support/CreatorReader.fbs to update creator-luacpp-support/reader/CreatorReader_generated.h. This should be done from creator-luapcpp-support/reader to ensure the output CreatorReader_generated.h is in the right folder.
Clone this wiki locally