Cocos Studio 2 Feedback

@makalele I have already installed successfully cocos2d-x from this file http://www.cocos2d-x.org/filedown/cocos2d-x-3.4.zip but the Studio have the same error.
Installing the framework from the store all works fine.
Thanks.

guys,
I just tried 3.4 final stable and ndk-r10c.
I used cocos studio 2.1 and make a “MainScene.csb”
I added these codes:

auto node = CSLoader::createNode("res/MainScene.csb");
this->addChild(node, 1);

I added library:

#include “cocostudio\CocoStudio.h”
USING_NS_CC;
using namespace cocostudio;

I used VS2013 Update 4.
I used Win8.1-Universal project files.
It gave me these error:

Any clues?
Anyone ever experience this?

Edited 01:
I just used win8-xaml project file on 3.4
The win phone emulator exits when enter this file.
I used cocos studio 2.1 to export/publish scene I made in there.
The link: http://www.cocos2d-x.org/filedown/CocosForWin-v2.1.exe
I used csb, binary option…
Please help me.

No problem, I already found the solution.
I used this code:

FileUtils::getInstance()->addSearchPath(“res”); <---- this one
auto node = CSLoader::createNode(“res/MainScene.csb”);
this->addChild(node, 1);

Thank you @makalele for the codes.

I saw his code in this thread:

Import Scene From CocoStudio into code

And one more thing.
In VS2013 Update 4, you don’t need to add Images and Folder manually.
Just put “res” folder in “Resources” and reopen the win8-xaml project file.
No need to set MainScene.csb to “Content” and “Always Copy”. It is set automatically.

This is the result:

Uhm… is there any guides to make armature???
Can I use cocos studio 2.1 to create armature or I have to use cocos studio 1.6 to make it and import it in version 2.1???

Currently, create it in 1.6 and import it into 2.1

Ty @nite
I will try it.

uhm…
I just got a new way guys…
Animation in cocos studio 2.1

  1. Click (+) sign in Resources panel, choose Add New Fie
  2. Choose Node (don’t Layer)
  3. Select all images with interval 5-10 frames (up to you).
  4. Save Node.csd and close it.
  5. Drag Node.csd into MainScene.csd
  6. The Node.csd will have settings to play/stop.
  7. Choose type of Node to: LoopAction
  8. Input the name of your animation u made in Node.csd

After published, to animate the node.csb, you have to use this code:

FileUtils::getInstance()->addSearchPath("res");
auto node = CSLoader::createNode("res/MainScene.csb");
this->addChild(node, 1);
auto action = CSLoader::createTimeline("res/Node.csb"); <--- this one
node->runAction(action);
action->gotoFrameAndPlay(0, true);

That blue sun is animated sequence images I rendered from Maya Dynamics 2015.

Uhm… I can’t build armature from this node.
I think I really need cocos studio 1.6 to make it.

1 Like

So I created I Layer(MainScene.csd) in Cocos Studio and added a sprite with animation to it. Then I created another Layer(bee_1) with another animation and this file (csd) to the first layer. Now the name of this added .csd file is bee_1 and the sprite in this file is called “Sprite_2”. Now when I load the file MainScene.csb and call the following code, both the animations start playing.

auto rootNode = CSLoader::createNode("MainScene.csb");
addChild(rootNode);
cocostudio::timeline::ActionTimeline *timeline = CSLoader::createTimeline("MainScene.csb");
rootNode->runAction(timeline);
timeline->gotoFrameAndPlay(0, true);

I want to be able to control each of these animations individually. To control the animation in file bee_1 i tried the following:

auto bee = rootNode->getChildByName("bee_1")->getChildByName("Sprite_2");
auto beeAnim = dynamic_cast<ActionTimeline*>(shark->getActionByTag(shark->getTag()));
beeAnim->pause();

but it crashes since beeAnim is NULL. How do I control the animation individually? I am using cocos studio 2.0.6 and cocos2dx 3.3.

Does this action exists? shark->getActionByTag(shark->getTag())
beeAnim is NULL cause the getActionByTag returns a NULL pointer and so the dynamic_cast.

That’s my point - I don’t know how to reference the sprite animation that’s in the second file. How do I do that? The snippet I posted above was something I saw in the cocos studio example on GitHub.

You have to create the bee timeline by loading your csb file:

cocostudio::timeline::ActionTimeline *timeline = CSLoader::createTimeline("bee_1.csb");

As your bee layer is a child of your main layer, it will be also played, if the main timeline is played. Just don’t add the bee animation to the main layer.

