CocoStudio tutorials?

Hi,

Since the topic is all about CocosStudio. I just want to ask, to be able to use CocosStudio or any other CocosExtensions on Android, all I need to is append cocos_extension_static in LOCAL_WHOLE_STATIC_LIBRARIES right? but when I’m compiling my classes, it gets an error saying CSContentJsonDictionary.h: No such file or directory :frowning:

Any help on this would be so much appreciated.

btw, here’s how i append static libs on my make file.

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

Is it any tutorial or example, to load an animation expoted from cocosStudio as a Json file and load it from Cxode…
I only found some used with Spine… but the method that they use are using an .atlas files… and that don’t works for me, because i’m using cocosStudio
Thanks!

this is a good example.

cocos2d-x/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp

1 Like

@honeboy
Thanks for pointing that out, last time I installed the tests my phone ran out of storage!
Anyway To get at smaller examples from CocoStudio without having so many peripheral files distracting from the core setup?
I’m trying to get DemoGame (https://github.com/chukong/CocoStudioSamples downloaded in 200Mb .zip) running with just 2.2.4, which is pants compared to 3.1.1 so thanks again for any advice.

@kiyall
I’m trying to get DemoGame (https://github.com/chukong/CocoStudioSamples downloaded in 200Mb .zip) running with first 2.2.4, which is pants compared to 3.1.1.

First got errors described here What is NDK_MODULE_PATH??
Second when I add those sym-link-alikes with eclipse I get errors, as if by magic, all over any cpp file the instant I open it in eclipse :frowning:

I’ve just created a really nice skeletal animation with this amazing tool. Now when i go to add a texture I’ve lost the ability to
(a) bind to another bone from the rendering panel
(b) when adding to graphic property of existing bone it cannot be rotated and scaled independently from that bone- it seems a dumb object?

thanks

I know this is an old post but I am totally stumped when trying to use cocos studio. I am running cocos Studio 2.0.6 on a Mac. I saw this link http://upyun.cocimg.com/CocoStudio/helpdoc/v1.0.0.0/en/index.html but when I start Cocos Studio I dont see anything like the start screen mentioned here. Also, I created a simple project i.e just a cocos studio project without the cocos2dx project folder. I cant see any option to export to JSON format. All I see is a publish button. How to play the animation that was created in Cocos Studio. I dont want the animation to play only when the file is loaded. I mean like how in cocos builder we could just call run scene and it would play the animation how many times we wanted. Is there any way to do the same here?

We are working on Cocos Studio tutorials, planning will finish next week and the series will start next week as well. You can see the list of planned lessons using the link below.

Feel free to contribute your opinions and use the link below to see updates on the series.

http://www.sonarlearning.co.uk/questions.php?question-topic=40

1 Like

Our written Cocos Studio tutorials are finished and the video version has begun, see links below.

Written guide - http://cocos.sonarlearning.co.uk/v1.0/docs/what-is-cocos-studio
Video tutorials - http://www.sonarlearning.co.uk/coursepage.php?topic=game&course=cocos-studio

If you have any questions feel free to post them on our education platform http://www.sonarlearning.co.uk/questions.php

4 Likes

Hi,
But these are quite primitive , how about you guys do some videos on animation ,eh?
It would be nice to see some of them.

We will be getting onto that, we are having issues with recording Cocos Studio tutorials ATM.

But we will soon have more tutorials.

Ok …ok…just know people are waiting!!

We know :smiley:

After hours of trial and error, reading posts, and hacking around, I finally got a Cocos Studio 2.x sprite sheet animation to work. I am posting my results here for posterity and hope it helps others.

High level steps in Cocos Studio

  1. File->New Project->Empty Resource Project
  2. Highlight MainScene.csd in Resources box at bottom left of the screen. Then go to File->Close MainScene.csd
  3. Right click on MainScene.csd again in bottom window and choose Delete.
  4. Right click on CocosProject then select New File. Choose Node and New.
  5. Right click on Node.csd and Import Resources. Select all of your files in bulk.
  6. Right click on CocosProject then select New File. Choose Sprite Sheet and New.
  7. Highlight all of your images and drag them to Plist.csi window
  8. Select Node.csd window at the top of the screen.
  9. Highlight all of your images again, right click and chose Create Sprite Sheet Animation.
  10. File->Save All, then Project->Publish and OK.

If you did this right you should have Node.csb, Plist.plist, and Plist.png in the CocosProject\res folder. Copy them to your project. Add this code to run the animation. You can tweak it as needed.

       
#include "cocostudio/CocoStudio.h"
: : :
auto node = CSLoader::createNode("Node.csd");
addChild(node);
auto spritecache = SpriteFrameCache::getInstance();
spritecache->addSpriteFramesWithFile("Plist.plist");
auto sprite = Sprite::createWithSpriteFrameName("Find YourPic.png in Plist.plist. Just put YourPic.png here.");
node->setPosition(Vec2(Director::getInstance()->getWinSize().width*.5, Director::getInstance()->getWinSize().height*.6));
node->setScaleX(Director::getInstance()->getWinSize().width/sprite->getContentSize().width*.9);
node->setScaleY(Director::getInstance()->getWinSize().width/sprite->getContentSize().width*.9);
node->setLocalZOrder(4);
auto timeline = CSLoader::createTimeline("Node.csd");
node->runAction(timeline);
timeline->gotoFrameAndPlay(0,false);
auto cleanup = CallFunc::create([node](){CleanupAnimation(node);});
auto delay=DelayTime::create(8.0f);
runAction(Sequence::create(delay,cleanup,(char*)NULL));
: : :
void CleanupAnimation(cocos2d::Node* node) {
    node->removeFromParentAndCleanup(true);
}

2 Likes

We have over 20 videos on Cocos studio with more coming daily :smiley:

http://www.sonarlearning.co.uk/coursepage.php?topic=game&course=cocos-studio

1 Like

Since I had much trouble with the whole process of workflow and exporting, importing, displaying, I will present my solution here as well.

I use: Windows 7, Cocos Studio 2.3.2, Cocos2dx 3.8.1

  1. Use Cocos Studio to create an animation.
    (like this: http://www.sonarlearning.co.uk/coursepage.php?topic=game&course=cocos-studio&videoindex=6477#6477)

  2. Export it. How? Within Cocos Studio, click of Project -> Publish and Package.
    The settings should be fine by default. Just remember the publish directory.
    The default is:
    Publish Content = Resource and Project File
    Data Format = csb File

Click OK. Set “Publish Type” to “Publish Resource”. Click OK. Now within the publish directory there should be 3 new files. *.csb, *.plist, *.png For the sake of this explanation let’s say their names are animation.csb, warrior.plist, warrior.png.

  1. Copy the published files into your resource folder of your cocos2dx project. Let’s say, into MyCocosProject/Resources/MyAnimation.

  2. Within your Cocos2dx code we have to let Cocos know the location of the files. Just creating a node with “MyAnimation/animation.csb” is not enough, since it won’t find the .png and .plist files otherwise. I use parts of cyberstarboy’s code (which helped me a lot) and give you my Header and Source file.

Header “Animation.h”

#ifndef __ANIMATION_H__
#define __ANIMATION_H__

#include "cocos2d.h"

class AnimationScene : public cocos2d::Layer
{
public:
	static cocos2d::Scene* createScene();

	virtual bool init();
	
	CREATE_FUNC(AnimationScene);
};

#endif // __ANIMATION_H__

Source “Animation.cpp”

#include "Animation.h"
#include "editor-support/cocostudio/CocoStudio.h"

USING_NS_CC;

Scene* AnimationScene::createScene()
{
	// 'scene' is an autorelease object
	auto scene = Scene::createWithPhysics();
	
	// 'layer' is an autorelease object
	auto layer = AnimationScene::create();

	// add layer as a child to scene
	scene->addChild(layer);

	// return the scene
	return scene;
}

// on "init" you need to initialize your instance
bool AnimationScene::init()
{
	//////////////////////////////
	// 1. super init first
	if ( !Layer::init() )
	{
		return false;
	}

	// get screen info
	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();

	// adjust the search path
	FileUtils::getInstance()->addSearchPath("Animation");

	// create and place the node
	std::string filename = "Animation/animation.csb";
	Node* node = CSLoader::createNode(filename);
	node->setPosition(Point(
		origin.x + visibleSize.width / 2,
		origin.y + visibleSize.height / 2));

	// create the animation and add it to the node
	cocostudio::timeline::ActionTimeline* action = 
		CSLoader::createTimeline(filename);
	node->runAction(action);

	// start the animation (and enable loop)
	action->gotoFrameAndPlay(0, true);

	this->addChild(node);

	return true;
}

Of course, adjusting the search path could also be done in AppDelegate.

I hope this helps some people who are struggling as I was.
@SonarSystems If you could make a tutorial with exaclty this workflow that might be something really helpful.

1 Like

Thanks for sharing

Greetings all. I recently installed Cocos with the 3.8.1 framework on Mac. I fired up Cocos Studio 2 to experiment with creating 3D scenes in C++. The Editor is extremely limited on what it can do with tying in your XCode project changes. It seems all I can do is place objects, cameras and effects into a scene. There is an Animation editor but it hardly integrates with the sample 3D models that I downloaded from the store. For example I cannot select the right hand to add an Axe to the Orc model (as shown in the programmers guide). Or manipulate any bones. I cannot see more than a default animation… I cannot add behavior or assign game logic from within the editor. I have to search and parse for game objects from inside XCode unless I load them from code but then I have to play the simulation inside XCode. Nobody has really explained how 3D models are 1st created with/without animations then converted to Cocos using the FBX tools. Is there better way to use these tools for C++ and 3D? I’ve had great experiences using Unity and Unreal 4. Even Torque 3D. Thanks.

Take a look at the Programmers Guide: http://cocos2d-x.org/programmersguide/9/index.html

Note my comment follows the Programmers guide.