From 3bd195d4ef37a5a0beada6259e76e24b0be7e3d0 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 26 Jun 2014 09:51:32 +0800 Subject: [PATCH 1/2] Add Lua binding for ActionTimeline related and related test cases --- build/cocos2d_tests.xcodeproj/project.pbxproj | 2 + .../lua_cocos2dx_coco_studio_manual.cpp | 152 ++++++ .../CocoStudioActionTimelineTest.lua | 451 ++++++++++++++++++ .../src/CocoStudioTest/CocoStudioTest.lua | 8 + tools/tolua/cocos2dx_studio.ini | 6 +- 5 files changed, 617 insertions(+), 2 deletions(-) create mode 100644 tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 2ea769f34b..896198d4e8 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -58,6 +58,7 @@ 1503FAC418DA8B6C00F6518C /* tp.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB118DA8B6C00F6518C /* tp.lua */; }; 1503FAC518DA8B6C00F6518C /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; 1503FAC618DA8B6C00F6518C /* url.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1503FAB218DA8B6C00F6518C /* url.lua */; }; + 15B0870D195AD52000D6F62B /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; }; 15C64825165F3934007D4F18 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; }; 15C64827165F394E007D4F18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64826165F394E007D4F18 /* QuartzCore.framework */; }; 15C64829165F396B007D4F18 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64828165F396B007D4F18 /* OpenAL.framework */; }; @@ -4321,6 +4322,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 15B0870D195AD52000D6F62B /* ActionTimeline in Resources */, 15E66FC8192D957100C20A52 /* Sprite3DTest in Resources */, 15C90B4418E66C1800D69802 /* mime.lua in Resources */, 15C90B4C18E66C3100D69802 /* url.lua in Resources */, diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.cpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.cpp index 605f157f05..a16eec37f0 100644 --- a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.cpp @@ -405,6 +405,155 @@ static void extendBone(lua_State* L) lua_pop(L, 1); } +int lua_cocos2dx_studio_NodeReader_getInstance(lua_State* L) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(L,1,"ccs.NodeReader",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(L) - 1; + + if (argc == 0) + { + if(!ok) + return 0; + cocostudio::timeline::NodeReader* ret = cocostudio::timeline::NodeReader::getInstance(); + tolua_pushusertype(L,(void*)ret, "ccs.NodeReader"); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getInstance",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 +tolua_lerror: + tolua_error(L,"#ferror in function 'lua_cocos2dx_studio_NodeReader_getInstance'.",&tolua_err); +#endif + return 0; +} + +static void extendNodeReader(lua_State* L) +{ + lua_pushstring(L, "ccs.NodeReader"); + lua_rawget(L, LUA_REGISTRYINDEX); + if (lua_istable(L,-1)) + { + tolua_function(L, "getInstance", lua_cocos2dx_studio_NodeReader_getInstance); + } + lua_pop(L, 1); +} + +int lua_cocos2dx_studio_ActionTimelineCache_getInstance(lua_State* L) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(L,1,"ccs.ActionTimelineCache",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(L) - 1; + + if (argc == 0) + { + if(!ok) + return 0; + cocostudio::timeline::ActionTimelineCache* ret = cocostudio::timeline::ActionTimelineCache::getInstance(); + tolua_pushusertype(L,(void*)ret, "ccs.ActionTimelineCache"); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getInstance",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 +tolua_lerror: + tolua_error(L,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineCache_getInstance'.",&tolua_err); +#endif + return 0; +} + +static void extendActionTimelineCache(lua_State* L) +{ + lua_pushstring(L, "ccs.ActionTimelineCache"); + lua_rawget(L, LUA_REGISTRYINDEX); + if (lua_istable(L,-1)) + { + tolua_function(L, "getInstance", lua_cocos2dx_studio_ActionTimelineCache_getInstance); + } + lua_pop(L, 1); +} + +static int lua_cocos2dx_ActionTimeline_setFrameEventCallFunc(lua_State* L) +{ + if (nullptr == L) + return 0; + + int argc = 0; + cocostudio::timeline::ActionTimeline* self = nullptr; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; + if (!tolua_isusertype(L,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror; +#endif + + self = static_cast(tolua_tousertype(L,1,0)); + +#if COCOS2D_DEBUG >= 1 + if (nullptr == self) { + tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ActionTimeline_setFrameEventCallFunc'\n", NULL); + return 0; + } +#endif + argc = lua_gettop(L) - 1; + + if (1 == argc) + { +#if COCOS2D_DEBUG >= 1 + if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) ) + { + goto tolua_lerror; + } +#endif + + LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0)); + self->setFrameEventCallFunc([=](cocostudio::timeline::Frame* frame){ + toluafix_pushusertype_ccobject(L, frame->_ID, &frame->_luaID, (void*)frame, getLuaTypeName(frame, "ccs.Frame")); + LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 1); + }); + + return 0; + } + + + CCLOG("'setFrameEventCallFunc' function of ActionTimeline has wrong number of arguments: %d, was expecting %d\n", argc, 1); + +#if COCOS2D_DEBUG >= 1 +tolua_lerror: + tolua_error(L,"#ferror in function 'setFrameEventCallFunc'.",&tolua_err); + return 0; +#endif +} + +static void extendActionTimeline(lua_State* L) +{ + lua_pushstring(L, "ccs.ActionTimeline"); + lua_rawget(L, LUA_REGISTRYINDEX); + if (lua_istable(L,-1)) + { + tolua_function(L, "setFrameEventCallFunc", lua_cocos2dx_ActionTimeline_setFrameEventCallFunc); + } + lua_pop(L, 1); +} + + int register_all_cocos2dx_coco_studio_manual(lua_State* L) { if (nullptr == L) @@ -412,6 +561,9 @@ int register_all_cocos2dx_coco_studio_manual(lua_State* L) extendArmatureAnimation(L); extendArmatureDataManager(L); extendBone(L); + extendActionTimelineCache(L); + extendNodeReader(L); + extendActionTimeline(L); return 0; } diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua new file mode 100644 index 0000000000..e3a3d63916 --- /dev/null +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest.lua @@ -0,0 +1,451 @@ +local itemTagBasic = 1000 +local winSize = cc.Director:getInstance():getWinSize() +local scheduler = cc.Director:getInstance():getScheduler() +local TimelineTestIndex = +{ + TEST_ACTION_TIMELINE = 1, + TEST_CHANGE_PLAY_SECTION = 2, + TEST_TIMELINE_FRAME_EVENT = 3, + TEST_TIMELINE_PERFORMACE = 4, +} +local timelineSceneIdx = TimelineTestIndex.TEST_ACTION_TIMELINE + +local TimelineTestScene = class("TimelineTestScene") +TimelineTestScene.__index = TimelineTestScene + +function TimelineTestScene.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TimelineTestScene) + return target +end + +function TimelineTestScene:runThisTest() + timelineSceneIdx = TimelineTestIndex.TEST_ACTION_TIMELINE + self:addChild(restartTimelineTest()) +end + +function TimelineTestScene.create() + local scene = TimelineTestScene.extend(cc.Scene:create()) + local bg = cc.Sprite:create("armature/bg.jpg") + bg:setPosition(VisibleRect:center()) + + local scaleX = VisibleRect:getVisibleRect().width / bg:getContentSize().width + local scaleY = VisibleRect:getVisibleRect().height / bg:getContentSize().height + + bg:setScaleX(scaleX) + bg:setScaleY(scaleY) + + scene:addChild(bg) + return scene +end + +function TimelineTestScene.toMainMenuCallback() + +end + +local TimelineTestLayer = class("TimelineTestLayer") +TimelineTestLayer.__index = TimelineTestLayer +TimelineTestLayer._backItem = nil +TimelineTestLayer._restarItem = nil +TimelineTestLayer._nextItem = nil + +function TimelineTestLayer:onEnter() + +end + +function TimelineTestLayer.title(idx) + if TimelineTestIndex.TEST_ACTION_TIMELINE == idx then + return "CSArmature Test Bed" + elseif TimelineTestIndex.TEST_CHANGE_PLAY_SECTION == idx then + return "Test Change Play Section" + elseif TimelineTestIndex.TEST_TIMELINE_FRAME_EVENT == idx then + return "Test Frame Event" + elseif TimelineTestIndex.TEST_TIMELINE_PERFORMACE == idx then + return "Test ActionTimeline performance" + end +end + +function TimelineTestLayer.subTitle(idx) + if TimelineTestIndex.TEST_ACTION_TIMELINE == idx then + return "" + else + return "" + end +end + +function TimelineTestLayer.create() + local layer = TimelineTestLayer.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +function TimelineTestLayer.backCallback() + local newScene = TimelineTestScene.create() + newScene:addChild(backimelineTest()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TimelineTestLayer.restartCallback() + local newScene = TimelineTestScene.create() + newScene:addChild(restartTimelineTest()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TimelineTestLayer.nextCallback() + local newScene = TimelineTestScene.create() + newScene:addChild(nextTimelineTest()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TimelineTestLayer:createMenu() + local menu = cc.Menu:create() + + self._backItem = cc.MenuItemImage:create(s_pPathB1, s_pPathB2) + self._backItem:registerScriptTapHandler(self.backCallback) + menu:addChild(self._backItem,itemTagBasic) + self._restarItem = cc.MenuItemImage:create(s_pPathR1, s_pPathR2) + self._restarItem:registerScriptTapHandler(self.restartCallback) + menu:addChild(self._restarItem,itemTagBasic) + self._nextItem = cc.MenuItemImage:create(s_pPathF1, s_pPathF2) + menu:addChild(self._nextItem,itemTagBasic) + self._nextItem:registerScriptTapHandler(self.nextCallback) + + local size = cc.Director:getInstance():getWinSize() + self._backItem:setPosition(cc.p(size.width / 2 - self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2)) + self._restarItem:setPosition(cc.p(size.width / 2, self._restarItem:getContentSize().height / 2)) + self._nextItem:setPosition(cc.p(size.width / 2 + self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2)) + + menu:setPosition(cc.p(0, 0)) + + self:addChild(menu) +end + +function TimelineTestLayer.toExtensionMenu() + ccs.ArmatureDataManager:destroyInstance() + local scene = CocoStudioTestMain() + if scene ~= nil then + cc.Director:getInstance():replaceScene(scene) + end +end + +function TimelineTestLayer:createToExtensionMenu() + cc.MenuItemFont:setFontName("Arial") + cc.MenuItemFont:setFontSize(24) + local menuItemFont = cc.MenuItemFont:create("Back") + menuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25)) + menuItemFont:registerScriptTapHandler(TimelineTestLayer.toExtensionMenu) + + local backMenu = cc.Menu:create() + backMenu:addChild(menuItemFont) + backMenu:setPosition(cc.p(0, 0)) + self:addChild(backMenu,10) +end + +function TimelineTestLayer:creatTitleAndSubTitle(idx) + print("set title") + local title = cc.Label:createWithTTF(TimelineTestLayer.title(idx), "fonts/Thonburi.ttf", 18) + title:setColor(cc.c3b(255,0,0)) + self:addChild(title, 1, 10000) + title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30)) + local subTitle = nil + if "" ~= TimelineTestLayer.subTitle(idx) then + local subTitle = cc.Label:createWithTTF(TimelineTestLayer.subTitle(idx), "fonts/Thonburi.ttf", 18) + subTitle:setColor(cc.c3b(0,0,0)) + self:addChild(subTitle, 1, 10001) + subTitle:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 60) ) + end +end + +local TestActionTimeline = class("TestActionTimeline",TimelineTestLayer) +TestActionTimeline.__index = TestActionTimeline + +function TestActionTimeline.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestActionTimeline) + return target +end + +function TestActionTimeline:onEnter() + cc.SpriteFrameCache:getInstance():addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png") + + local node = ccs.NodeReader:getInstance():createNode("ActionTimeline/boy_1.ExportJson") + local action = ccs.ActionTimelineCache:getInstance():createAction("ActionTimeline/boy_1.ExportJson") + + node:runAction(action) + action:gotoFrameAndPlay(0, 60, true) + + node:setScale(0.4) + node:setPosition(0, 0) + + self:addChild(node) +end + +function TestActionTimeline.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTestScene.create() + newScene:addChild(restartTimelineTest()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestActionTimeline.create() + local layer = TestActionTimeline.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +local TestChangePlaySection = class("TestChangePlaySection",TimelineTestLayer) +TestChangePlaySection.__index = TestChangePlaySection + +function TestChangePlaySection.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestChangePlaySection) + return target +end + +function TestChangePlaySection:onEnter() + cc.SpriteFrameCache:getInstance():addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png") + + local node = ccs.NodeReader:getInstance():createNode("ActionTimeline/boy_1.ExportJson") + local action = ccs.ActionTimelineCache:getInstance():createAction("ActionTimeline/boy_1.ExportJson") + + node:runAction(action) + action:gotoFrameAndPlay(70, action:getDuration(), true) + + node:setScale(0.2) + node:setPosition(150, 100) + + local function onTouchesEnded(touches, event) + if action:getStartFrame() == 0 then + action:gotoFrameAndPlay(70, action:getDuration(), true) + else + action:gotoFrameAndPlay(0, 60, true) + end + end + + local listener = cc.EventListenerTouchAllAtOnce:create() + listener:registerScriptHandler(onTouchesEnded,cc.Handler.EVENT_TOUCHES_ENDED ) + + local eventDispatcher = self:getEventDispatcher() + eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self) + + self:addChild(node) +end + +function TestChangePlaySection.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTestScene.create() + newScene:addChild(restartTimelineTest()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestChangePlaySection.create() + local layer = TestChangePlaySection.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +local TestTimelineFrameEvent = class("TestTimelineFrameEvent",TimelineTestLayer) +TestTimelineFrameEvent.__index = TestTimelineFrameEvent + +function TestTimelineFrameEvent.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestTimelineFrameEvent) + return target +end + +function TestTimelineFrameEvent:onEnter() + cc.SpriteFrameCache:getInstance():addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png") + + local node = ccs.NodeReader:getInstance():createNode("ActionTimeline/boy_1.ExportJson") + local action = ccs.ActionTimelineCache:getInstance():createAction("ActionTimeline/boy_1.ExportJson") + + node:runAction(action) + action:gotoFrameAndPlay(0, 60, true) + + node:setScale(0.2) + node:setPosition(150, 100) + self:addChild(node) + + local function onFrameEvent(frame) + if nil == frame then + return + end + + local str = frame:getEvent() + + if str == "changeColor" then + frame:getNode():setColor(cc.c3b(0, 0, 0)) + elseif(str == "endChangeColor") then + frame:getNode():setColor(cc.c3b(255,255,255)) + end + end + + action:setFrameEventCallFunc(onFrameEvent) +end + +function TestTimelineFrameEvent.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTestScene.create() + newScene:addChild(restartTimelineTest()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestTimelineFrameEvent.create() + local layer = TestTimelineFrameEvent.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +local TestTimelinePerformance = class("TestTimelinePerformance",TimelineTestLayer) +TestTimelinePerformance.__index = TestTimelinePerformance + +function TestTimelinePerformance.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestTimelinePerformance) + return target +end + +function TestTimelinePerformance:onEnter() + cc.SpriteFrameCache:getInstance():addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png") + + for i = 1,100 do + local node = ccs.NodeReader:getInstance():createNode("ActionTimeline/boy_1.ExportJson") + local action = ccs.ActionTimelineCache:getInstance():createAction("ActionTimeline/boy_1.ExportJson") + + node:runAction(action) + action:gotoFrameAndPlay(70, action:getDuration(), true) + + node:setScale(0.1) + node:setPosition((i - 1) * 2, 100) + self:addChild(node) + end +end + +function TestTimelinePerformance.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTestScene.create() + newScene:addChild(restartTimelineTest()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestTimelinePerformance.create() + local layer = TestTimelinePerformance.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +local actionlineSceneArr = +{ + TestActionTimeline.create, + TestChangePlaySection.create, + TestTimelineFrameEvent.create, + TestTimelinePerformance.create, +} + +function nextTimelineTest() + timelineSceneIdx = timelineSceneIdx + 1 + timelineSceneIdx = timelineSceneIdx % table.getn(actionlineSceneArr) + if 0 == timelineSceneIdx then + timelineSceneIdx = table.getn(actionlineSceneArr) + end + return actionlineSceneArr[timelineSceneIdx]() +end + +function backTimelineTest() + timelineSceneIdx = timelineSceneIdx - 1 + if timelineSceneIdx <= 0 then + timelineSceneIdx = timelineSceneIdx + table.getn(actionlineSceneArr) + end + + return actionlineSceneArr[timelineSceneIdx]() +end + +function restartTimelineTest() + return actionlineSceneArr[timelineSceneIdx]() +end + +function runCocoStudioActionTimelineTestScene() + local scene = TimelineTestScene.create() + scene:runThisTest() + cc.Director:getInstance():replaceScene(scene) +end diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioTest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioTest.lua index 10e19fe30b..e05b4d4e06 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioTest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioTest.lua @@ -2,6 +2,7 @@ require "src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest" require "src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest" require "src/CocoStudioTest/CocoStudioArmatureTest/CocoStudioArmatureTest" require "src/CocoStudioTest/CocoStudioUIEditorTest/CocoStudioUIEditorTest" +require "src/CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest" local LINE_SPACE = 40 local ITEM_TAG_BASIC = 1000 @@ -35,6 +36,13 @@ local cocoStudioTestItemNames = runCocoStudioUIEditorTestScene() end }, + + { + itemTitle = "CocoStudioActionTimelineTest", + testScene = function() + runCocoStudioActionTimelineTestScene() + end + }, } local CocoStudioTestScene = class("CocoStudioTestScene") diff --git a/tools/tolua/cocos2dx_studio.ini b/tools/tolua/cocos2dx_studio.ini index 9a2b752ce9..6cedc7c62d 100644 --- a/tools/tolua/cocos2dx_studio.ini +++ b/tools/tolua/cocos2dx_studio.ini @@ -30,7 +30,7 @@ headers = %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ ActionManagerEx ComAudio ComController ComAttribute ComRender BatchNode SceneReader GUIReader ActionObject Tween DisplayManager +classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ ActionManagerEx ComAudio ComController ComAttribute ComRender BatchNode SceneReader GUIReader ActionObject Tween DisplayManager NodeReader ActionTimeline.* .*Frame$ Timeline # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -52,7 +52,9 @@ skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .* GUIReader::[storeFileDesignSize getFileDesignSize getParseCallBackMap getParseObjectMap], ActionNode::[initWithDictionary], ActionObject::[initWithDictionary], - BaseData::[copy subtract] + BaseData::[copy subtract], + NodeReader::[getInstance], + ActionTimelineCache::[getInstance] rename_functions = GUIReader::[shareReader=getInstance purgeGUIReader=destroyInstance], ActionManagerEx::[shareManager=getInstance purgeActionManager=destroyInstance], From c767f8a276cf718a371767705385bb2fcdb311bd Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 26 Jun 2014 09:51:56 +0800 Subject: [PATCH 2/2] Update bindings-generator submodule --- tools/bindings-generator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index 5650668bf8..fb64d96c51 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 5650668bf85957250e22a8b097c4162a173d7104 +Subproject commit fb64d96c51450878a20e8ade9d36cc34c341c44f