Then how do they do it here:

  _rootNode = CSLoader::createNode("BattleScene.csb");
    auto shark = _rootNode->getChildByName("ProjectNode_Battle")->getChildByName("ProjectNode_Boss");
    auto tentacle = _rootNode->getChildByName("ProjectNode_Battle")->getChildByName("ProjectNode_Monster");
    auto sharkAnim = dynamic_cast<ActionTimeline*>(shark->getActionByTag(shark->getTag()));
    auto tentacleAnim = dynamic_cast<ActionTimeline*>(tentacle->getActionByTag(tentacle->getTag()));
    sharkAnim->pause();
    tentacleAnim->pause();

I just tried to do the same thing.

[SOLVED]
Anyone know why I can’t login in Cocos Studio 2.1?


Tried many times. And never works.
I tried signing up but it is useless.
It is just the same

I want to download the samples.
No problem it is solved in version 2.1.2 beta.

They get the child nodes and pause their animation, so they won’t play right from the start,

auto bee = rootNode->getChildByName("bee_1")->getChildByName("Sprite_2");
auto beeAnim = dynamic_cast<ActionTimeline*>(shark->getActionByTag(shark->getTag()));
beeAnim->pause();

You are getting a NULL pointer, cause there is no action in shark with the appropriate tag.

The bee animation is not in the shark node, but the bee node:

auto bee = rootNode->getChildByName("bee_1")->getChildByName("Sprite_2");
auto beeAnim = dynamic_cast<ActionTimeline*>(bee ->getActionByTag(bee ->getTag()));
beeAnim->pause();

To make sure you are calling the correct nodes, please provide the CS file.

I have uploaded the CS project here:

Are you trying different things, or why do you animate the sprite directly(bee), as a node(bee_2) and as a layer(bee_1)?

To load the bee_1 node itself you have to get it:

auto bee = rootNode->getChildByName("bee_1")->getChildByName("Sprite_2");

after that you have to get the timeline and apply it:

auto beeAnim = dynamic_cast<ActionTimeline*>(bee->getActionByTag(bee->getTag()));
beeAnim->pause();

Unfortunately, the tag of your action is not the same tag as your spritenode. If you open the “Bee1.csd” file, you will see this:

<Timeline ActionTag="-787482470" FrameType="TextureFrame" Property="FileData">

<NodeObjectData Name="Sprite_2" ActionTag="-787482470" FrameEvent="" Tag="1305" PrePositionEnabled="True" ObjectIndex="2" ctype="SpriteObjectData">

Did you ever set that number? Maybe it’s a bug with/in CS.
Try changing the ActionTag in both occurrences to 1305, cause this is the tag of your sprite node.

After that, the calls above should get the correct action for your node.

If you don’t want to change it, you would need to hand over the value of -787482470 as action tag:

auto beeAnim = dynamic_cast<ActionTimeline*>(bee->getActionByTag(-787482470);
beeAnim->pause();

What i was trying to achieve was in file have multiple animations - for eg 4-5 different trees in the background that need to animate at different time - its essentially the same animation but multiple copies placed at different places - the reason I was trying to do it from in the same file is so that the artist can directly place it at the required positions without me having to write the code for the position. I cant see anywhere in Cocos Studio to set a tag to the animation and frankly I never opened the file to see what was written in it. Does this happen with your version of Cocos Studio too?

You only need to create one animation with the bee. A node having a sprite as child, which is animated.

You cannot change it in the UI, only directly in the file.
Yes it happens in my version(2.1.2Beta) too. The ActionTag was generated as ActionTag=“1708631640”.

But as I posted earlier, just create the timeline created in your child csb file:

cocostudio::timeline::ActionTimeline *timeline = CSLoader::createTimeline("bee_1.csb");

You can also make different animations in your node. The file will reference the timelines directly and you don’t have to care about the values of the action tags:

<Animation Duration="10" Speed="1.0000" ActivedAnimationName="animation0">
  <Timeline ActionTag="1708631640" Property="Position">
    <PointFrame FrameIndex="0" X="-450.4528" Y="-109.5446" />
    <PointFrame FrameIndex="10" X="-134.0883" Y="-16.8167" />
  </Timeline>
  <Timeline ActionTag="1708631640" Property="Scale">
    <ScaleFrame FrameIndex="0" X="1.0000" Y="1.0000" />
    <ScaleFrame FrameIndex="10" X="1.0000" Y="1.0000" />
  </Timeline>
  <Timeline ActionTag="1708631640" Property="RotationSkew">
    <ScaleFrame FrameIndex="0" X="0.0000" Y="0.0000" />
    <ScaleFrame FrameIndex="10" X="0.0000" Y="0.0000" />
  </Timeline>
</Animation>

It will reference to the animation, selected in the UI. This way can create different animations for your asset in one timeline and play them through frame indexing.

Thanks for the help :smile: ! Will try your approach and see what works best!

auto beeAnim = dynamic_cast&lt;ActionTimeline*&gt;(bee-&gt;getActionByTag(-787482470);
beeAnim-&gt;pause();

So I just tried this and beeAnim is still NULL. Did it work properly at your end?