TypeError in csd-importer.js

@zhangbin
Hi, as reported in the other thread Some questions about using JavaScript (and Cocos Creator) on iOS I encountered TypeError when trying to import a Cocos Studio project with Cocos Creator 1.2.1-rc1.

TypeError: r is not a function
at /Applications/CocosCreator.app/Contents/Resources/app.asar/editor/builtin/project-importer/core/studio/csd-importer.js:1:20956
at CCLoader.<anonymous> (/Applications/CocosCreator.app/Contents/Resources/engine/cocos2d/core/platform/CCAssetLibrary.js:99:17)
at /Applications/CocosCreator.app/Contents/Resources/engine/cocos2d/core/load-pipeline/CCLoader.js:200:42
at /Applications/CocosCreator.app/Contents/Resources/engine/cocos2d/core/platform/utils.js:38:21
at _combinedTickCallback (internal/process/next_tick.js:67:7)at process._tickCallback (internal/process/next_tick.js:98:9)
at EventEmitter.o (/Applications/CocosCreator.app/Contents/Resources/app.asar/editor/builtin/project-importer/main.js:1:206)at EventEmitter.g (events.js:286:16)
at emitTwo (events.js:106:13)at EventEmitter.emit (events.js:191:7)
at EventEmitter.<anonymous> (/Applications/CocosCreator.app/Contents/Resources/electron.asar/browser/api/web-contents.js:128:18)
at emitTwo (events.js:106:13)at EventEmitter.emit (events.js:191:7)  TypeError: r is not a functionat /Applications/CocosCreator.app/Contents/Resources/app.asar/editor/builtin/project-importer/core/studio/csd-importer.js:1:20956
at CCLoader.<anonymous> (/Applications/CocosCreator.app/Contents/Resources/engine/cocos2d/core/platform/CCAssetLibrary.js:99:17)
at /Applications/CocosCreator.app/Contents/Resources/engine/cocos2d/core/load-pipeline/CCLoader.js:200:42
at /Applications/CocosCreator.app/Contents/Resources/engine/cocos2d/core/platform/utils.js:38:21at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at EventEmitter.o (/Applications/CocosCreator.app/Contents/Resources/app.asar/editor/builtin/project-importer/main.js:1:206)at EventEmitter.g (events.js:286:16)
at emitTwo (events.js:106:13)at EventEmitter.emit (events.js:191:7)
at EventEmitter.<anonymous> (/Applications/CocosCreator.app/Contents/Resources/electron.asar/browser/api/web-contents.js:128:18)
at emitTwo (events.js:106:13)at EventEmitter.emit (events.js:191:7)

Please take a look at the issue, if you need the offending CSD I can send it to you privately.

Could you please send your csd file & related resource files to me? I will try to reproduce the problem & solve it.

By the way, what’s the version of your Cocos Studio? Is it v3.10?

My email : bill.zhang@chukong-inc.com

@zhangbin
Hello, the email sent. The Cocos Studio version is v3.10 for Mac.

Thanks for your test project. I’ve reproduced the problem. I will fix it as soon as possible.

The problem is occurred when using FontResource in a Button.

You can wait Creator 1.3 to solve the problem. Otherwise, you can solve it by remove the FontResource on Buttons.

Thanks for your feedback again.

@zhangbin Thank you, by removing FontResource in a Button do you mean pressing Reset at Properties | Features | Font File at the properties sidebar of the Cocos Studio? It removes the .ttf file and Font File becomes “Drag resource here”. If so, it seems it doesn’t work. Then I did the same to all Labels, not only buttons, but it reached the same error at csd-importer.js (but at the different line csd-importer.js:1:20937).

I’m sorry that it’s not enough to solve the problem by Reset the Font property of Button. You should remove the FontResource config in the csd file by a Text Editor. The changes should be like this:

Thanks, removing FontResource in the csd could make it pass the import process. However, the converted “VipDetailsViewLayer.prefab” has wrong positions/sizes of its elements compared to the original csd. Is there an issue with keeping object positions?

As for your fix for Cocos Creator v1.3, will it make it into the next beta? I’m looking into


I wish these beta were posted in the English forum too.

Yep, the fix will be contained in the next beta version.

I wish these beta were posted in the English forum too.

I’m sorry that the beta versions only posted to the Chinese forum. I’ve feedback the problem.

I will check it later. In fact, for some limitation the importer can’t ensure the whole project is same with before.

I’ve just test the problem. I’m sorry that I can’t solve the problem in the importer. It’s caused by the usage of relative position in Cocos Studio like this:

Because the mechanism of relative position are different between Cocos Studio & Cocos Creator. There isn’t a perfect importer for the relative position. Sorry for the problem.

OK thanks for investigation. As for the relative size, how about converting the relative size of Cocos Studio into the absolute size of Cocos Creator? Does it break anything further if it’s broken already?

It’s works well in most cases. But the conversion arithmetic can’t cover all cases.