diff --git a/AUTHORS b/AUTHORS index ef6f07c885..45233db0bf 100644 --- a/AUTHORS +++ b/AUTHORS @@ -752,7 +752,9 @@ Developers: hanjukim Fixed a bug that color and opacity settings were not applied when invoking Label::alignText. - + Fixed the bug that FileUtils:getStringFromFile() may return a unterminated string + Skip BOM in DataReaderHelper::addDataFromJsonCache() + bagobor Fixed a memory leak in AssetsManager::uncompress. Code format fix and small optimizations in cocostudio/CCActionNode.cpp. @@ -892,6 +894,9 @@ Developers: kyokomi Fix the bug that UIButton doesn't support TTF font Fix a but of TextReader + + gin0606 + Add a new line at the end of a file Retired Core Developers: WenSheng Yang diff --git a/CHANGELOG b/CHANGELOG index d2379f89ee..ee80bc100a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ cocos2d-x-3.2 ??? [NEW] Node: added getName(), setName(), getChildByName(), enumerateChildren() + [NEW] Label: support setting line height and additional kerning of label that not using system font + [FIX] FileUtils: getStringFromFile may return a unterminated string [FIX] UIButton: doesn't support TTF font cocos2d-x-3.2-alpha0 Jun.17 2014 diff --git a/CMakeLists.txt b/CMakeLists.txt index fd1ccfbf39..7db3ea143c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,8 @@ endif() if(MINGW) add_definitions(-DGLEW_STATIC) add_definitions(-D__SSIZE_T) + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lws2_32") + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32") endif() diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 173495fdae..6e14825c29 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -40,6 +40,28 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 0634A4D0194B19E400E608AF /* CCActionTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C5194B19E400E608AF /* CCActionTimeline.cpp */; }; + 0634A4D1194B19E400E608AF /* CCActionTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C5194B19E400E608AF /* CCActionTimeline.cpp */; }; + 0634A4D2194B19E400E608AF /* CCActionTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4C6194B19E400E608AF /* CCActionTimeline.h */; }; + 0634A4D3194B19E400E608AF /* CCActionTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4C6194B19E400E608AF /* CCActionTimeline.h */; }; + 0634A4D4194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C7194B19E400E608AF /* CCActionTimelineCache.cpp */; }; + 0634A4D5194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C7194B19E400E608AF /* CCActionTimelineCache.cpp */; }; + 0634A4D6194B19E400E608AF /* CCActionTimelineCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4C8194B19E400E608AF /* CCActionTimelineCache.h */; }; + 0634A4D7194B19E400E608AF /* CCActionTimelineCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4C8194B19E400E608AF /* CCActionTimelineCache.h */; }; + 0634A4D8194B19E400E608AF /* CCFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C9194B19E400E608AF /* CCFrame.cpp */; }; + 0634A4D9194B19E400E608AF /* CCFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C9194B19E400E608AF /* CCFrame.cpp */; }; + 0634A4DA194B19E400E608AF /* CCFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CA194B19E400E608AF /* CCFrame.h */; }; + 0634A4DB194B19E400E608AF /* CCFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CA194B19E400E608AF /* CCFrame.h */; }; + 0634A4DC194B19E400E608AF /* CCNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4CB194B19E400E608AF /* CCNodeReader.cpp */; }; + 0634A4DD194B19E400E608AF /* CCNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4CB194B19E400E608AF /* CCNodeReader.cpp */; }; + 0634A4DE194B19E400E608AF /* CCNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CC194B19E400E608AF /* CCNodeReader.h */; }; + 0634A4DF194B19E400E608AF /* CCNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CC194B19E400E608AF /* CCNodeReader.h */; }; + 0634A4E0194B19E400E608AF /* CCTimeLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4CD194B19E400E608AF /* CCTimeLine.cpp */; }; + 0634A4E1194B19E400E608AF /* CCTimeLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4CD194B19E400E608AF /* CCTimeLine.cpp */; }; + 0634A4E2194B19E400E608AF /* CCTimeLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CE194B19E400E608AF /* CCTimeLine.h */; }; + 0634A4E3194B19E400E608AF /* CCTimeLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CE194B19E400E608AF /* CCTimeLine.h */; }; + 0634A4E4194B19E400E608AF /* CCTimelineMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CF194B19E400E608AF /* CCTimelineMacro.h */; }; + 0634A4E5194B19E400E608AF /* CCTimelineMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CF194B19E400E608AF /* CCTimelineMacro.h */; }; 06CAAAC5186AD7E50012A414 /* TriggerObj.h in Headers */ = {isa = PBXBuildFile; fileRef = 06CAAAC1186AD63B0012A414 /* TriggerObj.h */; }; 06CAAAC6186AD7E60012A414 /* TriggerObj.h in Headers */ = {isa = PBXBuildFile; fileRef = 06CAAAC1186AD63B0012A414 /* TriggerObj.h */; }; 06CAAAC7186AD7E90012A414 /* TriggerObj.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 06CAAAC0186AD63B0012A414 /* TriggerObj.cpp */; }; @@ -1887,6 +1909,17 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 0634A4C5194B19E400E608AF /* CCActionTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCActionTimeline.cpp; sourceTree = ""; }; + 0634A4C6194B19E400E608AF /* CCActionTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCActionTimeline.h; sourceTree = ""; }; + 0634A4C7194B19E400E608AF /* CCActionTimelineCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCActionTimelineCache.cpp; sourceTree = ""; }; + 0634A4C8194B19E400E608AF /* CCActionTimelineCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCActionTimelineCache.h; sourceTree = ""; }; + 0634A4C9194B19E400E608AF /* CCFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCFrame.cpp; sourceTree = ""; }; + 0634A4CA194B19E400E608AF /* CCFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCFrame.h; sourceTree = ""; }; + 0634A4CB194B19E400E608AF /* CCNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCNodeReader.cpp; sourceTree = ""; }; + 0634A4CC194B19E400E608AF /* CCNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNodeReader.h; sourceTree = ""; }; + 0634A4CD194B19E400E608AF /* CCTimeLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTimeLine.cpp; sourceTree = ""; }; + 0634A4CE194B19E400E608AF /* CCTimeLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTimeLine.h; sourceTree = ""; }; + 0634A4CF194B19E400E608AF /* CCTimelineMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTimelineMacro.h; sourceTree = ""; }; 06CAAABC186AD63B0012A414 /* TriggerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TriggerBase.cpp; sourceTree = ""; }; 06CAAABD186AD63B0012A414 /* TriggerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriggerBase.h; sourceTree = ""; }; 06CAAABE186AD63B0012A414 /* TriggerMng.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TriggerMng.cpp; sourceTree = ""; }; @@ -2934,6 +2967,24 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 0634A4C4194B19E400E608AF /* ActionTimeline */ = { + isa = PBXGroup; + children = ( + 0634A4C5194B19E400E608AF /* CCActionTimeline.cpp */, + 0634A4C6194B19E400E608AF /* CCActionTimeline.h */, + 0634A4C7194B19E400E608AF /* CCActionTimelineCache.cpp */, + 0634A4C8194B19E400E608AF /* CCActionTimelineCache.h */, + 0634A4C9194B19E400E608AF /* CCFrame.cpp */, + 0634A4CA194B19E400E608AF /* CCFrame.h */, + 0634A4CB194B19E400E608AF /* CCNodeReader.cpp */, + 0634A4CC194B19E400E608AF /* CCNodeReader.h */, + 0634A4CD194B19E400E608AF /* CCTimeLine.cpp */, + 0634A4CE194B19E400E608AF /* CCTimeLine.h */, + 0634A4CF194B19E400E608AF /* CCTimelineMacro.h */, + ); + path = ActionTimeline; + sourceTree = ""; + }; 1551A334158F2AB200E66CFE = { isa = PBXGroup; children = ( @@ -3590,6 +3641,7 @@ 1A8C5946180E930E00EF57C3 /* cocostudio */ = { isa = PBXGroup; children = ( + 0634A4C4194B19E400E608AF /* ActionTimeline */, 50FCEB6818C72017004AD434 /* WidgetReader */, 06CAAAC1186AD63B0012A414 /* TriggerObj.h */, 06CAAABC186AD63B0012A414 /* TriggerBase.cpp */, @@ -4916,6 +4968,7 @@ 50ABBE731925AB6F00A911A9 /* CCEventListenerMouse.h in Headers */, 1A570063180BC5A10088DEC7 /* CCAction.h in Headers */, 1A570067180BC5A10088DEC7 /* CCActionCamera.h in Headers */, + 0634A4DA194B19E400E608AF /* CCFrame.h in Headers */, 1A57006B180BC5A10088DEC7 /* CCActionCatmullRom.h in Headers */, 1A57006F180BC5A10088DEC7 /* CCActionEase.h in Headers */, 1A570073180BC5A10088DEC7 /* CCActionGrid.h in Headers */, @@ -5020,6 +5073,7 @@ 1A570294180BCCAB0088DEC7 /* CCAnimation.h in Headers */, 50ABBD421925AB0000A911A9 /* CCMathBase.h in Headers */, 1A570298180BCCAB0088DEC7 /* CCAnimationCache.h in Headers */, + 0634A4DE194B19E400E608AF /* CCNodeReader.h in Headers */, 50FCEB9D18C72017004AD434 /* ImageViewReader.h in Headers */, B29594C81926D61F003EEF37 /* CCObjLoader.h in Headers */, 50ABBE911925AB6F00A911A9 /* CCPlatformMacros.h in Headers */, @@ -5080,6 +5134,7 @@ 1AD71DCF180E26E600808F54 /* CCControlLoader.h in Headers */, 50ABBE7B1925AB6F00A911A9 /* CCEventMouse.h in Headers */, 1AD71DD3180E26E600808F54 /* CCLabelBMFontLoader.h in Headers */, + 0634A4D6194B19E400E608AF /* CCActionTimelineCache.h in Headers */, 1AD71DD7180E26E600808F54 /* CCLabelTTFLoader.h in Headers */, 1AD71DDB180E26E600808F54 /* CCLayerColorLoader.h in Headers */, 503DD8F91926B0DB00CD74DD /* CCIMEDispatcher.h in Headers */, @@ -5148,6 +5203,7 @@ 50ABBE3F1925AB6F00A911A9 /* CCDataVisitor.h in Headers */, 1AD71EDF180E26E600808F54 /* Slot.h in Headers */, 1AD71EE3180E26E600808F54 /* SlotData.h in Headers */, + 0634A4E2194B19E400E608AF /* CCTimeLine.h in Headers */, 1AD71EE7180E26E600808F54 /* spine-cocos2dx.h in Headers */, 1AD71EE9180E26E600808F54 /* spine.h in Headers */, 1AAF536C180E3374000584C8 /* HttpClient.h in Headers */, @@ -5179,6 +5235,7 @@ 50ABBE371925AB6F00A911A9 /* CCConsole.h in Headers */, 1A8C59A1180E930E00EF57C3 /* CCArmature.h in Headers */, 1A8C59A5180E930E00EF57C3 /* CCArmatureAnimation.h in Headers */, + 0634A4D2194B19E400E608AF /* CCActionTimeline.h in Headers */, 1A8C59A9180E930E00EF57C3 /* CCArmatureDataManager.h in Headers */, 50ABC00B1926664800A911A9 /* CCDevice.h in Headers */, 2905FA7A18CF08D100240AA3 /* UISlider.h in Headers */, @@ -5217,6 +5274,7 @@ 50ABBD951925AB4100A911A9 /* CCGLProgramState.h in Headers */, 1A8C59F1180E930E00EF57C3 /* CCSpriteFrameCacheHelper.h in Headers */, 1A8C59F5180E930E00EF57C3 /* CCSSceneReader.h in Headers */, + 0634A4E4194B19E400E608AF /* CCTimelineMacro.h in Headers */, 1A8C59F9180E930E00EF57C3 /* CCTransformHelp.h in Headers */, 1A8C59FD180E930E00EF57C3 /* CCTween.h in Headers */, 1A8C5A05180E930E00EF57C3 /* CCUtilMath.h in Headers */, @@ -5380,6 +5438,7 @@ 2AC795EA1862875D005EC8E1 /* BoundingBoxAttachment.h in Headers */, 503DD8F01926736A00CD74DD /* CCStdC.h in Headers */, 46A170FF1807CECB005B8026 /* CCPhysicsContact.h in Headers */, + 0634A4D3194B19E400E608AF /* CCActionTimeline.h in Headers */, 50ABBDA21925AB4100A911A9 /* CCGroupCommand.h in Headers */, 503DD8EF1926736A00CD74DD /* CCPlatformDefine.h in Headers */, 46A171041807CECB005B8026 /* CCPhysicsShape.h in Headers */, @@ -5392,6 +5451,7 @@ 46A170FD1807CECB005B8026 /* CCPhysicsBody.h in Headers */, 2905FA6118CF08D100240AA3 /* UILayoutParameter.h in Headers */, B29594C51926D61F003EEF37 /* CCMesh.h in Headers */, + 0634A4DB194B19E400E608AF /* CCFrame.h in Headers */, 50ABBE9C1925AB6F00A911A9 /* CCRef.h in Headers */, 50ABBD961925AB4100A911A9 /* CCGLProgramState.h in Headers */, 46A171061807CECB005B8026 /* CCPhysicsWorld.h in Headers */, @@ -5403,6 +5463,7 @@ 50ABBEC21925AB6F00A911A9 /* CCValue.h in Headers */, 2905FA5518CF08D100240AA3 /* UIImageView.h in Headers */, 50ABBECA1925AB6F00A911A9 /* firePngData.h in Headers */, + 0634A4E3194B19E400E608AF /* CCTimeLine.h in Headers */, 50ABBE401925AB6F00A911A9 /* CCDataVisitor.h in Headers */, 1A570064180BC5A10088DEC7 /* CCAction.h in Headers */, 06CAAACE186AD7FA0012A414 /* TriggerBase.h in Headers */, @@ -5460,6 +5521,7 @@ 1A57011E180BC90D0088DEC7 /* CCGrabber.h in Headers */, 1A570122180BC90D0088DEC7 /* CCGrid.h in Headers */, 50FCEBBA18C72017004AD434 /* TextAtlasReader.h in Headers */, + 0634A4D7194B19E400E608AF /* CCActionTimelineCache.h in Headers */, 5034CA2E191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */, 50ABBD5B1925AB0000A911A9 /* Vec2.h in Headers */, 50ABBD411925AB0000A911A9 /* CCMath.h in Headers */, @@ -5543,6 +5605,7 @@ 50ABBE2A1925AB6F00A911A9 /* CCAutoreleasePool.h in Headers */, 1A57030F180BCF190088DEC7 /* CCComponent.h in Headers */, 1A570313180BCF190088DEC7 /* CCComponentContainer.h in Headers */, + 0634A4DF194B19E400E608AF /* CCNodeReader.h in Headers */, 1A087AEB1860400400196EF5 /* edtaa3func.h in Headers */, 2905FA6518CF08D100240AA3 /* UIListView.h in Headers */, 50FCEBAA18C72017004AD434 /* LoadingBarReader.h in Headers */, @@ -5664,6 +5727,7 @@ 1A9DCA2A180E6955007A3AD4 /* CCGLBufferedNode.h in Headers */, 1A01C69F18F57BE800EFE3A6 /* CCString.h in Headers */, 1A01C69118F57BE800EFE3A6 /* CCDictionary.h in Headers */, + 0634A4E5194B19E400E608AF /* CCTimelineMacro.h in Headers */, 1A8C598E180E930E00EF57C3 /* CCActionFrame.h in Headers */, 1A8C5992180E930E00EF57C3 /* CCActionFrameEasing.h in Headers */, 5034CA36191D591100CE6051 /* ccShader_PositionTexture.frag in Headers */, @@ -6100,6 +6164,7 @@ 1A01C6A418F58F7500EFE3A6 /* CCNotificationCenter.cpp in Sources */, 46A170EA1807CECA005B8026 /* CCPhysicsJoint.cpp in Sources */, 5027253C190BF1B900AAF4ED /* cocos2d.cpp in Sources */, + 0634A4D4194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */, 50ABC0611926664800A911A9 /* CCCommon.mm in Sources */, 50ABBDB11925AB4100A911A9 /* ccShaders.cpp in Sources */, 46A170EF1807CECA005B8026 /* CCPhysicsWorld.cpp in Sources */, @@ -6218,6 +6283,7 @@ 1A5702EE180BCE750088DEC7 /* CCTMXLayer.cpp in Sources */, 50ABBE691925AB6F00A911A9 /* CCEventListenerFocus.cpp in Sources */, 1A5702F2180BCE750088DEC7 /* CCTMXObjectGroup.cpp in Sources */, + 0634A4DC194B19E400E608AF /* CCNodeReader.cpp in Sources */, 1A5702F6180BCE750088DEC7 /* CCTMXTiledMap.cpp in Sources */, 1A5702FA180BCE750088DEC7 /* CCTMXXMLParser.cpp in Sources */, 50ABBD5C1925AB0000A911A9 /* Vec3.cpp in Sources */, @@ -6306,6 +6372,7 @@ 1AD71EE5180E26E600808F54 /* spine-cocos2dx.cpp in Sources */, 1AAF536A180E3374000584C8 /* HttpClient.cpp in Sources */, 50ABC0631926664800A911A9 /* CCDevice.mm in Sources */, + 0634A4E0194B19E400E608AF /* CCTimeLine.cpp in Sources */, 1AAF5372180E3374000584C8 /* SocketIO.cpp in Sources */, 50ABBE1F1925AB6F00A911A9 /* atitc.cpp in Sources */, 1AAF5376180E3374000584C8 /* WebSocket.cpp in Sources */, @@ -6348,6 +6415,7 @@ 2905FA7C18CF08D100240AA3 /* UIText.cpp in Sources */, 50FCEB9F18C72017004AD434 /* LayoutReader.cpp in Sources */, 50ABC0211926664800A911A9 /* CCGLView.cpp in Sources */, + 0634A4D8194B19E400E608AF /* CCFrame.cpp in Sources */, 1A8C59C7180E930E00EF57C3 /* CCComRender.cpp in Sources */, 50ABC00D1926664800A911A9 /* CCFileUtils.cpp in Sources */, 1A8C59CB180E930E00EF57C3 /* CCDataReaderHelper.cpp in Sources */, @@ -6362,6 +6430,7 @@ 1A8C59D7180E930E00EF57C3 /* CCDisplayFactory.cpp in Sources */, 50ABBD601925AB0000A911A9 /* Vec4.cpp in Sources */, 1A8C59DB180E930E00EF57C3 /* CCDisplayManager.cpp in Sources */, + 0634A4D0194B19E400E608AF /* CCActionTimeline.cpp in Sources */, 2905FA6218CF08D100240AA3 /* UIListView.cpp in Sources */, 1A8C59DF180E930E00EF57C3 /* CCInputDelegate.cpp in Sources */, 1A8C59E3180E930E00EF57C3 /* CCProcessBase.cpp in Sources */, @@ -6556,6 +6625,7 @@ 3EA0FB6C191C841D00B170C8 /* UIVideoPlayerIOS.mm in Sources */, 1A570062180BC5A10088DEC7 /* CCAction.cpp in Sources */, 1A570066180BC5A10088DEC7 /* CCActionCamera.cpp in Sources */, + 0634A4D9194B19E400E608AF /* CCFrame.cpp in Sources */, 1A57006A180BC5A10088DEC7 /* CCActionCatmullRom.cpp in Sources */, 1A57006E180BC5A10088DEC7 /* CCActionEase.cpp in Sources */, 50ABBD8C1925AB4100A911A9 /* CCGLProgram.cpp in Sources */, @@ -6564,6 +6634,7 @@ B37510811823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */, 2905FA8D18CF08D100240AA3 /* UIWidget.cpp in Sources */, B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */, + 0634A4D5194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */, 50ABBE7E1925AB6F00A911A9 /* CCEventTouch.cpp in Sources */, 50FCEB9818C72017004AD434 /* CheckBoxReader.cpp in Sources */, 50ABBE6E1925AB6F00A911A9 /* CCEventListenerKeyboard.cpp in Sources */, @@ -6623,6 +6694,7 @@ 50ABBD9C1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */, 1A5701E7180BCB8C0088DEC7 /* CCTransition.cpp in Sources */, 50ABC01E1926664800A911A9 /* CCThread.cpp in Sources */, + 0634A4D1194B19E400E608AF /* CCActionTimeline.cpp in Sources */, 1A5701EB180BCB8C0088DEC7 /* CCTransitionPageTurn.cpp in Sources */, 1A5701EF180BCB8C0088DEC7 /* CCTransitionProgress.cpp in Sources */, 1A5701F8180BCBAD0088DEC7 /* CCMenu.cpp in Sources */, @@ -6680,6 +6752,7 @@ 50ABBDB61925AB4100A911A9 /* CCTexture2D.cpp in Sources */, 1A570355180BD0B00088DEC7 /* ioapi.cpp in Sources */, 1A570359180BD0B00088DEC7 /* unzip.cpp in Sources */, + 0634A4E1194B19E400E608AF /* CCTimeLine.cpp in Sources */, 1AD71DAA180E26E600808F54 /* CCBAnimationManager.cpp in Sources */, 50ABBD881925AB4100A911A9 /* CCCustomCommand.cpp in Sources */, 50ABBE941925AB6F00A911A9 /* CCProfiling.cpp in Sources */, @@ -6826,6 +6899,7 @@ 2905FA7518CF08D100240AA3 /* UIScrollView.cpp in Sources */, 1A8C5A0E180E930E00EF57C3 /* DictionaryHelper.cpp in Sources */, 1ABA68AF1888D700007D1BB4 /* CCFontCharMap.cpp in Sources */, + 0634A4DD194B19E400E608AF /* CCNodeReader.cpp in Sources */, 50ABBE7A1925AB6F00A911A9 /* CCEventMouse.cpp in Sources */, 50ABBD981925AB4100A911A9 /* CCGLProgramStateCache.cpp in Sources */, B6B26344193884D60088FE25 /* CCAnimation3D.cpp in Sources */, diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 856c5e741d..7b1632cc59 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -804,6 +804,10 @@ 29080DE4191B595E0066F8DF /* UIWidgetAddNodeTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D89191B595E0066F8DF /* UIWidgetAddNodeTest.cpp */; }; 29080DE5191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; }; 29080DE6191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; }; + 38FA2E73194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */; }; + 38FA2E74194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */; }; + 38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; }; + 38FA2E77194AECF800FF2BE4 /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; }; 3E92EA821921A1400094CD21 /* Sprite3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */; }; 3E92EA831921A1400094CD21 /* Sprite3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */; }; 3E92EA851921A7720094CD21 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; }; @@ -1840,6 +1844,9 @@ 29080D8A191B595E0066F8DF /* UIWidgetAddNodeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest.h; sourceTree = ""; }; 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidgetAddNodeTest_Editor.cpp; sourceTree = ""; }; 29080D8C191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest_Editor.h; sourceTree = ""; }; + 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionTimelineTestScene.cpp; sourceTree = ""; }; + 38FA2E72194AEBE100FF2BE4 /* ActionTimelineTestScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionTimelineTestScene.h; sourceTree = ""; }; + 38FA2E75194AECF800FF2BE4 /* ActionTimeline */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ActionTimeline; path = "../tests/cpp-tests/Resources/ActionTimeline"; sourceTree = ""; }; 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sprite3DTest.cpp; path = Sprite3DTest/Sprite3DTest.cpp; sourceTree = ""; }; 3E92EA811921A1400094CD21 /* Sprite3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sprite3DTest.h; path = Sprite3DTest/Sprite3DTest.h; sourceTree = ""; }; 3E92EA841921A7720094CD21 /* Sprite3DTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Sprite3DTest; path = "../tests/cpp-tests/Resources/Sprite3DTest"; sourceTree = ""; }; @@ -2541,6 +2548,7 @@ 1AC359B418CECF0B00F37B72 /* ExtensionsTest */ = { isa = PBXGroup; children = ( + 38FA2E70194AEBE100FF2BE4 /* CocoStudioActionTimelineTest */, 1AC359B518CECF0B00F37B72 /* CocosBuilderTest */, 1AC359DC18CECF0B00F37B72 /* CocoStudioArmatureTest */, 1AC359DF18CECF0B00F37B72 /* CocoStudioComponentsTest */, @@ -3240,6 +3248,7 @@ 1AC35CA818CED83500F37B72 /* Resources */ = { isa = PBXGroup; children = ( + 38FA2E75194AECF800FF2BE4 /* ActionTimeline */, B2507B6A192589AF00FA4972 /* Shaders3D */, 3E92EA841921A7720094CD21 /* Sprite3DTest */, 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */, @@ -3757,6 +3766,15 @@ name = Frameworks; sourceTree = ""; }; + 38FA2E70194AEBE100FF2BE4 /* CocoStudioActionTimelineTest */ = { + isa = PBXGroup; + children = ( + 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */, + 38FA2E72194AEBE100FF2BE4 /* ActionTimelineTestScene.h */, + ); + path = CocoStudioActionTimelineTest; + sourceTree = ""; + }; 3E92EA7D1921A0C60094CD21 /* Sprite3DTest */ = { isa = PBXGroup; children = ( @@ -4383,6 +4401,7 @@ 1AC35CE018CED84500F37B72 /* configs in Resources */, 1AC35CE618CED84500F37B72 /* effect2.ogg in Resources */, 1AC35CFA18CED84500F37B72 /* Misc in Resources */, + 38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */, 1AC35D0418CED84500F37B72 /* Shaders in Resources */, 1AC35CD818CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */, B2507B6B192589AF00FA4972 /* Shaders3D in Resources */, @@ -4451,6 +4470,7 @@ 1AC35CF318CED84500F37B72 /* Hello.png in Resources */, 1AC35C8F18CECF1400F37B72 /* Icon-152.png in Resources */, 1AC35CE718CED84500F37B72 /* effect2.ogg in Resources */, + 38FA2E77194AECF800FF2BE4 /* ActionTimeline in Resources */, 1AC35C9718CECF1400F37B72 /* Icon-80.png in Resources */, 1AC35CEB18CED84500F37B72 /* fileLookup.plist in Resources */, 1AC35CFD18CED84500F37B72 /* music.mid in Resources */, @@ -4686,6 +4706,7 @@ 1AC35C2B18CECF0C00F37B72 /* PerformanceLabelTest.cpp in Sources */, 1AC35C0118CECF0C00F37B72 /* TableViewTestScene.cpp in Sources */, 1AC35C4B18CECF0C00F37B72 /* ShaderTest2.cpp in Sources */, + 38FA2E73194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */, 1AC35C6518CECF0C00F37B72 /* UnitTest.cpp in Sources */, 29080DC9191B595E0066F8DF /* UISceneManager_Editor.cpp in Sources */, 1AC35B3F18CECF0C00F37B72 /* Bug-458.cpp in Sources */, @@ -4729,6 +4750,7 @@ 29080D8E191B595E0066F8DF /* CocosGUIScene.cpp in Sources */, 1AC35BFA18CECF0C00F37B72 /* WebSocketTest.cpp in Sources */, 1AC35BF218CECF0C00F37B72 /* EditBoxTest.cpp in Sources */, + 38FA2E74194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */, 1AC35B3A18CECF0C00F37B72 /* Bug-1174.cpp in Sources */, 1AC35BE418CECF0C00F37B72 /* CCControlColourPickerTest.cpp in Sources */, 29080DD4191B595E0066F8DF /* UITextAtlasTest.cpp in Sources */, diff --git a/build/winrt/Cocos2dShaderCompiler/pch.h b/build/winrt/Cocos2dShaderCompiler/pch.h index 1f4fe57240..5a24e4f473 100644 --- a/build/winrt/Cocos2dShaderCompiler/pch.h +++ b/build/winrt/Cocos2dShaderCompiler/pch.h @@ -13,4 +13,4 @@ #include #include #include -#include "App.xaml.h" \ No newline at end of file +#include "App.xaml.h" diff --git a/cocos/2d/CCActionCamera.h b/cocos/2d/CCActionCamera.h index 4a32234511..d5a0caf188 100644 --- a/cocos/2d/CCActionCamera.h +++ b/cocos/2d/CCActionCamera.h @@ -138,4 +138,4 @@ protected: NS_CC_END -#endif //__CCCAMERA_ACTION_H__ \ No newline at end of file +#endif //__CCCAMERA_ACTION_H__ diff --git a/cocos/2d/CCAnimation.cpp b/cocos/2d/CCAnimation.cpp index 335288b675..86ef053192 100644 --- a/cocos/2d/CCAnimation.cpp +++ b/cocos/2d/CCAnimation.cpp @@ -201,4 +201,4 @@ Animation* Animation::clone() const return a; } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/2d/CCAnimationCache.cpp b/cocos/2d/CCAnimationCache.cpp index fcbe96d501..b75a886d93 100644 --- a/cocos/2d/CCAnimationCache.cpp +++ b/cocos/2d/CCAnimationCache.cpp @@ -237,4 +237,4 @@ void AnimationCache::addAnimationsWithFile(const std::string& plist) } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/2d/CCFontCharMap.cpp b/cocos/2d/CCFontCharMap.cpp index 4438f7a165..e19c5a0dd4 100644 --- a/cocos/2d/CCFontCharMap.cpp +++ b/cocos/2d/CCFontCharMap.cpp @@ -160,4 +160,4 @@ FontAtlas * FontCharMap::createFontAtlas() return tempAtlas; } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index d01925bbd0..e7ac43edf1 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -240,6 +240,7 @@ Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = Te TextVAlignment vAlignment /* = TextVAlignment::TOP */,bool useDistanceField /* = false */,bool useA8Shader /* = false */) : _reusedLetter(nullptr) , _commonLineHeight(0.0f) +, _additionalKerning(0.0f) , _lineBreakWithoutSpaces(false) , _maxLineWidth(0) , _labelWidth(0) @@ -719,19 +720,30 @@ void Label::sortAllChildren() void Label::enableGlow(const Color4B& glowColor) { - if(! _useDistanceField) - return; - _currLabelEffect = LabelEffect::GLOW; - _effectColor = glowColor; - _effectColorF.r = _effectColor.r / 255.0f; - _effectColorF.g = _effectColor.g / 255.0f; - _effectColorF.b = _effectColor.b / 255.0f; - _effectColorF.a = _effectColor.a / 255.0f; - updateShaderProgram(); + if (_currentLabelType == LabelType::TTF) + { + if (_fontConfig.distanceFieldEnabled == false) + { + auto config = _fontConfig; + config.outlineSize = 0; + config.distanceFieldEnabled = true; + setTTFConfig(config); + _contentDirty = true; + } + _currLabelEffect = LabelEffect::GLOW; + _effectColor = glowColor; + _effectColorF.r = _effectColor.r / 255.0f; + _effectColorF.g = _effectColor.g / 255.0f; + _effectColorF.b = _effectColor.b / 255.0f; + _effectColorF.a = _effectColor.a / 255.0f; + updateShaderProgram(); + } } void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */) { + CCASSERT(_currentLabelType == LabelType::STRING_TEXTURE || _currentLabelType == LabelType::TTF, "Only supported system font and TTF!"); + _effectColor = outlineColor; _effectColorF.r = _effectColor.r / 255.0f; _effectColorF.g = _effectColor.g / 255.0f; @@ -1098,7 +1110,9 @@ void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t pare director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - setOrderOfArrival(0); + // FIX ME: Why need to set _orderOfArrival to 0?? + // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920 + // setOrderOfArrival(0); } void Label::setSystemFontName(const std::string& systemFont) @@ -1163,9 +1177,38 @@ Sprite * Label::getLetter(int letterIndex) return nullptr; } -int Label::getCommonLineHeight() const +void Label::setLineHeight(float height) { - return _textSprite ? 0 : _commonLineHeight; + CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!"); + + if (_commonLineHeight != height) + { + _commonLineHeight = height; + _contentDirty = true; + } +} + +float Label::getLineHeight() const +{ + CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!"); + return _textSprite ? 0.0f : _commonLineHeight; +} + +void Label::setAdditionalKerning(float space) +{ + CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!"); + if (_additionalKerning != space) + { + _additionalKerning = space; + _contentDirty = true; + } +} + +float Label::getAdditionalKerning() const +{ + CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!"); + + return _additionalKerning; } void Label::computeStringNumLines() @@ -1247,6 +1290,8 @@ void Label::updateDisplayedOpacity(GLubyte parentOpacity) void Label::setTextColor(const Color4B &color) { + CCASSERT(_currentLabelType == LabelType::TTF || _currentLabelType == LabelType::STRING_TEXTURE, "Only supported system font and ttf!"); + _textColor = color; _textColorF.r = _textColor.r / 255.0f; _textColorF.g = _textColor.g / 255.0f; diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 7cad6af323..a81daf8e6b 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -91,6 +91,7 @@ public: /** Creates a label with an initial string,font file,font size, dimension in points, horizontal alignment and vertical alignment. * @warning Not support font name. + * @warning Cache textures for each different font size or font file. */ static Label * createWithTTF(const std::string& text, const std::string& fontFile, float fontSize, const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT, @@ -98,6 +99,8 @@ public: /** Create a label with TTF configuration * @warning Not support font name. + * @warning Cache textures for each different font file when enable distance field. + * @warning Cache textures for each different font size or font file when disable distance field. */ static Label* createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment = TextHAlignment::LEFT, int maxLineWidth = 0); @@ -136,6 +139,17 @@ public: virtual const std::string& getString() const override { return _originalUTF8String; } + /** Sets the text color of the label + * Only support for TTF and system font + * @warning Different from the color of Node. + */ + virtual void setTextColor(const Color4B &color); + /** Returns the text color of this label + * Only support for TTF and system font + * @warning Different from the color of Node. + */ + const Color4B& getTextColor() const { return _textColor;} + /** * Enable shadow for the label * @@ -193,22 +207,34 @@ public: /** update content immediately.*/ virtual void updateContent(); - /** Sets the text color - * - */ - virtual void setTextColor(const Color4B &color); - - const Color4B& getTextColor() const { return _textColor;} - virtual Sprite * getLetter(int lettetIndex); /** clip upper and lower margin for reduce height of label. */ void setClipMarginEnabled(bool clipEnabled) { _clipEnabled = clipEnabled; } bool isClipMarginEnabled() const { return _clipEnabled; } - // font related stuff - int getCommonLineHeight() const; - + + /** Sets the line height of the label + @warning Not support system font + @since v3.2.0 + */ + void setLineHeight(float height); + /** Returns the line height of this label + @warning Not support system font + */ + float getLineHeight() const; + + /** Sets the additional kerning of the label + @warning Not support system font + @since v3.2.0 + */ + void setAdditionalKerning(float space); + /** Returns the additional kerning of this label + @warning Not support system font + @since v3.2.0 + */ + float getAdditionalKerning() const; + // string related stuff int getStringNumLines() const { return _currNumLines;} int getStringLength() const; @@ -247,6 +273,8 @@ public: CC_DEPRECATED_ATTRIBUTE virtual void setFontDefinition(const FontDefinition& textDefinition); CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; } + CC_DEPRECATED_ATTRIBUTE int getCommonLineHeight() const { return getLineHeight();} + protected: void onDraw(const Mat4& transform, bool transformUpdated); @@ -331,6 +359,7 @@ protected: Rect _reusedRect; int _limitShowCount; + float _additionalKerning; float _commonLineHeight; bool _lineBreakWithoutSpaces; int * _horizontalKernings; diff --git a/cocos/2d/CCLabelTextFormatter.cpp b/cocos/2d/CCLabelTextFormatter.cpp index 580e9ff5c8..a9658489dd 100644 --- a/cocos/2d/CCLabelTextFormatter.cpp +++ b/cocos/2d/CCLabelTextFormatter.cpp @@ -384,7 +384,7 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel) continue; } - nextFontPositionX += charAdvance + kernings[i]; + nextFontPositionX += charAdvance + kernings[i] + theLabel->_additionalKerning; if (longestLine < nextFontPositionX) { diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index c9cea45fc4..6916886755 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1210,6 +1210,11 @@ void Node::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t paren } director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); + + // FIX ME: Why need to set _orderOfArrival to 0?? + // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920 + // reset for next frame + // _orderOfArrival = 0; } Mat4 Node::transform(const Mat4& parentTransform) diff --git a/cocos/2d/CCNodeGrid.h b/cocos/2d/CCNodeGrid.h index 0444c4b707..12266b1a41 100644 --- a/cocos/2d/CCNodeGrid.h +++ b/cocos/2d/CCNodeGrid.h @@ -74,4 +74,4 @@ private: }; NS_CC_END -#endif \ No newline at end of file +#endif diff --git a/cocos/2d/CCSpriteBatchNode.cpp b/cocos/2d/CCSpriteBatchNode.cpp index e208725a49..b1aa3a50e0 100644 --- a/cocos/2d/CCSpriteBatchNode.cpp +++ b/cocos/2d/CCSpriteBatchNode.cpp @@ -162,7 +162,9 @@ void SpriteBatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uin draw(renderer, _modelViewTransform, flags); director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - setOrderOfArrival(0); + // FIX ME: Why need to set _orderOfArrival to 0?? + // Please refer to https://github.com/cocos2d/cocos2d-x/pull/6920 +// setOrderOfArrival(0); CC_PROFILER_STOP_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit"); } diff --git a/cocos/2d/CCTMXObjectGroup.h b/cocos/2d/CCTMXObjectGroup.h index 83d6945a59..616cee693b 100644 --- a/cocos/2d/CCTMXObjectGroup.h +++ b/cocos/2d/CCTMXObjectGroup.h @@ -110,4 +110,4 @@ protected: NS_CC_END -#endif //__CCTMX_OBJECT_GROUP_H__ \ No newline at end of file +#endif //__CCTMX_OBJECT_GROUP_H__ diff --git a/cocos/2d/cocos2d.vcxproj b/cocos/2d/cocos2d.vcxproj index fa3b106289..fa5cc46754 100644 --- a/cocos/2d/cocos2d.vcxproj +++ b/cocos/2d/cocos2d.vcxproj @@ -178,6 +178,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou + @@ -356,6 +357,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou + diff --git a/cocos/2d/cocos2d.vcxproj.filters b/cocos/2d/cocos2d.vcxproj.filters index 9007db529c..ede51800c6 100644 --- a/cocos/2d/cocos2d.vcxproj.filters +++ b/cocos/2d/cocos2d.vcxproj.filters @@ -580,6 +580,9 @@ 3d + + 3d + @@ -1180,6 +1183,9 @@ 3d + + 3d + diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp index 1d23ee34b3..c21182f5e8 100644 --- a/cocos/3d/CCBundle3D.cpp +++ b/cocos/3d/CCBundle3D.cpp @@ -27,7 +27,22 @@ #include "base/ccMacros.h" #include "platform/CCFileUtils.h" #include "renderer/CCGLProgram.h" +#include "CCBundleReader.h" +#include "base/CCData.h" +#define BUNDLE_TYPE_SCENE 1 +#define BUNDLE_TYPE_NODE 2 +#define BUNDLE_TYPE_ANIMATIONS 3 +#define BUNDLE_TYPE_ANIMATION 4 +#define BUNDLE_TYPE_ANIMATION_CHANNEL 5 +#define BUNDLE_TYPE_MODEL 10 +#define BUNDLE_TYPE_MATERIAL 16 +#define BUNDLE_TYPE_EFFECT 18 +#define BUNDLE_TYPE_CAMERA 32 +#define BUNDLE_TYPE_LIGHT 33 +#define BUNDLE_TYPE_MESH 34 +#define BUNDLE_TYPE_MESHPART 35 +#define BUNDLE_TYPE_MESHSKIN 36 NS_CC_BEGIN @@ -58,27 +73,6 @@ void getChildMap(std::map >& map, SkinData* skinData, cons } } -void getChildMapT(std::map >& map, const SkinData* skinData, const rapidjson::Value& val) -{ - if (!skinData) - return; - - if (!val.HasMember("children")) - return; - - std::string parent_name = val["id"].GetString(); - const rapidjson::Value& children = val["children"]; - for (rapidjson::SizeType i = 0; i < children.Size(); i++) - { - const rapidjson::Value& child = children[i]; - std::string child_name = child["id"].GetString(); - - map[parent_name].push_back(child_name); - - getChildMapT(map, skinData, child); - } -} - Bundle3D* Bundle3D::_instance = nullptr; Bundle3D* Bundle3D::getInstance() @@ -93,30 +87,108 @@ void Bundle3D::destroyInstance() CC_SAFE_DELETE(_instance); } +void Bundle3D::clearBuffer() +{ + CC_SAFE_DELETE_ARRAY(_jsonBuffer); + CC_SAFE_DELETE(_binaryBuffer); +} + bool Bundle3D::load(const std::string& path) { if (_path == path) return true; - getModelPath(path); + getModelRelativePath(path); + + bool ret = false; + std::string ext = path.substr(path.length() - 4, 4); + std::transform(ext.begin(), ext.end(), ext.begin(), tolower); + if (ext == ".c3t") + { + _isBinary = false; + ret = loadJson(path); + } + else if (ext == ".c3b") + { + _isBinary = true; + ret = loadBinary(path); + } + else + { + CCLOGINFO("%s is invalid file formate", path); + } + + ret?(_path = path):(_path = ""); + + return ret; +} + +bool Bundle3D::loadMeshData(const std::string& id, MeshData* meshdata) +{ + if (_isBinary) + { + return loadMeshDataBinary(meshdata); + } + else + { + return loadMeshDataJson(meshdata); + } +} + +bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata) +{ + if (_isBinary) + { + return loadSkinDataBinary(skindata); + } + else + { + return loadSkinDataJson(skindata); + } +} + +bool Bundle3D::loadMaterialData(const std::string& id, MaterialData* materialdata) +{ + if (_isBinary) + { + return loadMaterialDataBinary(materialdata); + } + else + { + return loadMaterialDataJson(materialdata); + } +} + +bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animationdata) +{ + if (_isBinary) + { + return loadAnimationDataBinary(animationdata); + } + else + { + return loadAnimationDataJson(animationdata); + } +} + +bool Bundle3D::loadJson(const std::string& path) +{ std::string strFileString = FileUtils::getInstance()->getStringFromFile(path); ssize_t size = strFileString.length(); - CC_SAFE_DELETE_ARRAY(_documentBuffer); - _documentBuffer = new char[size + 1]; - memcpy(_documentBuffer, strFileString.c_str(), size); - _documentBuffer[size] = '\0'; - if (_document.ParseInsitu<0>(_documentBuffer).HasParseError()) + CC_SAFE_DELETE_ARRAY(_jsonBuffer); + _jsonBuffer = new char[size + 1]; + memcpy(_jsonBuffer, strFileString.c_str(), size); + _jsonBuffer[size] = '\0'; + if (_document.ParseInsitu<0>(_jsonBuffer).HasParseError()) { assert(0); - CC_SAFE_DELETE_ARRAY(_documentBuffer); - _path = ""; + CC_SAFE_DELETE_ARRAY(_jsonBuffer); return false; } - _path = path; return true; } -bool Bundle3D::loadMeshData(const std::string& id, MeshData* meshdata) +bool Bundle3D::loadMeshDataJson(MeshData* meshdata) { meshdata->resetData(); @@ -160,15 +232,15 @@ bool Bundle3D::loadMeshData(const std::string& id, MeshData* meshdata) const rapidjson::Value& mesh_vertex_attribute_val = mesh_vertex_attribute[i]; meshdata->attribs[i].size = mesh_vertex_attribute_val["size"].GetUint(); - meshdata->attribs[i].attribSizeBytes = meshdata->attribs[i].size * parseGLTypeSize(mesh_vertex_attribute_val["type"].GetString()); + meshdata->attribs[i].attribSizeBytes = meshdata->attribs[i].size * 4; meshdata->attribs[i].type = parseGLType(mesh_vertex_attribute_val["type"].GetString()); meshdata->attribs[i].vertexAttrib = parseGLProgramAttribute(mesh_vertex_attribute_val["attribute"].GetString()); } - + return true; } -bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata) +bool Bundle3D::loadSkinDataJson(SkinData* skindata) { if (!_document.HasMember("skin")) return false; @@ -205,7 +277,7 @@ bool Bundle3D::loadSkinData(const std::string& id, SkinData* skindata) return true; } -bool Bundle3D::loadMaterialData(const std::string& id, MaterialData* materialdata) +bool Bundle3D::loadMaterialDataJson(MaterialData* materialdata) { if (!_document.HasMember("material")) return false; @@ -223,7 +295,7 @@ bool Bundle3D::loadMaterialData(const std::string& id, MaterialData* materialdat return true; } -bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animationdata) +bool Bundle3D::loadAnimationDataJson(Animation3DData* animationdata) { if (!_document.HasMember("animation")) return false; @@ -282,6 +354,290 @@ bool Bundle3D::loadAnimationData(const std::string& id, Animation3DData* animati return true; } +bool Bundle3D::loadBinary(const std::string& path) +{ + // get file data + CC_SAFE_DELETE(_binaryBuffer); + _binaryBuffer = new Data(); + *_binaryBuffer = FileUtils::getInstance()->getDataFromFile(path); + if (_binaryBuffer->isNull()) + { + CCLOGINFO(false, "Failed to read file: %s", path.c_str()); + return false; + } + + // Create bundle reader + CC_SAFE_DELETE(_bundleReader); + _bundleReader = BundleReader::create((char*)_binaryBuffer->getBytes(), _binaryBuffer->getSize()); + + // Read identifier info + char identifier[] = { 'C', '3', 'B', '\0'}; + char sig[4]; + if (_bundleReader->read(sig, 1, 4) != 4 || memcmp(sig, identifier, 4) != 0) + { + CCLOGINFO(false, "Invalid identifier: %s", path.c_str()); + return false; + } + + // Read version + unsigned char ver[2]; + if (_bundleReader->read(ver, 1, 2) != 2 || ver[0] != 0 || ver[1] != 1) + { + CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]); + return false; + } + + // Read ref table size + if (_bundleReader->read(&_referenceCount, 4, 1) != 1) + { + CCLOGINFO("Failed to read ref table size '%s'.", path.c_str()); + return false; + } + + // Read all refs + CC_SAFE_DELETE_ARRAY(_references); + _references = new Reference[_referenceCount]; + for (unsigned int i = 0; i < _referenceCount; ++i) + { + if ((_references[i].id = _bundleReader->readString()).empty() || + _bundleReader->read(&_references[i].type, 4, 1) != 1 || + _bundleReader->read(&_references[i].offset, 4, 1) != 1) + { + CCLOGINFO("Failed to read ref number %d for bundle '%s'.", i, path.c_str()); + CC_SAFE_DELETE_ARRAY(_references); + return false; + } + } + + return true; +} + +bool Bundle3D::loadMeshDataBinary(MeshData* meshdata) +{ + if (!seekToFirstType(BUNDLE_TYPE_MESH)) + return false; + + meshdata->resetData(); + + // read mesh data + if (_bundleReader->read(&meshdata->attribCount, 4, 1) != 1 || meshdata->attribCount < 1) + { + CCLOGINFO("Failed to read meshdata: attribCount '%s'.", _path.c_str()); + return false; + } + + meshdata->attribs.resize(meshdata->attribCount); + for (ssize_t i = 0; i < meshdata->attribCount; i++) + { + unsigned int vUsage, vSize; + if (_bundleReader->read(&vUsage, 4, 1) != 1 || _bundleReader->read(&vSize, 4, 1) != 1) + { + CCLOGINFO("Failed to read meshdata: usage or size '%s'.", _path.c_str()); + return false; + } + + meshdata->attribs[i].size = vSize; + meshdata->attribs[i].attribSizeBytes = meshdata->attribs[i].size * 4; + meshdata->attribs[i].type = GL_FLOAT; + meshdata->attribs[i].vertexAttrib = vUsage; + } + + // Read vertex data + if (_bundleReader->read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0) + { + CCLOGINFO("Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str()); + return false; + } + + meshdata->vertex.resize(meshdata->vertexSizeInFloat); + if (_bundleReader->read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat) + { + CCLOGINFO("Failed to read meshdata: vertex element '%s'.", _path.c_str()); + return false; + } + + // Read index data + unsigned int meshPartCount = 1; + //_bundleReader->read(&meshPartCount, 4, 1); + + for (unsigned int i = 0; i < meshPartCount; ++i) + { + unsigned int nIndexCount; + if (_bundleReader->read(&nIndexCount, 4, 1) != 1) + { + CCLOGINFO("Failed to read meshdata: nIndexCount '%s'.", _path.c_str()); + return false; + } + + meshdata->numIndex = nIndexCount; + meshdata->indices.resize(meshdata->numIndex); + if (_bundleReader->read(&meshdata->indices[0], 2, meshdata->numIndex) != nIndexCount) + { + CCLOGINFO("Failed to read meshdata: indices '%s'.", _path.c_str()); + return false; + } + } + + return true; +} + +bool Bundle3D::loadSkinDataBinary(SkinData* skindata) +{ + if (!seekToFirstType(BUNDLE_TYPE_MESHSKIN)) + return false; + + skindata->resetData(); + + // transform + float bindShape[16]; + if (!_bundleReader->readMatrix(bindShape)) + { + CCLOGINFO("Failed to read SkinData: bindShape matrix '%s'.", _path.c_str()); + return false; + } + + // bone count + unsigned int boneNum; + if (!_bundleReader->read(&boneNum)) + { + CCLOGINFO("Failed to read SkinData: boneNum '%s'.", _path.c_str()); + return false; + } + + // bone names and bind pos + float bindpos[16]; + for (unsigned int i = 0; i < boneNum; i++) + { + skindata->boneNames.push_back(_bundleReader->readString()); + if (!_bundleReader->readMatrix(bindpos)) + { + CCLOGINFO("Failed to load SkinData: bindpos '%s'.", _path.c_str()); + return NULL; + } + skindata->inverseBindPoseMatrices.push_back(bindpos); + } + + // bind shape + bindShape[16]; + _bundleReader->readMatrix(bindShape); + + // read parent and child relationship map + float transform[16]; + unsigned int linkNum; + _bundleReader->read(&linkNum); + for (unsigned int i = 0; i < linkNum; ++i) + { + std::string id = _bundleReader->readString(); + int index = skindata->getBoneNameIndex(id); + + if (index >= 0 && skindata->rootBoneIndex < 0) + skindata->rootBoneIndex = index; + + std::string parentid = _bundleReader->readString(); + int parentIndex = skindata->getBoneNameIndex(parentid); + + if (!_bundleReader->readMatrix(transform)) + { + CCLOGINFO("Failed to load SkinData: transform '%s'.", _path.c_str()); + return NULL; + } + + if (parentIndex < 0 || index < 0) + continue; + + skindata->boneChild[parentIndex].push_back(index); + } + + return true; +} + +bool Bundle3D::loadMaterialDataBinary(MaterialData* materialdata) +{ + if (!seekToFirstType(BUNDLE_TYPE_MATERIAL)) + return false; + + std::string texturePath = _bundleReader->readString(); + if (texturePath.empty()) + { + CCLOGINFO("Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str()); + return false; + } + + materialdata->texturePath = _modelRelativePath + texturePath; + return true; +} + +bool Bundle3D::loadAnimationDataBinary(Animation3DData* animationdata) +{ + if (!seekToFirstType(BUNDLE_TYPE_ANIMATIONS)) + return false; + + animationdata->_rotationKeys.clear(); + animationdata->_scaleKeys.clear(); + animationdata->_translationKeys.clear(); + + std::string id = _bundleReader->readString(); + + if (!_bundleReader->read(&animationdata->_totalTime)) + { + CCLOGINFO("Failed to read AnimationData: totalTime '%s'.", _path.c_str()); + return false; + } + + unsigned int animNum; + if (!_bundleReader->read(&animNum)) + { + CCLOGINFO("Failed to read AnimationData: animNum '%s'.", _path.c_str()); + return false; + } + + for (unsigned int i = 0; i < animNum; ++i) + { + std::string boneName = _bundleReader->readString(); + unsigned int keyframeNum; + if (!_bundleReader->read(&keyframeNum)) + { + CCLOGINFO("Failed to read AnimationData: keyframeNum '%s'.", _path.c_str()); + return false; + } + + for (unsigned int j = 0; j < keyframeNum; ++j) + { + float keytime; + if (!_bundleReader->read(&keytime)) + { + CCLOGINFO("Failed to read AnimationData: keytime '%s'.", _path.c_str()); + return false; + } + + Quaternion rotate; + if (_bundleReader->read(&rotate, 4, 4) != 4) + { + CCLOGINFO("Failed to read AnimationData: rotate '%s'.", _path.c_str()); + return false; + } + animationdata->_rotationKeys[boneName].push_back(Animation3DData::QuatKey(keytime, rotate)); + + Vec3 scale; + if (_bundleReader->read(&scale, 4, 3) != 3) + { + CCLOGINFO("Failed to read AnimationData: scale '%s'.", _path.c_str()); + return false; + } + animationdata->_scaleKeys[boneName].push_back(Animation3DData::Vec3Key(keytime, scale)); + + Vec3 position; + if (_bundleReader->read(&position, 4, 3) != 3) + { + CCLOGINFO("Failed to read AnimationData: position '%s'.", _path.c_str()); + return false; + } + animationdata->_translationKeys[boneName].push_back(Animation3DData::Vec3Key(keytime, position)); + } + } + return true; +} + GLenum Bundle3D::parseGLType(const std::string& str) { if (str == "GL_FLOAT") @@ -299,23 +655,6 @@ GLenum Bundle3D::parseGLType(const std::string& str) } } -unsigned int Bundle3D::parseGLTypeSize(const std::string& str) -{ - if (str == "GL_FLOAT") - { - return sizeof(float); - } - else if (str == "GL_UNSIGNED_INT") - { - return sizeof(unsigned int); - } - else - { - assert(0); - return -1; - } -} - unsigned int Bundle3D::parseGLProgramAttribute(const std::string& str) { if (str == "VERTEX_ATTRIB_POSITION") @@ -349,7 +688,7 @@ unsigned int Bundle3D::parseGLProgramAttribute(const std::string& str) } } -void Bundle3D::getModelPath(const std::string& path) +void Bundle3D::getModelRelativePath(const std::string& path) { int index = path.find_last_of('/'); std::string fullModelPath; @@ -366,19 +705,44 @@ void Bundle3D::getModelPath(const std::string& path) } } +Reference* Bundle3D::seekToFirstType(unsigned int type) +{ + // for each Reference + for (unsigned int i = 0; i < _referenceCount; ++i) + { + Reference* ref = &_references[i]; + if (ref->type == type) + { + // Found a match + if (_bundleReader->seek(ref->offset, SEEK_SET) == false) + { + CCLOGINFO("Failed to seek to object '%s' in bundle '%s'.", ref->id.c_str(), _path.c_str()); + return NULL; + } + return ref; + } + } + return NULL; +} + Bundle3D::Bundle3D() -:_isBinary(false) -,_modelRelativePath("") -,_documentBuffer(nullptr) -,_path("") +:_isBinary(false), +_modelRelativePath(""), +_jsonBuffer(NULL), +_path(""), +_referenceCount(0), +_bundleReader(NULL), +_references(NULL), +_binaryBuffer(NULL) { } Bundle3D::~Bundle3D() { - CC_SAFE_DELETE_ARRAY(_documentBuffer); + CC_SAFE_DELETE_ARRAY(_jsonBuffer); + CC_SAFE_DELETE_ARRAY(_bundleReader); + CC_SAFE_DELETE_ARRAY(_references); + CC_SAFE_DELETE(_binaryBuffer); } - - NS_CC_END diff --git a/cocos/3d/CCBundle3D.h b/cocos/3d/CCBundle3D.h index cb2dad112e..1b4bb47981 100644 --- a/cocos/3d/CCBundle3D.h +++ b/cocos/3d/CCBundle3D.h @@ -36,6 +36,9 @@ #include "json/document.h" NS_CC_BEGIN +class BundleReader; +class Animation3D; +class Data; /** * Defines a bundle file that contains a collection of assets. Mesh, Material, MeshSkin, Animation @@ -51,6 +54,8 @@ public: static void destroyInstance(); + void clearBuffer(); + /** * load a file. You must load a file first, then call loadMeshData, loadSkinData, and so on * @param path File to be loaded @@ -81,17 +86,75 @@ public: * @param id The ID of the animation, load the first animation in the bundle if it is empty */ bool loadAnimationData(const std::string& id, Animation3DData* animationdata); - + protected: + + bool loadJson(const std::string& path); + + bool loadMeshDataJson(MeshData* meshdata); + + bool loadSkinDataJson(SkinData* skindata); + + bool loadMaterialDataJson(MaterialData* materialdata); + + bool loadAnimationDataJson(Animation3DData* animationdata); + + /** + * load data in binary + * @param path The c3b file path + */ + bool loadBinary(const std::string& path); + + /** + * load mesh data in binary + * @param meshdata The mesh data pointer + */ + bool loadMeshDataBinary(MeshData* meshdata); + + /** + * load skin data in binary + * @param skindata The skin data pointer + */ + bool loadSkinDataBinary(SkinData* skindata); + + /** + * load material data in binary + * @param materialdata The material pointer + */ + bool loadMaterialDataBinary(MaterialData* materialdata); + + /** + * load animation data in binary + * @param animationdata The animation data pointer + */ + bool loadAnimationDataBinary(Animation3DData* animationdata); + +protected: + /** + * get define data type + * @param str The type in string + */ GLenum parseGLType(const std::string& str); - unsigned int parseGLTypeSize(const std::string& str); - + /** + * get vertex attribute type + * @param str The type in string + */ unsigned int parseGLProgramAttribute(const std::string& str); - // get model path - void getModelPath(const std::string& path); + /* + * get model path + * @param str Full path of model file + */ + void getModelRelativePath(const std::string& path); + /* + * set the read position in buffer to the target type + * @param The data type + */ + Reference* seekToFirstType(unsigned int type); + +protected: CC_CONSTRUCTOR_ACCESS: Bundle3D(); ~Bundle3D(); @@ -102,11 +165,15 @@ protected: std::string _modelRelativePath; - char* _documentBuffer; + char* _jsonBuffer; std::string _path; - rapidjson::Document _document; + BundleReader* _bundleReader; + unsigned int _referenceCount; + Reference* _references; + Data* _binaryBuffer; + bool _isBinary; }; diff --git a/cocos/3d/CCBundle3DData.h b/cocos/3d/CCBundle3DData.h index 7c9e2dbe00..3ae5e0141c 100644 --- a/cocos/3d/CCBundle3DData.h +++ b/cocos/3d/CCBundle3DData.h @@ -34,7 +34,27 @@ NS_CC_BEGIN -/**mesh vertex attribute*/ +// vertex usage elements. +enum Vertex_Usage +{ + Vertex_Usage_POSITION = 1, + Vertex_Usage_NORMAL = 2, + Vertex_Usage_COLOR = 3, + Vertex_Usage_TANGENT = 4, + Vertex_Usage_BINORMAL = 5, + Vertex_Usage_BLENDWEIGHTS = 6, + Vertex_Usage_BLENDINDICES = 7, + Vertex_Usage_TEXCOORD0 = 8, + Vertex_Usage_TEXCOORD1 = 9, + Vertex_Usage_TEXCOORD2 = 10, + Vertex_Usage_TEXCOORD3 = 11, + Vertex_Usage_TEXCOORD4 = 12, + Vertex_Usage_TEXCOORD5 = 13, + Vertex_Usage_TEXCOORD6 = 14, + Vertex_Usage_TEXCOORD7 = 15 +}; + +//mesh vertex attribute struct MeshVertexAttrib { //attribute size @@ -47,7 +67,6 @@ struct MeshVertexAttrib int attribSizeBytes; }; -/**mesh data*/ struct MeshData { std::vector vertex; @@ -79,25 +98,17 @@ public: } }; -/**skin data*/ struct SkinData { - std::vector skinBoneNames; //skin bones affect skin - std::vector nodeBoneNames; //node bones don't affect skin, all bones [skinBone, nodeBone] - std::vector inverseBindPoseMatrices; //bind pose of skin bone, only for skin bone - std::vector skinBoneOriginMatrices; // original bone transform, for skin bone - std::vector nodeBoneOriginMatrices; // original bone transform, for node bone + std::vector boneNames; + std::vector inverseBindPoseMatrices; //bind pose of bone - //bone child info, both skinbone and node bone std::map > boneChild;//key parent, value child int rootBoneIndex; void resetData() { - skinBoneNames.clear(); - nodeBoneNames.clear(); + boneNames.clear(); inverseBindPoseMatrices.clear(); - skinBoneOriginMatrices.clear(); - nodeBoneOriginMatrices.clear(); boneChild.clear(); rootBoneIndex = -1; } @@ -105,30 +116,22 @@ struct SkinData int getBoneNameIndex(const std::string& name)const { int i = 0; - for (auto iter : skinBoneNames) + for( const auto &item : boneNames ) { - if ((iter) == name) + if (item == name) return i; - i++; - } - for(auto iter : nodeBoneNames) - { - if (iter == name) - return i; - i++; + else + ++i; } return -1; } - }; -/**material data*/ struct MaterialData { std::string texturePath; }; -/**animation data*/ struct Animation3DData { public: @@ -198,6 +201,17 @@ public: } }; +class Reference +{ +public: + std::string id; + unsigned int type; + unsigned int offset; + + Reference(){}; + + ~Reference(){}; +}; NS_CC_END #endif //__CC_BUNDLE_3D_DATA_H__ diff --git a/cocos/3d/CCBundleReader.cpp b/cocos/3d/CCBundleReader.cpp new file mode 100644 index 0000000000..a84671f96d --- /dev/null +++ b/cocos/3d/CCBundleReader.cpp @@ -0,0 +1,211 @@ +#include "CCBundleReader.h" +#include "platform/CCFileUtils.h" + +NS_CC_BEGIN + +BundleReader::~BundleReader() +{ + close(); +}; + +BundleReader* BundleReader::create(char* lpbuffer, unsigned int length) +{ + if (lpbuffer) + { + BundleReader* stream = new BundleReader(); + stream->init(lpbuffer, length); + return stream; + } + return NULL; +} + +void BundleReader::close() +{ + CC_SAFE_DELETE(m_buffer); +} + +size_t BundleReader::read(void* ptr, size_t size, size_t count) +{ + if (!m_buffer || eof()) + return 0; + + size_t validCount; + size_t validLength = m_length - m_position; + size_t needLength = size*count; + char* ptr1 = (char*)ptr; + if(validLength <= needLength) + { + validCount = validLength/size; + size_t readLength = size*validCount; + memcpy(ptr1,(char*)m_buffer+m_position,readLength); + ptr1 += readLength; + m_position += readLength; + readLength = validLength - readLength; + if(readLength>0) + { + memcpy(ptr1,(char*)m_buffer+m_position,readLength); + m_position += readLength; + validCount+=1; + } + } + else + { + memcpy(ptr1,(char*)m_buffer+m_position,needLength); + m_position += needLength; + validCount = count; + } + //*ptr1 = 0; + + return validCount; +} + +char* BundleReader::readLine(int num,char* line) +{ + if (!m_buffer) + return 0; + + //char* str = new char[num]; + char* buffer = (char*)m_buffer+m_position; + + char* p = line; + char c; + size_t readNum = 0; + while((c=*buffer) != 10 && readNum < (size_t)num && m_position<(long int)m_length) + { + *p = c; + p++; + buffer++; + m_position++; + readNum++; + } + *p = '\0'; + + return line; +} + +size_t BundleReader::write(const void* ptr, size_t size, size_t count) +{ + if (!m_buffer) + return 0; + + size_t validCount; + size_t validLength = m_length - m_position; + size_t needLength = size*count; + const char* ptr1 = (const char*)ptr; + if (validLength <= needLength) + { + validCount = validLength / size; + size_t readLength = size * validCount; + memcpy((char*)m_buffer + m_position, ptr1, readLength); + ptr1 += readLength; + m_position += readLength; + readLength = validLength - readLength; + if(readLength > 0) + { + memcpy((char*)m_buffer+m_position, ptr1, readLength); + m_position += readLength; + validCount += 1; + } + } + else + { + memcpy((char*)m_buffer + m_position, ptr1, needLength); + m_position += needLength; + validCount = count; + } + + return validCount; +} + +bool BundleReader::eof() +{ + if (!m_buffer) + return true; + return ((size_t)tell()) >= length(); +} + +size_t BundleReader::length() +{ + return m_length; +} + +long int BundleReader::tell() +{ + if (!m_buffer) + return -1; + return m_position; +} + +bool BundleReader::seek(long int offset, int origin) +{ + if (!m_buffer) + return false; + + if(origin == SEEK_CUR) + { + m_position += offset; + } + else if(origin == SEEK_SET) + { + m_position = offset; + } + else if(origin == SEEK_END) + { + m_position = m_length+offset; + } + else + return false; + + return true; +} + +bool BundleReader::rewind() +{ + if (m_buffer != NULL) + { + m_position = 0; + return true; + } + return false; +} + +std::string BundleReader::readString() +{ + unsigned int length; + if(read(&length, 4, 1) != 1) + { + return std::string(); + } + + std::string str; + if (length > 0) + { + str.resize(length); + if (read(&str[0], 1, length) != length) + { + return std::string(); + } + } + return str; +} + +bool BundleReader::readMatrix(float* m) +{ + return (read(m, sizeof(float), 16) == 16); +} + +BundleReader::BundleReader() +{ + m_buffer = NULL; + m_position = 0; + m_length = 0; +}; + +void BundleReader::init(char* lpbuffer, unsigned int length) +{ + m_position = 0; + m_buffer = lpbuffer; + m_length = length; +} + +} \ No newline at end of file diff --git a/cocos/3d/CCBundleReader.h b/cocos/3d/CCBundleReader.h new file mode 100644 index 0000000000..4bcf1e2e5e --- /dev/null +++ b/cocos/3d/CCBundleReader.h @@ -0,0 +1,213 @@ +/**************************************************************************** + Copyright (c) 2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#ifndef __CC_BUNDLE_READER_H__ +#define __CC_BUNDLE_READER_H__ + +#include +#include + +#include "base/CCRef.h" +#include "base/CCPlatformMacros.h" +#include "base/CCConsole.h" + +NS_CC_BEGIN + +/** + * BundleReader is an interface for reading sequence of bytes. + */ +class BundleReader: public cocos2d::Ref +{ +public: + /** + * Destructor + */ + ~BundleReader(); + + /** creates an BundleReader with lpbuffer and length + * @param lpbuffer The pointer to the file data + * @param length The size for lpbuffer in bytes + */ + static BundleReader* create(char* lpbuffer, unsigned int length); + + /** + * Close and delete buffer + */ + void close(); + + /** + * Reads an array of elements. + * + * @param ptr The pointer to the memory to copy into. + * The available size should be at least bytes. + * @param size The size of each element to be read, in bytes. + * @param count The number of elements to read. + * + * @return The number of elements read. + */ + size_t read(void* ptr, size_t size, size_t count); + + /** + * Reads a line from the buffer. + */ + char* readLine(int num, char* line); + + /** + * Writes an array of elements. + * + * @param ptr The pointer to the array of elements to be written. + * @param size The size of each element to be written, in bytes. + * @param count The number of elements to write. + * + * @return The number of elements written. + */ + size_t write(const void* ptr, size_t size, size_t count); + + /** + * Returns true if the end of the buffer has been reached. + */ + bool eof(); + + /** + * Returns the length of the buffer in bytes. + */ + size_t length(); + + /** + * Returns the position of the file pointer. + */ + long int tell(); + + /** + * Sets the position of the file pointer. + */ + bool seek(long int offset, int origin); + + /** + * Sets the file pointer at the start of the file. + */ + bool rewind(); + + /** + * read binary typed value. + */ + template bool read(T* ptr); + template bool readArray(unsigned int* length, std::vector* values); + + /** + * first read length, then read string text + */ + std::string readString(); + bool readMatrix(float* m); + +private: + BundleReader(); + void init(char* lpbuffer, unsigned int length); + +private: + long int m_position; + size_t m_length; + char* m_buffer; +}; + +// template read routines +template +inline bool BundleReader::read(T *ptr) +{ + return (read(ptr, sizeof(T), 1) == 1); +} + +/** +* template function to read array of value. +*/ +template +inline bool BundleReader::readArray(unsigned int *length, std::vector *values) +{ + if (!read(length)) + { + return false; + } + if (*length > 0 && values) + { + values->resize(*length); + if (read(&(*values)[0], sizeof(T), *length) != *length) + { + return false; + } + } + return true; +} + +/** +* specalization for char +*/ +template<> +inline bool BundleReader::read(char *ptr) +{ + if (read(ptr, sizeof(char), 1) == 1) + { + return true; + } + else + { + *ptr = -1; + return false; + } +} + +/** +* specalization for std::string +*/ +template<> +inline bool BundleReader::read(std::string *ptr) +{ + CCLOG("can not read std::string, use readString() instead"); + return false; +} + +/** +* template function to read array of value. +*/ +template<> +inline bool BundleReader::readArray(unsigned int *length, std::vector *values) +{ + if (!read(length)) + { + return false; + } + values->clear(); + if (*length > 0 && values) + { + for (int i = 0; i < (int)*length; ++i) + { + values->push_back(readString()); + } + } + return true; +} + + +NS_CC_END + +#endif diff --git a/cocos/3d/CCMeshSkin.cpp b/cocos/3d/CCMeshSkin.cpp index 72ec02b145..bb7f3e25ef 100644 --- a/cocos/3d/CCMeshSkin.cpp +++ b/cocos/3d/CCMeshSkin.cpp @@ -301,14 +301,14 @@ MeshSkin* MeshSkin::create(const std::string& filename, const std::string& name) bool MeshSkin::initFromSkinData(const SkinData& skindata) { ssize_t i = 0; - for (; i < skindata.skinBoneNames.size(); i++) { - auto bone = Bone::create(skindata.skinBoneNames[i]); + for (; i < skindata.boneNames.size(); i++) { + auto bone = Bone::create(skindata.boneNames[i]); bone->_invBindPose = skindata.inverseBindPoseMatrices[i]; //bone->setOriPose(skindata.skinBoneOriginMatrices[i]); addSkinBone(bone); } - for (i = 0; i < skindata.nodeBoneNames.size(); i++) { - auto bone = Bone::create(skindata.nodeBoneNames[i]); + for (i = 0; i < skindata.boneNames.size(); i++) { + auto bone = Bone::create(skindata.boneNames[i]); //bone->setOriPose(skindata.nodeBoneOriginMatrices[i]); addNodeBone(bone); } diff --git a/cocos/audio/mac/CDXMacOSXSupport.mm b/cocos/audio/mac/CDXMacOSXSupport.mm index a84f61debc..57fb53a715 100644 --- a/cocos/audio/mac/CDXMacOSXSupport.mm +++ b/cocos/audio/mac/CDXMacOSXSupport.mm @@ -179,4 +179,4 @@ OSStatus AudioSessionGetProperty(UInt32 inID, UInt32 *ioDataSize, void *outData) - (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError**)outError {return YES;} @end -#endif \ No newline at end of file +#endif diff --git a/cocos/audio/winrt/MediaStreamer.cpp b/cocos/audio/winrt/MediaStreamer.cpp index 62fcf7a9b1..f6f985bf5b 100644 --- a/cocos/audio/winrt/MediaStreamer.cpp +++ b/cocos/audio/winrt/MediaStreamer.cpp @@ -212,4 +212,4 @@ void MediaStreamer::Restart() ThrowIfFailed( m_reader->SetCurrentPosition(GUID_NULL, var) ); -} \ No newline at end of file +} diff --git a/cocos/audio/winrt/MediaStreamer.h b/cocos/audio/winrt/MediaStreamer.h index 972a186da5..cafbfe0993 100644 --- a/cocos/audio/winrt/MediaStreamer.h +++ b/cocos/audio/winrt/MediaStreamer.h @@ -38,4 +38,4 @@ public: bool GetNextBuffer(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength); void ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength); void Restart(); -}; \ No newline at end of file +}; diff --git a/cocos/audio/wp8/MediaStreamer.cpp b/cocos/audio/wp8/MediaStreamer.cpp index 8330b33e25..61fbaa0779 100644 --- a/cocos/audio/wp8/MediaStreamer.cpp +++ b/cocos/audio/wp8/MediaStreamer.cpp @@ -213,4 +213,4 @@ void MediaStreamer::ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferL void MediaStreamer::Restart() { m_offset = 0; -} \ No newline at end of file +} diff --git a/cocos/audio/wp8/MediaStreamer.h b/cocos/audio/wp8/MediaStreamer.h index 8620620171..1940ed3557 100644 --- a/cocos/audio/wp8/MediaStreamer.h +++ b/cocos/audio/wp8/MediaStreamer.h @@ -55,4 +55,4 @@ internal: void Initialize(_In_ const WCHAR* url); void ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength); void Restart(); -}; \ No newline at end of file +}; diff --git a/cocos/base/CCEventFocus.cpp b/cocos/base/CCEventFocus.cpp index a4a84dbba4..f1249576a2 100644 --- a/cocos/base/CCEventFocus.cpp +++ b/cocos/base/CCEventFocus.cpp @@ -39,4 +39,4 @@ _widgetGetFocus(widgetGetFocus) -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/base/CCEventListener.cpp b/cocos/base/CCEventListener.cpp index c6f6acaccd..ca67dfbabd 100644 --- a/cocos/base/CCEventListener.cpp +++ b/cocos/base/CCEventListener.cpp @@ -22,6 +22,7 @@ THE SOFTWARE. ****************************************************************************/ +#include "base/CCConsole.h" #include "base/CCEventListener.h" #include "platform/CCCommon.h" diff --git a/cocos/base/CCEventListenerFocus.cpp b/cocos/base/CCEventListenerFocus.cpp index dd6c9fc114..f6b843ba00 100644 --- a/cocos/base/CCEventListenerFocus.cpp +++ b/cocos/base/CCEventListenerFocus.cpp @@ -95,4 +95,4 @@ bool EventListenerFocus::checkAvailable() -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/base/CCEventListenerMouse.cpp b/cocos/base/CCEventListenerMouse.cpp index 635fcfdd6b..8f4074172e 100644 --- a/cocos/base/CCEventListenerMouse.cpp +++ b/cocos/base/CCEventListenerMouse.cpp @@ -109,4 +109,4 @@ bool EventListenerMouse::init() return false; } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/base/CCEventListenerTouch.cpp b/cocos/base/CCEventListenerTouch.cpp index 95e4df684a..e060b9bf3e 100644 --- a/cocos/base/CCEventListenerTouch.cpp +++ b/cocos/base/CCEventListenerTouch.cpp @@ -187,4 +187,4 @@ EventListenerTouchAllAtOnce* EventListenerTouchAllAtOnce::clone() return ret; } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/base/CCEventMouse.cpp b/cocos/base/CCEventMouse.cpp index 5bd662f1eb..c1013d4d26 100644 --- a/cocos/base/CCEventMouse.cpp +++ b/cocos/base/CCEventMouse.cpp @@ -38,4 +38,4 @@ EventMouse::EventMouse(MouseEventType mouseEventCode) { }; -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/base/CCTouch.cpp b/cocos/base/CCTouch.cpp index 1209e222a7..651f9651b1 100644 --- a/cocos/base/CCTouch.cpp +++ b/cocos/base/CCTouch.cpp @@ -70,4 +70,4 @@ Vec2 Touch::getDelta() const return getLocation() - getPreviousLocation(); } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/deprecated/CCInteger.h b/cocos/deprecated/CCInteger.h index c3710eaf49..0725f72759 100644 --- a/cocos/deprecated/CCInteger.h +++ b/cocos/deprecated/CCInteger.h @@ -26,6 +26,7 @@ #define __CCINTEGER_H__ #include "base/CCRef.h" +#include "base/CCConsole.h" #include "base/CCDataVisitor.h" #include "platform/CCCommon.h" diff --git a/cocos/editor-support/cocosbuilder/CCBSequence.cpp b/cocos/editor-support/cocosbuilder/CCBSequence.cpp index 3496c3e857..8e1659f5b0 100644 --- a/cocos/editor-support/cocosbuilder/CCBSequence.cpp +++ b/cocos/editor-support/cocosbuilder/CCBSequence.cpp @@ -86,4 +86,4 @@ void CCBSequence::setChainedSequenceId(int nChainedSequenceId) mChainedSequenceId = nChainedSequenceId; } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp b/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp index 74c6cf37aa..ba20f8fd13 100644 --- a/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp @@ -114,4 +114,4 @@ void ControlButtonLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, c } } -}; \ No newline at end of file +}; diff --git a/cocos/editor-support/cocosbuilder/CCControlLoader.cpp b/cocos/editor-support/cocosbuilder/CCControlLoader.cpp index 9125f8d193..9d65768562 100644 --- a/cocos/editor-support/cocosbuilder/CCControlLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCControlLoader.cpp @@ -27,4 +27,4 @@ void ControlLoader::onHandlePropTypeBlockControl(Node * pNode, Node * pParent, c } } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocosbuilder/CCLabelBMFontLoader.cpp b/cocos/editor-support/cocosbuilder/CCLabelBMFontLoader.cpp index 3b85b46f12..2eec094dd5 100644 --- a/cocos/editor-support/cocosbuilder/CCLabelBMFontLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCLabelBMFontLoader.cpp @@ -50,4 +50,4 @@ void LabelBMFontLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const } } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp b/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp index 985c528c85..53c11df6f3 100644 --- a/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCLabelTTFLoader.cpp @@ -80,4 +80,4 @@ void LabelTTFLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const ch } } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocosbuilder/CCLayerColorLoader.cpp b/cocos/editor-support/cocosbuilder/CCLayerColorLoader.cpp index 02c7f610ae..8c5d20860e 100644 --- a/cocos/editor-support/cocosbuilder/CCLayerColorLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCLayerColorLoader.cpp @@ -32,4 +32,4 @@ void LayerColorLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, c } } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocosbuilder/CCLayerLoader.cpp b/cocos/editor-support/cocosbuilder/CCLayerLoader.cpp index e7c348583f..79febcc5d3 100644 --- a/cocos/editor-support/cocosbuilder/CCLayerLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCLayerLoader.cpp @@ -42,4 +42,4 @@ void LayerLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char #pragma GCC diagnostic warning "-Wdeprecated-declarations" #elif _MSC_VER >= 1400 //vs 2005 or higher #pragma warning (pop) -#endif \ No newline at end of file +#endif diff --git a/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp b/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp index 2a85d0c4e1..1388c3f4ef 100644 --- a/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp @@ -27,4 +27,4 @@ void MenuItemLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const c } } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp b/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp index 48979ee0bc..ff497635e0 100644 --- a/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp +++ b/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp @@ -102,4 +102,4 @@ NodeLoaderLibrary * NodeLoaderLibrary::newDefaultNodeLoaderLibrary() { return ccNodeLoaderLibrary; } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp b/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp index 490703fcdb..fd8918cbf5 100644 --- a/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp @@ -137,4 +137,4 @@ void ParticleSystemQuadLoader::onHandlePropTypeTexture(Node * pNode, Node * pPar } } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocosbuilder/CCScrollViewLoader.cpp b/cocos/editor-support/cocosbuilder/CCScrollViewLoader.cpp index 32301942c8..e021a861ed 100644 --- a/cocos/editor-support/cocosbuilder/CCScrollViewLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCScrollViewLoader.cpp @@ -54,4 +54,4 @@ void ScrollViewLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pPare } } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp new file mode 100644 index 0000000000..60a5d5ff9d --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp @@ -0,0 +1,278 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCActionTimeline.h" + +USING_NS_CC; + +NS_TIMELINE_BEGIN + +// ActionTimelineData +ActionTimelineData* ActionTimelineData::create(int actionTag) +{ + ActionTimelineData * ret = new ActionTimelineData(); + if (ret && ret->init(actionTag)) + { + ret->autorelease(); + } + else + { + CC_SAFE_DELETE(ret); + } + return ret; +} + +ActionTimelineData::ActionTimelineData() + : _actionTag(0) +{ +} + +bool ActionTimelineData::init(int actionTag) +{ + _actionTag = actionTag; + return true; +} + + +// ActionTimeline +ActionTimeline* ActionTimeline::create() +{ + ActionTimeline* object = new ActionTimeline(); + if (object && object->init()) + { + object->autorelease(); + return object; + } + CC_SAFE_DELETE(object); + return nullptr; +} + +ActionTimeline::ActionTimeline() + : _duration(0) + , _time(0) + , _timeSpeed(1) + , _frameInternal(1/60.0f) + , _playing(false) + , _currentFrame(0) + , _startFrame(0) + , _endFrame(0) + , _frameEventListener(nullptr) +{ +} + +ActionTimeline::~ActionTimeline() +{ +} + +bool ActionTimeline::init() +{ + return true; +} + +void ActionTimeline::gotoFrameAndPlay(int startIndex) +{ + gotoFrameAndPlay(startIndex, true); +} + +void ActionTimeline::gotoFrameAndPlay(int startIndex, bool loop) +{ + gotoFrameAndPlay(startIndex, _duration, loop); +} + +void ActionTimeline::gotoFrameAndPlay(int startIndex, int endIndex, bool loop) +{ + _startFrame = _currentFrame = startIndex; + _endFrame = endIndex; + _loop = loop; + _time = _currentFrame * _frameInternal; + + resume(); + gotoFrame(_currentFrame); +} + +void ActionTimeline::gotoFrameAndPause(int startIndex) +{ + _startFrame = _currentFrame = startIndex; + _time = _currentFrame * _frameInternal; + + pause(); + gotoFrame(_currentFrame); +} + +void ActionTimeline::pause() +{ + _playing = false; +} + +void ActionTimeline::resume() +{ + _playing = true; +} + +bool ActionTimeline::isPlaying() const +{ + return _playing; +} + +ActionTimeline* ActionTimeline::clone() const +{ + ActionTimeline* newAction = ActionTimeline::create(); + newAction->setDuration(_duration); + newAction->setTimeSpeed(_timeSpeed); + + for (auto timelines : _timelineMap) + { + for(auto timeline : timelines.second) + { + Timeline* newTimeline = timeline->clone(); + newAction->addTimeline(newTimeline); + } + } + + return newAction; +} + +void ActionTimeline::step(float delta) +{ + if (!_playing || _timelineMap.size() == 0 || _duration == 0) + { + return; + } + + _time += delta * _timeSpeed; + _currentFrame = (int)(_time / _frameInternal); + + stepToFrame(_currentFrame); + + if(_time > _endFrame * _frameInternal) + { + _playing = _loop; + if(!_playing) + _time = _endFrame * _frameInternal; + else + _time = _startFrame * _frameInternal; + } + +} + +typedef std::function tCallBack; +void foreachNodeDescendant(Node* parent, tCallBack callback) +{ + callback(parent); + + auto children = parent->getChildren(); + for (auto child : children) + { + foreachNodeDescendant(child, callback); + } +} + +void ActionTimeline::startWithTarget(Node *target) +{ + Action::startWithTarget(target); + + foreachNodeDescendant(target, + [this, target](Node* child) + { + ActionTimelineData* data = dynamic_cast(child->getUserObject()); + int actionTag = data->getActionTag(); + if(_timelineMap.find(actionTag) != _timelineMap.end()) + { + auto timelines = this->_timelineMap[actionTag]; + for (auto timeline : timelines) + { + timeline->setNode(child); + } + } + }); +} + +void ActionTimeline::addTimeline(Timeline* timeline) +{ + int tag = timeline->getActionTag(); + if (_timelineMap.find(tag) == _timelineMap.end()) + { + _timelineMap[tag] = Vector(); + } + + if (!_timelineMap[tag].contains(timeline)) + { + _timelineList.pushBack(timeline); + _timelineMap[tag].pushBack(timeline); + timeline->setActionTimeline(this); + } +} + +void ActionTimeline::removeTimeline(Timeline* timeline) +{ + int tag = timeline->getActionTag(); + if (_timelineMap.find(tag) != _timelineMap.end()) + { + if(_timelineMap[tag].contains(timeline)) + { + _timelineMap[tag].eraseObject(timeline); + _timelineList.eraseObject(timeline); + timeline->setActionTimeline(nullptr); + } + } +} + +void ActionTimeline::setFrameEventCallFunc(std::function listener) +{ + _frameEventListener = listener; +} + +void ActionTimeline::clearFrameEventCallFunc() +{ + _frameEventListener = nullptr; +} + + +void ActionTimeline::emitFrameEvent(Frame* frame) +{ + if(_frameEventListener) + { + _frameEventListener(frame); + } +} + +void ActionTimeline::gotoFrame(int frameIndex) +{ + int size = _timelineList.size(); + for(int i = 0; igotoFrame(frameIndex); + } +} + +void ActionTimeline::stepToFrame(int frameIndex) +{ + int size = _timelineList.size(); + for(int i = 0; istepToFrame(frameIndex); + } +} + +NS_TIMELINE_END diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h new file mode 100644 index 0000000000..e14f8e82b6 --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h @@ -0,0 +1,160 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCTIMELINE_ACTION_H__ +#define __CCTIMELINE_ACTION_H__ + +#include "CCTimeLine.h" +#include "renderer/CCRenderer.h" + +NS_TIMELINE_BEGIN + +class ActionTimelineData : public cocos2d::Ref +{ +public: + static ActionTimelineData* create(int actionTag); + + virtual void setActionTag(int actionTag) { _actionTag = actionTag; } + virtual int getActionTag() const { return _actionTag; } +protected: + ActionTimelineData(); + virtual bool init(int actionTag); + + int _actionTag; +}; + + +class ActionTimeline : public cocos2d::Action +{ +public: + friend class Frame; + + static ActionTimeline* create(); + + ActionTimeline(); + virtual ~ActionTimeline(); + + virtual bool init(); + + /** Goto the specified frame index, and start playing from this index. + * @param startIndex The animation will play from this index. + */ + virtual void gotoFrameAndPlay(int startIndex); + + /** Goto the specified frame index, and start playing from this index. + * @param startIndex The animation will play from this index. + * @param loop Whether or not the animation need loop. + */ + virtual void gotoFrameAndPlay(int startIndex, bool loop); + + /** Goto the specified frame index, and start playing from start index, end at end index. + * @param startIndex The animation will play from this index. + * @param endIndex The animation will end at this index. + * @param loop Whether or not the animation need loop. + */ + virtual void gotoFrameAndPlay(int startIndex, int endIndex, bool loop); + + /** Goto the specified frame index, and pause at this index. + * @param startIndex The animation will pause at this index. + */ + virtual void gotoFrameAndPause(int startIndex); + + /** Pause the animation. */ + virtual void pause(); + /** Resume the animation. */ + virtual void resume(); + + /** Whether or not Action is playing. */ + virtual bool isPlaying() const; + + /** Set the animation speed, this will speed up or slow down the speed. */ + virtual void setTimeSpeed(float speed) { _timeSpeed = speed; } + /** Get current animation speed. */ + virtual float getTimeSpeed() const { return _timeSpeed; } + + /** duration of the whole action*/ + virtual void setDuration(int duration) { _duration = duration; } + virtual int getDuration() const { return _duration; } + + /** Start frame index of this action*/ + virtual int getStartFrame() const { return _startFrame; } + + /** End frame of this action. + * When action play to this frame, if action is not loop, then it will stop, + * or it will play from start frame again. */ + virtual int getEndFrame() const { return _endFrame; } + + /** Get current frame. */ + virtual int getCurrentFrame() const { return _currentFrame; } + + /** add Timeline to ActionTimeline */ + virtual void addTimeline(Timeline* timeline); + virtual void removeTimeline(Timeline* timeline); + + virtual const cocos2d::Vector& getTimelines() const { return _timelineList; } + + /** Set ActionTimeline's frame event callback function */ + void setFrameEventCallFunc(std::function listener); + void clearFrameEventCallFunc(); + + /** Inherit from Action. */ + + /** Returns a clone of ActionTimeline */ + virtual ActionTimeline* clone() const override; + + /** Returns a reverse of ActionTimeline. + * Not implement yet. + */ + virtual ActionTimeline* reverse() const override { return nullptr; } + + virtual void step(float delta) override; + virtual void startWithTarget(cocos2d::Node *target) override; + virtual bool isDone() const override { return false; } +protected: + virtual void gotoFrame(int frameIndex); + virtual void stepToFrame(int frameIndex); + + /** emit frame event, call it when enter a frame*/ + virtual void emitFrameEvent(Frame* frame); + + std::map> _timelineMap; + cocos2d::Vector _timelineList; + + int _duration; + double _time; + float _timeSpeed; + float _frameInternal; + bool _playing; + int _currentFrame; + int _startFrame; + int _endFrame; + bool _loop; + + std::function _frameEventListener; +}; + +NS_TIMELINE_END + + +#endif /*__CCTIMELINE_ACTION_H__*/ diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp new file mode 100644 index 0000000000..442d23e501 --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp @@ -0,0 +1,374 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCActionTimelineCache.h" +#include "CCNodeReader.h" +#include "CCFrame.h" +#include "CCTimeLine.h" +#include "CCActionTimeline.h" + +using namespace cocos2d; + +namespace cocostudio { +namespace timeline{ + +static const char* FrameType_VisibleFrame = "VisibleFrame"; +static const char* FrameType_PositionFrame = "PositionFrame"; +static const char* FrameType_ScaleFrame = "ScaleFrame"; +static const char* FrameType_RotationFrame = "RotationFrame"; +static const char* FrameType_SkewFrame = "SkewFrame"; +static const char* FrameType_RotationSkewFrame = "RotationSkewFrame"; +static const char* FrameType_AnchorFrame = "AnchorFrame"; +static const char* FrameType_InnerActionFrame = "InnerActionFrame"; +static const char* FrameType_ColorFrame = "ColorFrame"; +static const char* FrameType_TextureFrame = "TextureFrame"; +static const char* FrameType_EventFrame = "EventFrame"; +static const char* FrameType_ZOrderFrame = "ZOrderFrame"; + +static const char* ACTION = "action"; +static const char* DURATION = "duration"; +static const char* TIMELINES = "timelines"; +static const char* FRAME_TYPE = "frameType"; +static const char* FRAMES = "frames"; +static const char* FRAME_INDEX = "frameIndex"; +static const char* TWEEN = "tween"; +static const char* TIME_SPEED = "speed"; +static const char* ACTION_TAG = "actionTag"; +static const char* INNER_ACTION = "innerActionType"; +static const char* START_FRAME = "startFrame"; + +static const char* X = "x"; +static const char* Y = "y"; +static const char* ROTATION = "rotation"; +static const char* ALPHA = "alpha"; +static const char* RED = "red"; +static const char* GREEN = "green"; +static const char* BLUE = "blue"; +static const char* Value = "value"; + + +static ActionTimelineCache* _sharedActionCache = nullptr; + +ActionTimelineCache* ActionTimelineCache::getInstance() +{ + if (! _sharedActionCache) + { + _sharedActionCache = new ActionTimelineCache(); + _sharedActionCache->init(); + } + + return _sharedActionCache; +} + +void ActionTimelineCache::destroyInstance() +{ + CC_SAFE_DELETE(_sharedActionCache); +} + +void ActionTimelineCache::purge() +{ + _animationActions.clear(); +} + +void ActionTimelineCache::init() +{ + using namespace std::placeholders; + _funcs.insert(Pair(FrameType_VisibleFrame, std::bind(&ActionTimelineCache::loadVisibleFrame, this, _1))); + _funcs.insert(Pair(FrameType_PositionFrame, std::bind(&ActionTimelineCache::loadPositionFrame, this, _1))); + _funcs.insert(Pair(FrameType_ScaleFrame, std::bind(&ActionTimelineCache::loadScaleFrame, this, _1))); + _funcs.insert(Pair(FrameType_RotationFrame, std::bind(&ActionTimelineCache::loadRotationFrame, this, _1))); + _funcs.insert(Pair(FrameType_SkewFrame, std::bind(&ActionTimelineCache::loadSkewFrame, this, _1))); + _funcs.insert(Pair(FrameType_RotationSkewFrame, std::bind(&ActionTimelineCache::loadRotationSkewFrame, this, _1))); + _funcs.insert(Pair(FrameType_AnchorFrame, std::bind(&ActionTimelineCache::loadAnchorPointFrame, this, _1))); + _funcs.insert(Pair(FrameType_InnerActionFrame, std::bind(&ActionTimelineCache::loadInnerActionFrame, this, _1))); + _funcs.insert(Pair(FrameType_ColorFrame, std::bind(&ActionTimelineCache::loadColorFrame, this, _1))); + _funcs.insert(Pair(FrameType_TextureFrame, std::bind(&ActionTimelineCache::loadTextureFrame, this, _1))); + _funcs.insert(Pair(FrameType_EventFrame, std::bind(&ActionTimelineCache::loadEventFrame, this, _1))); + _funcs.insert(Pair(FrameType_ZOrderFrame, std::bind(&ActionTimelineCache::loadZOrderFrame, this, _1))); + +} + +void ActionTimelineCache::removeAction(const std::string& fileName) +{ + if (_animationActions.find(fileName) != _animationActions.end()) + { + _animationActions.erase(fileName); + } +} + +ActionTimeline* ActionTimelineCache::createAction(const std::string& fileName) +{ + ActionTimeline* action = _animationActions.at(fileName); + if (action == nullptr) + { + action = loadAnimationActionWithFile(fileName); + } + return action->clone(); +} + +ActionTimeline* ActionTimelineCache::loadAnimationActionWithFile(const std::string& fileName) +{ + // Read content from file + std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(fileName); + std::string contentStr = FileUtils::getInstance()->getStringFromFile(fullPath); + + return loadAnimationActionWithContent(fileName, contentStr); +} + +ActionTimeline* ActionTimelineCache::loadAnimationActionWithContent(const std::string&fileName, const std::string& content) +{ + // if already exists an action with filename, then return this action + ActionTimeline* action = _animationActions.at(fileName); + if(action) + return action; + + rapidjson::Document doc; + doc.Parse<0>(content.c_str()); + if (doc.HasParseError()) + { + CCLOG("GetParseError %s\n", doc.GetParseError()); + } + + const rapidjson::Value& json = DICTOOL->getSubDictionary_json(doc, ACTION); + + action = ActionTimeline::create(); + + action->setDuration(DICTOOL->getIntValue_json(json, DURATION)); + action->setTimeSpeed(DICTOOL->getFloatValue_json(json, TIME_SPEED, 1.0f)); + + int timelineLength = DICTOOL->getArrayCount_json(json, TIMELINES); + for (int i = 0; igetSubDictionary_json(json, TIMELINES, i); + Timeline* timeline = loadTimeline(dic); + + if(timeline) + action->addTimeline(timeline); + } + + _animationActions.insert(fileName, action); + + return action; +} + + +Timeline* ActionTimelineCache::loadTimeline(const rapidjson::Value& json) +{ + Timeline* timeline = nullptr; + + // get frame type + const char* frameType = DICTOOL->getStringValue_json(json, FRAME_TYPE); + if(frameType == nullptr) + return nullptr; + + if(frameType && _funcs.find(frameType) != _funcs.end()) + { + timeline = Timeline::create(); + + int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG); + timeline->setActionTag(actionTag); + + FrameCreateFunc func = _funcs.at(frameType); + + int length = DICTOOL->getArrayCount_json(json, FRAMES); + for (int i = 0; igetSubDictionary_json(json, FRAMES, i); + + Frame* frame = nullptr; + + if (func != nullptr) + { + frame = func(dic); + + int frameIndex = DICTOOL->getIntValue_json(dic, FRAME_INDEX); + frame->setFrameIndex(frameIndex); + + bool tween = DICTOOL->getBooleanValue_json(dic, TWEEN, false); + frame->setTween(tween); + } + + timeline->addFrame(frame); + } + } + + return timeline; +} + +Frame* ActionTimelineCache::loadVisibleFrame(const rapidjson::Value& json) +{ + VisibleFrame* frame = VisibleFrame::create(); + + bool visible = DICTOOL->getBooleanValue_json(json, Value); + frame->setVisible(visible); + + return frame; +} + +Frame* ActionTimelineCache::loadPositionFrame(const rapidjson::Value& json) +{ + PositionFrame* frame = PositionFrame::create(); + + float x = DICTOOL->getFloatValue_json(json, X); + float y = DICTOOL->getFloatValue_json(json, Y); + frame->setPosition(Point(x,y)); + + return frame; +} + +Frame* ActionTimelineCache::loadScaleFrame(const rapidjson::Value& json) +{ + ScaleFrame* frame = ScaleFrame::create(); + + float scalex = DICTOOL->getFloatValue_json(json, X); + float scaley = DICTOOL->getFloatValue_json(json, Y); + + frame->setScaleX(scalex); + frame->setScaleY(scaley); + + return frame; +} + +Frame* ActionTimelineCache::loadSkewFrame(const rapidjson::Value& json) +{ + SkewFrame* frame = SkewFrame::create(); + + float skewx = DICTOOL->getFloatValue_json(json, X); + float skewy = DICTOOL->getFloatValue_json(json, Y); + + frame->setSkewX(skewx); + frame->setSkewY(skewy); + + return frame; +} + +Frame* ActionTimelineCache::loadRotationSkewFrame(const rapidjson::Value& json) +{ + RotationSkewFrame* frame = RotationSkewFrame::create(); + + float skewx = DICTOOL->getFloatValue_json(json, X); + float skewy = DICTOOL->getFloatValue_json(json, Y); + + frame->setSkewX(skewx); + frame->setSkewY(skewy); + + return frame; +} + +Frame* ActionTimelineCache::loadRotationFrame(const rapidjson::Value& json) +{ + RotationFrame* frame = RotationFrame::create(); + + float rotation = DICTOOL->getFloatValue_json(json, ROTATION); + frame->setRotation(rotation); + + return frame; +} + +Frame* ActionTimelineCache::loadAnchorPointFrame (const rapidjson::Value& json) +{ + AnchorPointFrame* frame = AnchorPointFrame::create(); + + float anchorx = DICTOOL->getFloatValue_json(json, X); + float anchory = DICTOOL->getFloatValue_json(json, Y); + + frame->setAnchorPoint(Point(anchorx, anchory)); + + return frame; +} + +Frame* ActionTimelineCache::loadInnerActionFrame(const rapidjson::Value& json) +{ + InnerActionFrame* frame = InnerActionFrame::create(); + + InnerActionType type = (InnerActionType)DICTOOL->getIntValue_json(json, INNER_ACTION); + int startFrame = DICTOOL->getIntValue_json(json, START_FRAME); + + frame->setInnerActionType(type); + frame->setStartFrameIndex(startFrame); + + return frame; +} + +Frame* ActionTimelineCache::loadColorFrame(const rapidjson::Value& json) +{ + ColorFrame* frame = ColorFrame::create(); + + GLubyte alpha = (GLubyte)DICTOOL->getIntValue_json(json, ALPHA); + GLubyte red = (GLubyte)DICTOOL->getIntValue_json(json, RED); + GLubyte green = (GLubyte)DICTOOL->getIntValue_json(json, GREEN); + GLubyte blue = (GLubyte)DICTOOL->getIntValue_json(json, BLUE); + + frame->setAlpha(alpha); + frame->setColor(Color3B(red, green, blue)); + + return frame; +} + +Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json) +{ + TextureFrame* frame = TextureFrame::create(); + + const char* texture = DICTOOL->getStringValue_json(json, Value); + + if(texture != NULL) + { + std::string path = texture; + + SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(path); + if(spriteFrame == nullptr) + { + std::string jsonPath = NodeReader::getInstance()->getJsonPath(); + path = jsonPath + texture; + } + + frame->setTextureName(path); + } + return frame; +} + +Frame* ActionTimelineCache::loadEventFrame(const rapidjson::Value& json) +{ + EventFrame* frame = EventFrame::create(); + + const char* evnt = DICTOOL->getStringValue_json(json, Value); + + if(evnt != NULL) + frame->setEvent(evnt); + + return frame; +} + +Frame* ActionTimelineCache::loadZOrderFrame(const rapidjson::Value& json) +{ + ZOrderFrame* frame = ZOrderFrame::create(); + + int zorder = DICTOOL->getIntValue_json(json, Value); + frame->setZOrder(zorder); + + return frame; +} + +} +} \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h new file mode 100644 index 0000000000..3f9547e822 --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h @@ -0,0 +1,87 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCTIMELINE_ACTION_CACHE_H__ +#define __CCTIMELINE_ACTION_CACHE_H__ + +#include "cocos2d.h" +#include "cocostudio/DictionaryHelper.h" +#include "CCTimelineMacro.h" + +NS_TIMELINE_BEGIN + +class ActionTimeline; +class Timeline; +class Frame; + +class ActionTimelineCache +{ +public: + /** Gets the singleton */ + static ActionTimelineCache* getInstance(); + + /** Destroys the singleton */ + static void destroyInstance(); + + void purge(); + + void init(); + + /** Remove action with filename, and also remove other resource relate with this file */ + void removeAction(const std::string& fileName); + + /** Clone a action with the specified name from the container. */ + ActionTimeline* createAction(const std::string& fileName); + + ActionTimeline* loadAnimationActionWithFile(const std::string& fileName); + ActionTimeline* loadAnimationActionWithContent(const std::string&fileName, const std::string& content); +protected: + + Timeline* loadTimeline(const rapidjson::Value& json); + + Frame* loadVisibleFrame (const rapidjson::Value& json); + Frame* loadPositionFrame (const rapidjson::Value& json); + Frame* loadScaleFrame (const rapidjson::Value& json); + Frame* loadSkewFrame (const rapidjson::Value& json); + Frame* loadRotationSkewFrame(const rapidjson::Value& json); + Frame* loadRotationFrame (const rapidjson::Value& json); + Frame* loadAnchorPointFrame (const rapidjson::Value& json); + Frame* loadInnerActionFrame (const rapidjson::Value& json); + Frame* loadColorFrame (const rapidjson::Value& json); + Frame* loadTextureFrame (const rapidjson::Value& json); + Frame* loadEventFrame (const rapidjson::Value& json); + Frame* loadZOrderFrame (const rapidjson::Value& json); + +protected: + + typedef std::function FrameCreateFunc; + typedef std::pair Pair; + + std::unordered_map _funcs; + cocos2d::Map _animationActions; +}; + +NS_TIMELINE_END + +#endif /*__CCTIMELINE_ACTION_CACHE_H__*/ diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp new file mode 100644 index 0000000000..00facfb6ba --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp @@ -0,0 +1,622 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCFrame.h" +#include "CCTimeLine.h" +#include "CCActionTimeline.h" + +USING_NS_CC; + +NS_TIMELINE_BEGIN + +// Frame +Frame::Frame() + : _frameIndex(0) + , _tween(true) + , _timeline(nullptr) + , _node(nullptr) +{ +} + +Frame::~Frame() +{ +} + +void Frame::emitEvent() +{ + if (_timeline) + { + _timeline->getActionTimeline()->emitFrameEvent(this); + } +} + +void Frame::cloneProperty(Frame* frame) +{ + _frameIndex = frame->getFrameIndex(); + _tween = frame->isTween(); +} + + +// VisibleFrame +VisibleFrame* VisibleFrame::create() +{ + VisibleFrame* frame = new VisibleFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +VisibleFrame::VisibleFrame() + : _visible(true) +{ +} + +void VisibleFrame::onEnter(Frame *nextFrame) +{ + _node->setVisible(_visible); +} + + +Frame* VisibleFrame::clone() +{ + VisibleFrame* frame = VisibleFrame::create(); + frame->setVisible(_visible); + + frame->cloneProperty(this); + + return frame; +} + + + +// TextureFrame +TextureFrame* TextureFrame::create() +{ + TextureFrame* frame = new TextureFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +TextureFrame::TextureFrame() + : _textureName("") +{ +} + +void TextureFrame::setNode(Node* node) +{ + Frame::setNode(node); + + _sprite = dynamic_cast(node); +} + +void TextureFrame::onEnter(Frame *nextFrame) +{ + if(_sprite) + { + SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(_textureName); + + if(spriteFrame != nullptr) + _sprite->setSpriteFrame(spriteFrame); + else + _sprite->setTexture(_textureName); + } +} + + +Frame* TextureFrame::clone() +{ + TextureFrame* frame = TextureFrame::create(); + frame->setTextureName(_textureName); + + frame->cloneProperty(this); + + return frame; +} + + + +// RotationFrame +RotationFrame* RotationFrame::create() +{ + RotationFrame* frame = new RotationFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +RotationFrame::RotationFrame() + : _rotation(0) +{ +} + +void RotationFrame::onEnter(Frame *nextFrame) +{ + _node->setRotation(_rotation); + + if(_tween) + { + _betwennRotation = static_cast(nextFrame)->_rotation - _rotation; + } +} + +void RotationFrame::apply(float percent) +{ + if (_tween && percent != 0 || _betwennRotation != 0) + { + float rotation = _rotation + percent * _betwennRotation; + _node->setRotation(rotation); + } +} + +Frame* RotationFrame::clone() +{ + RotationFrame* frame = RotationFrame::create(); + frame->setRotation(_rotation); + + frame->cloneProperty(this); + + return frame; +} + + + +// SkewFrame +SkewFrame* SkewFrame::create() +{ + SkewFrame* frame = new SkewFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +SkewFrame::SkewFrame() + : _skewX(0) + , _skewY(0) +{ +} + +void SkewFrame::onEnter(Frame *nextFrame) +{ + _node->setSkewX(_skewX); + _node->setSkewY(_skewY); + + if(_tween) + { + _betweenSkewX = static_cast(nextFrame)->_skewX - _skewX; + _betweenSkewY = static_cast(nextFrame)->_skewY - _skewY; + } +} + +void SkewFrame::apply(float percent) +{ + if (_tween && percent != 0 || (_betweenSkewX != 0 || _betweenSkewY != 0)) + { + float skewx = _skewX + percent * _betweenSkewX; + float skewy = _skewY + percent * _betweenSkewY; + + _node->setSkewX(skewx); + _node->setSkewY(skewy); + } +} + +Frame* SkewFrame::clone() +{ + SkewFrame* frame = SkewFrame::create(); + frame->setSkewX(_skewX); + frame->setSkewY(_skewY); + + frame->cloneProperty(this); + + return frame; +} + + + + +// RotationSkewFrame +RotationSkewFrame* RotationSkewFrame::create() +{ + RotationSkewFrame* frame = new RotationSkewFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +RotationSkewFrame::RotationSkewFrame() +{ +} + +void RotationSkewFrame::onEnter(Frame *nextFrame) +{ + _node->setRotationSkewX(_skewX); + _node->setRotationSkewY(_skewY); + + if (_tween) + { + _betweenSkewX = static_cast(nextFrame)->_skewX - _skewX; + _betweenSkewY = static_cast(nextFrame)->_skewY - _skewY; + } +} + +void RotationSkewFrame::apply(float percent) +{ + if (_tween && percent != 0 || (_betweenSkewX != 0 || _betweenSkewY != 0)) + { + float skewx = _skewX + percent * _betweenSkewX; + float skewy = _skewY + percent * _betweenSkewY; + + _node->setRotationSkewX(skewx); + _node->setRotationSkewY(skewy); + } +} + +Frame* RotationSkewFrame::clone() +{ + RotationSkewFrame* frame = RotationSkewFrame::create(); + frame->setSkewX(_skewX); + frame->setSkewY(_skewY); + + frame->cloneProperty(this); + + return frame; +} + + +// PositionFrame +PositionFrame* PositionFrame::create() +{ + PositionFrame* frame = new PositionFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +PositionFrame::PositionFrame() + : _position(0,0) +{ +} + +void PositionFrame::onEnter(Frame *nextFrame) +{ + _node->setPosition(_position); + + if(_tween) + { + _betweenX = static_cast(nextFrame)->_position.x - _position.x; + _betweenY = static_cast(nextFrame)->_position.y - _position.y; + } +} + +void PositionFrame::apply(float percent) +{ + if (_tween && percent != 0 || (_betweenX != 0 || _betweenY != 0)) + { + Point p; + p.x = _position.x + _betweenX * percent; + p.y = _position.y + _betweenY * percent; + + _node->setPosition(p); + } +} + +Frame* PositionFrame::clone() +{ + PositionFrame* frame = PositionFrame::create(); + frame->setPosition(_position); + + frame->cloneProperty(this); + + return frame; +} + + +// ScaleFrame +ScaleFrame* ScaleFrame::create() +{ + ScaleFrame* frame = new ScaleFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +ScaleFrame::ScaleFrame() + : _scaleX(1) + , _scaleY(1) +{ +} + +void ScaleFrame::onEnter(Frame *nextFrame) +{ + _node->setScaleX(_scaleX); + _node->setScaleY(_scaleY); + + if(_tween) + { + _betweenScaleX = static_cast(nextFrame)->_scaleX - _scaleX; + _betweenScaleY = static_cast(nextFrame)->_scaleY - _scaleY; + } +} + +void ScaleFrame::apply(float percent) +{ + if (_tween && percent != 0 || (_betweenScaleX != 0 || _betweenScaleY != 0)) + { + float scaleX = _scaleX + _betweenScaleX * percent; + float scaleY = _scaleY + _betweenScaleY * percent; + + _node->setScaleX(scaleX); + _node->setScaleY(scaleY); + } +} + +Frame* ScaleFrame::clone() +{ + ScaleFrame* frame = ScaleFrame::create(); + frame->setScaleX(_scaleX); + frame->setScaleY(_scaleY); + + frame->cloneProperty(this); + + return frame; +} + + +// AnchorPointFrame +AnchorPointFrame* AnchorPointFrame::create() +{ + AnchorPointFrame* frame = new AnchorPointFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +AnchorPointFrame::AnchorPointFrame() + : _anchorPoint(0.5f,0.5f) +{ +} + +void AnchorPointFrame::onEnter(Frame *nextFrame) +{ + _node->setAnchorPoint(_anchorPoint); +} + + +Frame* AnchorPointFrame::clone() +{ + AnchorPointFrame* frame = AnchorPointFrame::create(); + frame->setAnchorPoint(_anchorPoint); + + frame->cloneProperty(this); + + return frame; +} + + + +// InnerActionFrame +InnerActionFrame* InnerActionFrame::create() +{ + InnerActionFrame* frame = new InnerActionFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +InnerActionFrame::InnerActionFrame() + : _innerActionType(LoopAction) + , _startFrameIndex(0) +{ +} + +void InnerActionFrame::onEnter(Frame *nextFrame) +{ +} + + +Frame* InnerActionFrame::clone() +{ + InnerActionFrame* frame = InnerActionFrame::create(); + frame->setInnerActionType(_innerActionType); + frame->setStartFrameIndex(_startFrameIndex); + + frame->cloneProperty(this); + + return frame; +} + + +// ColorFrame +ColorFrame* ColorFrame::create() +{ + ColorFrame* frame = new ColorFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +ColorFrame::ColorFrame() + : _alpha(255) + , _color(Color3B(255, 255, 255)) +{ +} + +void ColorFrame::onEnter(Frame *nextFrame) +{ + _node->setOpacity(_alpha); + _node->setColor(_color); + + if(_tween) + { + _betweenAlpha = static_cast(nextFrame)->_alpha - _alpha; + + const Color3B& color = static_cast(nextFrame)->_color; + _betweenRed = color.r - _color.r; + _betweenGreen = color.g - _color.g; + _betweenBlue = color.b - _color.b; + } + + _node->setCascadeColorEnabled(true); + _node->setCascadeOpacityEnabled(true); +} + +void ColorFrame::apply(float percent) +{ + if (_tween && percent != 0 || (_betweenAlpha !=0 || _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)) + { + GLubyte alpha = _alpha + _betweenAlpha * percent; + + Color3B color; + color.r = _color.r+ _betweenRed * percent; + color.g = _color.g+ _betweenGreen * percent; + color.b = _color.b+ _betweenBlue * percent; + + _node->setOpacity(alpha); + _node->setColor(color); + } +} + +Frame* ColorFrame::clone() +{ + ColorFrame* frame = ColorFrame::create(); + frame->setAlpha(_alpha); + frame->setColor(_color); + + frame->cloneProperty(this); + + return frame; +} + + +// EventFrame +EventFrame* EventFrame::create() +{ + EventFrame* frame = new EventFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +EventFrame::EventFrame() + : _event("") +{ +} + +void EventFrame::onEnter(Frame *nextFrame) +{ + emitEvent(); +} + + +Frame* EventFrame::clone() +{ + EventFrame* frame = EventFrame::create(); + frame->setEvent(_event); + + frame->cloneProperty(this); + + return frame; +} + + +// ZOrderFrame +ZOrderFrame* ZOrderFrame::create() +{ + ZOrderFrame* frame = new ZOrderFrame(); + if (frame) + { + frame->autorelease(); + return frame; + } + CC_SAFE_DELETE(frame); + return NULL; +} + +ZOrderFrame::ZOrderFrame() + : _zorder(0) +{ +} + +void ZOrderFrame::onEnter(Frame *nextFrame) +{ + if(_node) + _node->setZOrder(_zorder); +} + + +Frame* ZOrderFrame::clone() +{ + ZOrderFrame* frame = ZOrderFrame::create(); + frame->setZOrder(_zorder); + + frame->cloneProperty(this); + + return frame; +} + +NS_TIMELINE_END diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h new file mode 100644 index 0000000000..c049eebd66 --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h @@ -0,0 +1,330 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCFRAME_H__ +#define __CCFRAME_H__ + +#include "cocos2d.h" +#include "CCTimelineMacro.h" + +NS_TIMELINE_BEGIN + +class Timeline; + +class Frame : public cocos2d::Ref +{ +public: + + virtual void setFrameIndex(unsigned int frameIndex) { _frameIndex = frameIndex; } + virtual unsigned int getFrameIndex() const { return _frameIndex; } + + virtual void setTimeline(Timeline* timeline) { _timeline = timeline; } + virtual Timeline* getTimeline() const { return _timeline; } + + virtual void setNode(cocos2d::Node* node) { _node = node; } + virtual cocos2d::Node* getNode() const { return _node; } + + virtual void setTween(bool tween) { _tween = tween; } + virtual bool isTween() const { return _tween; } + + virtual void onEnter(Frame *nextFrame) = 0; + virtual void apply(float percent) {} + + virtual Frame* clone() = 0; +protected: + Frame(); + virtual ~Frame(); + + virtual void emitEvent(); + virtual void cloneProperty(Frame* frame); +protected: + + unsigned int _frameIndex; + bool _tween; + + Timeline* _timeline; + cocos2d::Node* _node; +}; + + +class VisibleFrame : public Frame +{ +public: + static VisibleFrame* create(); + + VisibleFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual Frame* clone() override; + + inline void setVisible(bool visible) { _visible = visible;} + inline bool isVisible() const { return _visible; } + +protected: + bool _visible; +}; + + +class TextureFrame : public Frame +{ +public: + static TextureFrame* create(); + + TextureFrame(); + + virtual void setNode(cocos2d::Node* node); + + virtual void onEnter(Frame *nextFrame) override; + virtual Frame* clone() override; + + inline void setTextureName(std::string textureName) { _textureName = textureName;} + inline std::string getTextureName() const { return _textureName; } + +protected: + cocos2d::Sprite* _sprite; + std::string _textureName; +}; + +class RotationFrame : public Frame +{ +public: + static RotationFrame* create(); + + RotationFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual void apply(float percent) override; + virtual Frame* clone() override; + + inline void setRotation(float rotation) { _rotation = rotation; } + inline float getRotation() const { return _rotation; } + +protected: + float _rotation; + float _betwennRotation; +}; + +class SkewFrame : public Frame +{ +public: + static SkewFrame* create(); + + SkewFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual void apply(float percent) override; + virtual Frame* clone() override; + + inline void setSkewX(float skewx) { _skewX = skewx; } + inline float getSkewX() const { return _skewX; } + + inline void setSkewY(float skewy) { _skewY = skewy; } + inline float getSkewY() const { return _skewY; } + +protected: + float _skewX; + float _skewY; + float _betweenSkewX; + float _betweenSkewY; +}; + + +class RotationSkewFrame : public SkewFrame +{ +public: + static RotationSkewFrame* create(); + + RotationSkewFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual void apply(float percent) override; + virtual Frame* clone() override; +}; + + +class PositionFrame : public Frame +{ +public: + static PositionFrame* create(); + + PositionFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual void apply(float percent) override; + virtual Frame* clone() override; + + inline void setPosition(const cocos2d::Point& position) { _position = position; } + inline cocos2d::Point getPosition() const { return _position; } + + inline void setX(float x) { _position.x = x; } + inline void setY(float y) { _position.y = y; } + + inline float getX() const { return _position.x; } + inline float getY() const { return _position.y; } +protected: + cocos2d::Point _position; + float _betweenX; + float _betweenY; +}; + + +class ScaleFrame : public Frame +{ +public: + static ScaleFrame* create(); + + ScaleFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual void apply(float percent) override; + virtual Frame* clone() override; + + inline void setScale(float scale) { _scaleX = scale; _scaleY = scale; } + + inline void setScaleX(float scaleX) { _scaleX = scaleX; } + inline float getScaleX() const { return _scaleX; } + + inline void setScaleY(float scaleY) { _scaleY = scaleY;} + inline float getScaleY() const { return _scaleY; } + +protected: + float _scaleX; + float _scaleY; + float _betweenScaleX; + float _betweenScaleY; +}; + + +class AnchorPointFrame : public Frame +{ +public: + static AnchorPointFrame* create(); + + AnchorPointFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual Frame* clone() override; + + inline void setAnchorPoint(const cocos2d::Point& point) { _anchorPoint = point; } + inline cocos2d::Point getAnchorPoint() const { return _anchorPoint; } + +protected: + cocos2d::Point _anchorPoint; +}; + + + +enum InnerActionType +{ + LoopAction, + NoLoopAction, + SingleFrame +}; + +class InnerActionFrame : public Frame +{ +public: + static InnerActionFrame* create(); + InnerActionFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual Frame* clone() override; + + inline void setInnerActionType(InnerActionType type) { _innerActionType = type; } + inline InnerActionType getInnerActionType() const { return _innerActionType; } + + inline void setStartFrameIndex(int frameIndex) { _startFrameIndex = frameIndex; } + inline int getStartFrameIndex() const { return _startFrameIndex; } + +protected: + InnerActionType _innerActionType; + int _startFrameIndex; +}; + + +class ColorFrame : public Frame +{ +public: + static ColorFrame* create(); + ColorFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual void apply(float percent) override; + virtual Frame* clone() override; + + inline void setAlpha(GLubyte alpha) { _alpha = alpha; } + inline GLubyte getAlpha() const { return _alpha; } + + inline void setColor(const cocos2d::Color3B& color) { _color = color; } + inline cocos2d::Color3B getColor() const { return _color; } + +protected: + GLubyte _alpha; + cocos2d::Color3B _color; + + int _betweenAlpha; + int _betweenRed; + int _betweenGreen; + int _betweenBlue; +}; + + +class EventFrame : public Frame +{ +public: + static EventFrame* create(); + + EventFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual Frame* clone() override; + + inline void setEvent(std::string event) { _event = event;} + inline std::string getEvent() const { return _event; } + +protected: + std::string _event; +}; + +class ZOrderFrame : public Frame +{ +public: + static ZOrderFrame* create(); + + ZOrderFrame(); + + virtual void onEnter(Frame *nextFrame) override; + virtual Frame* clone() override; + + inline void setZOrder(int zorder) { _zorder = zorder;} + inline int getZOrder() const { return _zorder; } + +protected: + int _zorder; +}; + +NS_TIMELINE_END + + +#endif /*__CCFRAME_H__*/ diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp new file mode 100644 index 0000000000..9991baff0b --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp @@ -0,0 +1,457 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCNodeReader.h" +#include "CCActionTimelineCache.h" +#include "CCActionTimeline.h" + +#include "../CCSGUIReader.h" + +using namespace cocos2d; +using namespace ui; + +namespace cocostudio { +namespace timeline{ + + +static const char* ClassName_Node = "Node"; +static const char* ClassName_SubGraph = "SubGraph"; +static const char* ClassName_Sprite = "Sprite"; +static const char* ClassName_Particle = "Particle"; + +static const char* ClassName_Panel = "Panel"; +static const char* ClassName_Button = "Button"; +static const char* ClassName_CheckBox = "CheckBox"; +static const char* ClassName_ImageView = "ImageView"; +static const char* ClassName_TextAtlas = "TextAtlas"; +static const char* ClassName_TextBMFont = "TextBMFont"; +static const char* ClassName_Text = "Text"; +static const char* ClassName_LoadingBar = "LoadingBar"; +static const char* ClassName_TextField = "TextField"; +static const char* ClassName_Slider = "Slider"; +static const char* ClassName_Layout = "Layout"; +static const char* ClassName_ScrollView = "ScrollView"; +static const char* ClassName_ListView = "ListView"; +static const char* ClassName_PageView = "PageView"; +static const char* ClassName_Widget = "Widget"; +static const char* ClassName_Label = "Label"; + + +static const char* NODE = "nodeTree"; +static const char* CHILDREN = "children"; +static const char* CLASSNAME = "classname"; +static const char* FILE_PATH = "fileName"; +static const char* PLIST_FILE = "plistFile"; +static const char* TAG = "tag"; +static const char* ACTION_TAG = "actionTag"; + +static const char* OPTIONS = "options"; + +static const char* WIDTH = "width"; +static const char* HEIGHT = "height"; +static const char* X = "x"; +static const char* Y = "y"; +static const char* SCALE_X = "scaleX"; +static const char* SCALE_Y = "scaleY"; +static const char* SKEW_X = "skewX"; +static const char* SKEW_Y = "skewY"; +static const char* ROTATION = "rotation"; +static const char* ROTATION_SKEW_X = "rotationSkewX"; +static const char* ROTATION_SKEW_Y = "rotationSkewY"; +static const char* ANCHOR_X = "anchorPointX"; +static const char* ANCHOR_Y = "anchorPointY"; +static const char* ALPHA = "opacity"; +static const char* RED = "colorR"; +static const char* GREEN = "colorG"; +static const char* BLUE = "colorB"; +static const char* ZORDER = "ZOrder"; +static const char* PARTICLE_NUM = "particleNum"; +static const char* FLIPX = "flipX"; +static const char* FLIPY = "flipY"; +static const char* VISIBLE = "visible"; + +static const char* TEXTURES = "textures"; +static const char* TEXTURES_PNG = "texturesPng"; + + +// NodeReader +static NodeReader* _sharedNodeReader = nullptr; + +NodeReader* NodeReader::getInstance() +{ + if (! _sharedNodeReader) + { + _sharedNodeReader = new NodeReader(); + _sharedNodeReader->init(); + } + + return _sharedNodeReader; +} + +void NodeReader::destroyInstance() +{ + CC_SAFE_DELETE(_sharedNodeReader); +} + +NodeReader::NodeReader() + : _recordJsonPath(true) + , _jsonPath("") +{ +} + +void NodeReader::purge() +{ +} + +void NodeReader::init() +{ + using namespace std::placeholders; + + _funcs.insert(Pair(ClassName_Node, std::bind(&NodeReader::loadSimpleNode, this, _1))); + _funcs.insert(Pair(ClassName_SubGraph, std::bind(&NodeReader::loadSubGraph, this, _1))); + _funcs.insert(Pair(ClassName_Sprite, std::bind(&NodeReader::loadSprite, this, _1))); + _funcs.insert(Pair(ClassName_Particle, std::bind(&NodeReader::loadParticle, this, _1))); + + _funcs.insert(Pair(ClassName_Panel, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_Button, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_CheckBox, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_ImageView, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_TextAtlas, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_TextBMFont,std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_Text, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_LoadingBar,std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_TextField, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_Slider, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_Layout, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_ScrollView,std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_ListView, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_PageView, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_Widget, std::bind(&NodeReader::loadWidget, this, _1))); + _funcs.insert(Pair(ClassName_Label, std::bind(&NodeReader::loadWidget, this, _1))); + + _guiReader = new WidgetPropertiesReader0300(); +} + +Node* NodeReader::createNode(const std::string& filename) +{ + if(_recordJsonPath) + { + std::string jsonPath = filename.substr(0, filename.find_last_of('/') + 1); + GUIReader::getInstance()->setFilePath(jsonPath); + + _jsonPath = jsonPath; + } + else + { + GUIReader::getInstance()->setFilePath(""); + _jsonPath = ""; + } + + Node* node = loadNodeWithFile(filename); + + return node; +} + +Node* NodeReader::loadNodeWithFile(const std::string& fileName) +{ + // Read content from file + std::string contentStr = FileUtils::getInstance()->getStringFromFile(fileName); + + Node* node = loadNodeWithContent(contentStr); + + // Load animation data from file + ActionTimelineCache::getInstance()->loadAnimationActionWithContent(fileName, contentStr); + + return node; +} + +Node* NodeReader::loadNodeWithContent(const std::string& content) +{ + rapidjson::Document doc; + doc.Parse<0>(content.c_str()); + if (doc.HasParseError()) + { + CCLOG("GetParseError %s\n", doc.GetParseError()); + } + + // decode plist + int length = DICTOOL->getArrayCount_json(doc, TEXTURES); + + for(int i=0; igetStringValueFromArray_json(doc, TEXTURES, i); + std::string png = DICTOOL->getStringValueFromArray_json(doc, TEXTURES_PNG, i); + plist = _jsonPath + plist; + png = _jsonPath + png; + SpriteFrameCache::getInstance()->addSpriteFramesWithFile(plist, png); + } + + // decode node tree + const rapidjson::Value& subJson = DICTOOL->getSubDictionary_json(doc, NODE); + Node* root = loadNode(subJson); + root->release(); + + return root; +} + +Node* NodeReader::loadNode(const rapidjson::Value& json) +{ + Node* node = nullptr; + std::string nodeType = DICTOOL->getStringValue_json(json, CLASSNAME); + + NodeCreateFunc func = _funcs.at(nodeType); + if (func != nullptr) + { + const rapidjson::Value& options = DICTOOL->getSubDictionary_json(json, OPTIONS); + node = func(options); + } + + if(node) + { + int length = DICTOOL->getArrayCount_json(json, CHILDREN, 0); + for (int i = 0; igetSubDictionary_json(json, CHILDREN, i); + Node* child = loadNode(dic); + if (child) + { + node->addChild(child); + child->release(); + } + } + } + else + { + CCLOG("Not supported NodeType: %s", nodeType.c_str()); + } + + return node; +} + +void NodeReader::initNode(Node* node, const rapidjson::Value& json) +{ + float width = DICTOOL->getFloatValue_json(json, WIDTH); + float height = DICTOOL->getFloatValue_json(json, HEIGHT); + float x = DICTOOL->getFloatValue_json(json, X); + float y = DICTOOL->getFloatValue_json(json, Y); + float scalex = DICTOOL->getFloatValue_json(json, SCALE_X, 1); + float scaley = DICTOOL->getFloatValue_json(json, SCALE_Y, 1); + float rotation = DICTOOL->getFloatValue_json(json, ROTATION); + float rotationSkewX = DICTOOL->getFloatValue_json(json, ROTATION_SKEW_X); + float rotationSkewY = DICTOOL->getFloatValue_json(json, ROTATION_SKEW_Y); + float skewx = DICTOOL->getFloatValue_json(json, SKEW_X); + float skewy = DICTOOL->getFloatValue_json(json, SKEW_Y); + float anchorx = DICTOOL->getFloatValue_json(json, ANCHOR_X, 0.5f); + float anchory = DICTOOL->getFloatValue_json(json, ANCHOR_Y, 0.5f); + GLubyte alpha = (GLubyte)DICTOOL->getIntValue_json(json, ALPHA, 255); + GLubyte red = (GLubyte)DICTOOL->getIntValue_json(json, RED, 255); + GLubyte green = (GLubyte)DICTOOL->getIntValue_json(json, GREEN, 255); + GLubyte blue = (GLubyte)DICTOOL->getIntValue_json(json, BLUE, 255); + int zorder = DICTOOL->getIntValue_json(json, ZORDER); + int tag = DICTOOL->getIntValue_json(json, TAG); + int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG); + bool visible = DICTOOL->getBooleanValue_json(json, VISIBLE); + + if(x != 0 || y != 0) + node->setPosition(Point(x, y)); + if(scalex != 1) + node->setScaleX(scalex); + if(scaley != 1) + node->setScaleY(scaley); + if (rotation != 0) + node->setRotation(rotation); + if(rotationSkewX != 0) + node->setRotationX(rotationSkewX); + if(rotationSkewY != 0) + node->setRotationY(rotationSkewY); + if(skewx != 0) + node->setSkewX(skewx); + if(skewy != 0) + node->setSkewY(skewy); + if(anchorx != 0.5f || anchory != 0.5f) + node->setAnchorPoint(Point(anchorx, anchory)); + if(width != 0 || height != 0) + node->setContentSize(Size(width, height)); + if(zorder != 0) + node->setZOrder(zorder); + if(visible != true) + node->setVisible(visible); + + if(alpha != 255) + { + node->setOpacity(alpha); + node->setCascadeOpacityEnabled(true); + } + if(red != 255 || green != 255 || blue != 255) + { + node->setColor(Color3B(red, green, blue)); + node->setCascadeColorEnabled(true); + } + + + node->setTag(tag); + node->setUserObject(ActionTimelineData::create(actionTag)); +} + +Node* NodeReader::loadSimpleNode(const rapidjson::Value& json) +{ + Node* node = Node::create(); + node->retain(); + initNode(node, json); + + return node; +} + +Node* NodeReader::loadSubGraph(const rapidjson::Value& json) +{ + const char* filePath = DICTOOL->getStringValue_json(json, FILE_PATH); + + Node* node = nullptr; + if (filePath && strcmp("", filePath) != 0) + { + node = createNode(filePath); + } + else + { + node = Node::create(); + } + + node->retain(); + + initNode(node, json); + + return node; +} + +Node* NodeReader::loadSprite(const rapidjson::Value& json) +{ + const char* filePath = DICTOOL->getStringValue_json(json, FILE_PATH); + Sprite *sprite = nullptr; + + if(filePath != nullptr) + { + std::string path = filePath; + + SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(path); + if(!spriteFrame) + { + path = _jsonPath + path; + sprite = Sprite::create(path); + } + else + { + sprite = Sprite::createWithSpriteFrame(spriteFrame); + } + + if(!sprite) + { + sprite = CCSprite::create(); + CCLOG("filePath is empty. Create a sprite with no texture"); + } + } + else + { + sprite = Sprite::create(); + } + + sprite->retain(); + + initNode(sprite, json); + + bool flipX = DICTOOL->getBooleanValue_json(json, FLIPX); + bool flipY = DICTOOL->getBooleanValue_json(json, FLIPY); + + if(flipX != false) + sprite->setFlipX(flipX); + if(flipY != false) + sprite->setFlipY(flipY); + + return sprite; +} + +Node* NodeReader::loadParticle(const rapidjson::Value& json) +{ + const char* filePath = DICTOOL->getStringValue_json(json, PLIST_FILE); + int num = DICTOOL->getIntValue_json(json, PARTICLE_NUM); + + ParticleSystemQuad* particle = ParticleSystemQuad::create(filePath); + particle->setTotalParticles(num); + particle->retain(); + + initNode(particle, json); + + return particle; +} + +Node* NodeReader::loadWidget(const rapidjson::Value& json) +{ + const char* str = DICTOOL->getStringValue_json(json, CLASSNAME); + if(str == nullptr) + return nullptr; + + std::string classname = str; + + if (classname == "Panel") + { + classname = "Layout"; + } + else if (classname == "TextArea") + { + classname = "Text"; + } + else if (classname == "TextButton") + { + classname = "Button"; + } + else if (classname == "Label") + { + classname = "Text"; + } + else if (classname == "LabelAtlas") + { + classname = "TextAtlas"; + } + else if (classname == "LabelBMFont") + { + classname = "TextBMFont"; + } + + std::string readerName = classname; + readerName.append("Reader"); + + Widget* widget = dynamic_cast(ObjectFactory::getInstance()->createObject(classname)); + widget->retain(); + + WidgetReaderProtocol* reader = dynamic_cast(ObjectFactory::getInstance()->createObject(readerName)); + + _guiReader->setPropsForAllWidgetFromJsonDictionary(reader, widget, json); + + int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG); + widget->setUserObject(ActionTimelineData::create(actionTag)); + + return widget; +} + +} +} diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.h b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.h new file mode 100644 index 0000000000..80a8a671ac --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.h @@ -0,0 +1,91 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CC_NODE_CACHE_H__ +#define __CC_NODE_CACHE_H__ + +#include "cocostudio/DictionaryHelper.h" +#include "cocos2d.h" + +namespace cocostudio { + +class WidgetPropertiesReader0300; + +namespace timeline{ + +class NodeReader +{ +public: + static NodeReader* getInstance(); + static void destroyInstance(); + + NodeReader(); + void purge(); + + void init(); + + cocos2d::Node* createNode(const std::string& filename); + + cocos2d::Node* loadNodeWithFile(const std::string& fileName); + cocos2d::Node* loadNodeWithContent(const std::string& content); + + void setRecordJsonPath(bool record) { _recordJsonPath = record; } + bool isRecordJsonPath() const { return _recordJsonPath; } + + void setJsonPath(std::string jsonPath) { _jsonPath = jsonPath; } + std::string getJsonPath() const { return _jsonPath; } + +protected: + + cocos2d::Node* loadNode(const rapidjson::Value& json); + + void locateNodeWithMulresPosition(cocos2d::Node* node, const rapidjson::Value& json); + + void initNode(cocos2d::Node* node, const rapidjson::Value& json); + + // load nodes + cocos2d::Node* loadSimpleNode(const rapidjson::Value& json); + cocos2d::Node* loadSubGraph (const rapidjson::Value& json); + cocos2d::Node* loadSprite (const rapidjson::Value& json); + cocos2d::Node* loadParticle (const rapidjson::Value& json); + + // load gui + cocos2d::Node* loadWidget(const rapidjson::Value& json); + + typedef std::function NodeCreateFunc; + typedef std::pair Pair; + + std::unordered_map _funcs; + + WidgetPropertiesReader0300* _guiReader; + bool _recordJsonPath; + + std::string _jsonPath; +}; + +} +} + + +#endif /*__CC_NODE_CACHE_H__*/ diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp new file mode 100644 index 0000000000..7516cbc255 --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp @@ -0,0 +1,249 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCTimeLine.h" +#include "CCActionTimeline.h" + +USING_NS_CC; + +NS_TIMELINE_BEGIN + +Timeline* Timeline::create() +{ + Timeline* object = new Timeline(); + if (object) + { + object->autorelease(); + return object; + } + CC_SAFE_DELETE(object); + return nullptr; +} + +Timeline::Timeline() + : _currentKeyFrame(nullptr) + , _currentKeyFrameIndex(0) + , _fromIndex(0) + , _toIndex(0) + , _betweenDuration(0) + , _actionTag(0) + , _ActionTimeline(nullptr) + , _node(nullptr) +{ +} + +Timeline::~Timeline() +{ +} + +void Timeline::gotoFrame(int frameIndex) +{ + if(_frames.size() == 0) + return; + + binarySearchKeyFrame(frameIndex); + apply(frameIndex); +} + +void Timeline::stepToFrame(int frameIndex) +{ + if(_frames.size() == 0) + return; + + updateCurrentKeyFrame(frameIndex); + apply(frameIndex); +} + +Timeline* Timeline::clone() +{ + Timeline* timeline = Timeline::create(); + timeline->_actionTag = _actionTag; + + for (auto frame : _frames) + { + Frame* newFrame = frame->clone(); + timeline->addFrame(newFrame); + } + + return timeline; +} + +void Timeline::addFrame(Frame* frame) +{ + _frames.pushBack(frame); + frame->setTimeline(this); +} + +void Timeline::insertFrame(Frame* frame, int index) +{ + _frames.insert(index, frame); + frame->setTimeline(this); +} + +void Timeline::removeFrame(Frame* frame) +{ + _frames.eraseObject(frame); + frame->setTimeline(NULL); +} + +void Timeline::setNode(Node* node) +{ + for (auto frame : _frames) + { + frame->setNode(node); + } +} + +Node* Timeline::getNode() const +{ + return _node; +} + +void Timeline::apply(int frameIndex) +{ + if (_currentKeyFrame) + { + float currentPercent = _betweenDuration == 0 ? 0 : (frameIndex - _currentKeyFrameIndex) / (float)_betweenDuration; + _currentKeyFrame->apply(currentPercent); + } +} + +void Timeline::binarySearchKeyFrame(int frameIndex) +{ + Frame *from = NULL; + Frame *to = NULL; + + long length = _frames.size(); + bool needEnterFrame = false; + + do + { + if (frameIndex < _frames.at(0)->getFrameIndex()) + { + if(_currentKeyFrameIndex >= _frames.at(0)->getFrameIndex()) + needEnterFrame = true; + + from = to = _frames.at(0); + _currentKeyFrameIndex = 0; + _betweenDuration = _frames.at(0)->getFrameIndex(); + break; + } + else if(frameIndex >= _frames.at(length - 1)->getFrameIndex()) + { + from = to = _frames.at(length - 1); + _currentKeyFrameIndex = _frames.at(length - 1)->getFrameIndex(); + _betweenDuration = 0; + break; + } + + int target = -1; + int low=0,high=length-1,mid; + while(low<=high){ + mid=(low+high)/2; + if(frameIndex >= _frames.at(mid)->getFrameIndex() && frameIndex < _frames.at(mid+1)->getFrameIndex()) + { + target = mid; + break; + } + if(_frames.at(mid)->getFrameIndex()>frameIndex) + high=mid-1; + else + low=mid+1; + } + + from = _frames.at(target); + to = _frames.at(target+1); + + if(target == 0 && _currentKeyFrameIndexgetFrameIndex()) + needEnterFrame = true; + + _currentKeyFrameIndex = from->getFrameIndex(); + _betweenDuration = to->getFrameIndex() - from->getFrameIndex(); + } while (0); + + if(needEnterFrame || _currentKeyFrame != from) + { + _currentKeyFrame = from; + _currentKeyFrame->onEnter(to); + } +} + +void Timeline::updateCurrentKeyFrame(int frameIndex) +{ + //! If play to current frame's front or back, then find current frame again + if (frameIndex < _currentKeyFrameIndex || frameIndex >= _currentKeyFrameIndex + _betweenDuration) + { + Frame *from = nullptr; + Frame *to = nullptr; + + do + { + long length = _frames.size(); + + if (frameIndex < _frames.at(0)->getFrameIndex()) + { + from = to = _frames.at(0); + _currentKeyFrameIndex = 0; + _betweenDuration = _frames.at(0)->getFrameIndex(); + break; + } + else if(frameIndex >= _frames.at(length - 1)->getFrameIndex()) + { + from = to = _frames.at(length - 1); + _currentKeyFrameIndex = _frames.at(length - 1)->getFrameIndex(); + _betweenDuration = 0; + break; + } + + do + { + _fromIndex = _toIndex; + from = _frames.at(_fromIndex); + _currentKeyFrameIndex = from->getFrameIndex(); + + _toIndex = _fromIndex + 1; + if (_toIndex >= length) + { + _toIndex = 0; + } + + to = _frames.at(_toIndex); + + if (frameIndex == from->getFrameIndex()) + { + break; + } + } + while (frameIndex < from->getFrameIndex() || frameIndex >= to->getFrameIndex()); + + _betweenDuration = to->getFrameIndex() - from->getFrameIndex(); + + } while (0); + + _currentKeyFrame = from; + _currentKeyFrame->onEnter(to); + } +} + +NS_TIMELINE_END diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.h b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.h new file mode 100644 index 0000000000..d81f44488f --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.h @@ -0,0 +1,85 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCTIMELINE_H__ +#define __CCTIMELINE_H__ + +#include "CCFrame.h" +#include "CCTimelineMacro.h" + +NS_TIMELINE_BEGIN + +class ActionTimeline; + +class Timeline : public cocos2d::Ref +{ +public: + static Timeline* create(); + + Timeline(); + virtual ~Timeline(); + + virtual void gotoFrame(int frameIndex); + virtual void stepToFrame(int frameIndex); + + virtual const cocos2d::Vector& getFrames() const { return _frames; } + + virtual void addFrame(Frame* frame); + virtual void insertFrame(Frame* frame, int index); + virtual void removeFrame(Frame* frame); + + virtual void setActionTag(int tag) { _actionTag = tag; } + virtual int getActionTag() const { return _actionTag; } + + virtual void setNode(cocos2d::Node* node); + virtual cocos2d::Node* getNode() const; + + virtual void setActionTimeline(ActionTimeline* action) { _ActionTimeline = action; } + virtual ActionTimeline* getActionTimeline() const { return _ActionTimeline; } + + virtual Timeline* clone(); + +protected: + virtual void apply(int frameIndex); + + virtual void binarySearchKeyFrame (int frameIndex); + virtual void updateCurrentKeyFrame(int frameIndex); + + cocos2d::Vector _frames; + Frame* _currentKeyFrame; + int _currentKeyFrameIndex; + + int _fromIndex; + int _toIndex; + int _betweenDuration; + int _actionTag; + + ActionTimeline* _ActionTimeline; + cocos2d::Node* _node; +}; + +NS_TIMELINE_END + + +#endif /*__CCTIMELINE_H__*/ diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h b/cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h new file mode 100644 index 0000000000..0580adc68e --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h @@ -0,0 +1,38 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2013-2014 Chukong Technologies + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#ifndef __CC_TIMELINE_MACROS_H__ +#define __CC_TIMELINE_MACROS_H__ + +#ifdef __cplusplus +#define NS_TIMELINE_BEGIN namespace cocostudio { namespace timeline{ +#define NS_TIMELINE_END }} +#define USING_NS_TIMELINE using namespace cocostudio::timeline; +#else +#define NS_TIMELINE_BEGIN +#define NS_TIMELINE_END +#define USING_NS_TIMELINE +#endif + +#endif \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/Android.mk b/cocos/editor-support/cocostudio/Android.mk index cfddcb1d99..07bb09ceb2 100644 --- a/cocos/editor-support/cocostudio/Android.mk +++ b/cocos/editor-support/cocostudio/Android.mk @@ -53,6 +53,11 @@ WidgetReader/TextAtlasReader/TextAtlasReader.cpp \ WidgetReader/TextBMFontReader/TextBMFontReader.cpp \ WidgetReader/TextFieldReader/TextFieldReader.cpp \ WidgetReader/TextReader/TextReader.cpp \ +ActionTimeline/CCNodeReader.cpp \ +ActionTimeline/CCActionTimelineCache.cpp \ +ActionTimeline/CCFrame.cpp \ +ActionTimeline/CCTimeline.cpp \ +ActionTimeline/CCActionTimeline.cpp \ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \ $(LOCAL_PATH)/../../../external diff --git a/cocos/editor-support/cocostudio/CCActionFrame.cpp b/cocos/editor-support/cocostudio/CCActionFrame.cpp index 61c6a72ad1..6eb702c00e 100644 --- a/cocos/editor-support/cocostudio/CCActionFrame.cpp +++ b/cocos/editor-support/cocostudio/CCActionFrame.cpp @@ -373,4 +373,4 @@ ActionInterval* ActionTintFrame::getAction(float fDuration) } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocostudio/CCActionFrameEasing.cpp b/cocos/editor-support/cocostudio/CCActionFrameEasing.cpp index 638e33e31b..43e43dbc4e 100644 --- a/cocos/editor-support/cocostudio/CCActionFrameEasing.cpp +++ b/cocos/editor-support/cocostudio/CCActionFrameEasing.cpp @@ -188,4 +188,4 @@ float ActionFrameEasing::easeValue(float t) return 0; } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocostudio/CCActionObject.cpp b/cocos/editor-support/cocostudio/CCActionObject.cpp index c421b40402..121979d983 100644 --- a/cocos/editor-support/cocostudio/CCActionObject.cpp +++ b/cocos/editor-support/cocostudio/CCActionObject.cpp @@ -222,4 +222,4 @@ void ActionObject::simulationActionUpdate(float dt) } } } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocostudio/CCArmature.cpp b/cocos/editor-support/cocostudio/CCArmature.cpp index d8b2537ff7..15273ac4ac 100644 --- a/cocos/editor-support/cocostudio/CCArmature.cpp +++ b/cocos/editor-support/cocostudio/CCArmature.cpp @@ -494,6 +494,8 @@ Rect Armature::getBoundingBox() const if (Bone *bone = dynamic_cast(object)) { Rect r = bone->getDisplayManager()->getBoundingBox(); + if (r.equals(Rect::ZERO)) + continue; if(first) { diff --git a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp index cea37b4e63..f3a37a41d6 100644 --- a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp +++ b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp @@ -1185,8 +1185,22 @@ ContourData *DataReaderHelper::decodeContour(tinyxml2::XMLElement *contourXML, D void DataReaderHelper::addDataFromJsonCache(const std::string& fileContent, DataInfo *dataInfo) { rapidjson::Document json; - - json.Parse<0>(fileContent.c_str()); + rapidjson::StringStream stream(fileContent.c_str()); + + if (fileContent.size() >= 3) { + // Skip BOM if exists + const unsigned char* c = (const unsigned char *)fileContent.c_str(); + unsigned bom = c[0] | (c[1] << 8) | (c[2] << 16); + + if (bom == 0xBFBBEF) // UTF8 BOM + { + stream.Take(); + stream.Take(); + stream.Take(); + } + } + + json.ParseStream<0>(stream); if (json.HasParseError()) { CCLOG("GetParseError %s\n",json.GetParseError()); } diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.cpp b/cocos/editor-support/cocostudio/CCSGUIReader.cpp index b0f9ec53ee..f21f84af8e 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.cpp +++ b/cocos/editor-support/cocostudio/CCSGUIReader.cpp @@ -181,7 +181,8 @@ Widget* GUIReader::widgetFromJsonFile(const char *fileName) { std::string jsonpath; rapidjson::Document jsonDict; - jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName); + jsonpath = fileName; +// jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName); size_t pos = jsonpath.find_last_of('/'); m_strFilePath = jsonpath.substr(0,pos+1); std::string contentStr = FileUtils::getInstance()->getStringFromFile(jsonpath); diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.h b/cocos/editor-support/cocostudio/CCSGUIReader.h index 999e9435fa..5c794c5e58 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.h +++ b/cocos/editor-support/cocostudio/CCSGUIReader.h @@ -59,13 +59,14 @@ public: */ const cocos2d::Size getFileDesignSize(const char* fileName) const; - const std::string& getFilePath() const { return m_strFilePath; }; + void setFilePath(const std::string& strFilePath) { m_strFilePath = strFilePath; } + const std::string& getFilePath() const { return m_strFilePath; } + void registerTypeAndCallBack(const std::string& classType, cocos2d::ObjectFactory::Instance ins, Ref* object, SEL_ParseEvent callBack); - protected: GUIReader(); ~GUIReader(); diff --git a/cocos/editor-support/cocostudio/CMakeLists.txt b/cocos/editor-support/cocostudio/CMakeLists.txt index aeb1b0a265..0b4d610faa 100644 --- a/cocos/editor-support/cocostudio/CMakeLists.txt +++ b/cocos/editor-support/cocostudio/CMakeLists.txt @@ -47,6 +47,11 @@ set(CS_SRC WidgetReader/TextBMFontReader/TextBMFontReader.cpp WidgetReader/TextFieldReader/TextFieldReader.cpp WidgetReader/TextReader/TextReader.cpp + ActionTimeline/CCActionTimeline.cpp + ActionTimeline/CCActionTimelineCache.cpp + ActionTimeline/CCFrame.cpp + ActionTimeline/CCNodeReader.cpp + ActionTimeline/CCTimeLine.cpp ) include_directories( diff --git a/cocos/editor-support/cocostudio/CocoStudio.h b/cocos/editor-support/cocostudio/CocoStudio.h index 65f66fc686..29d8319a38 100644 --- a/cocos/editor-support/cocostudio/CocoStudio.h +++ b/cocos/editor-support/cocostudio/CocoStudio.h @@ -58,5 +58,10 @@ THE SOFTWARE. #include "cocostudio/CCSGUIReader.h" #include "cocostudio/CCSSceneReader.h" #include "cocostudio/TriggerBase.h" +#include "cocostudio/ActionTimeline/CCNodeReader.h" +#include "cocostudio/ActionTimeline/CCActionTimelineCache.h" +#include "cocostudio/ActionTimeline/CCFrame.h" +#include "cocostudio/ActionTimeline/CCTimeLine.h" +#include "cocostudio/ActionTimeline/CCActionTimeline.h" #endif diff --git a/cocos/editor-support/cocostudio/DictionaryHelper.cpp b/cocos/editor-support/cocostudio/DictionaryHelper.cpp index f6d8a5bbb3..d72bfa396b 100644 --- a/cocos/editor-support/cocostudio/DictionaryHelper.cpp +++ b/cocos/editor-support/cocostudio/DictionaryHelper.cpp @@ -224,4 +224,4 @@ bool DictionaryHelper::checkObjectExist_json(const rapidjson::Value &root, int i return bRet; } -} \ No newline at end of file +} diff --git a/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj b/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj index 8a5ffbb33e..e3731c1e54 100644 --- a/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj +++ b/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj @@ -11,6 +11,11 @@ + + + + + @@ -71,6 +76,12 @@ + + + + + + @@ -103,7 +114,6 @@ - diff --git a/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj.filters b/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj.filters index 655cb64627..978f5107d2 100644 --- a/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj.filters +++ b/cocos/editor-support/cocostudio/proj.win32/libCocosStudio.vcxproj.filters @@ -82,6 +82,9 @@ {bc251d28-036e-4272-852b-bd25fd110b33} + + {2d371825-3c46-4901-850c-3bccf6b49efc} + @@ -228,6 +231,21 @@ reader\WidgetReader\PageViewReader + + TimelineAction + + + TimelineAction + + + TimelineAction + + + TimelineAction + + + TimelineAction + @@ -353,9 +371,6 @@ action - - trigger - trigger @@ -413,5 +428,23 @@ reader\WidgetReader\PageViewReader + + TimelineAction + + + TimelineAction + + + TimelineAction + + + TimelineAction + + + TimelineAction + + + TimelineAction + - + \ No newline at end of file diff --git a/cocos/math/CCMath.h b/cocos/math/CCMath.h index 7ea6798945..fe1afe36c0 100644 --- a/cocos/math/CCMath.h +++ b/cocos/math/CCMath.h @@ -7,4 +7,4 @@ #include "Mat4.h" #include "Quaternion.h" -#endif \ No newline at end of file +#endif diff --git a/cocos/math/CCMathBase.h b/cocos/math/CCMathBase.h index 2bc0865108..cd02313b12 100644 --- a/cocos/math/CCMathBase.h +++ b/cocos/math/CCMathBase.h @@ -33,4 +33,4 @@ #endif -#endif // __CCMATHBASE_H__ \ No newline at end of file +#endif // __CCMATHBASE_H__ diff --git a/cocos/network/CMakeLists.txt b/cocos/network/CMakeLists.txt index f359cfa978..5bcf40d79e 100644 --- a/cocos/network/CMakeLists.txt +++ b/cocos/network/CMakeLists.txt @@ -24,14 +24,14 @@ set(COCOS_NETWORK_SRC ${PLATFORM_SRC} ) -IF ( WIN32 ) -set(COCOS_NETWORK_LINK - libcurl_imp - ${PLATFORM_LINK} -) +IF (WIN32 AND NOT MINGW) + set(COCOS_NETWORK_LINK + libcurl_imp + ${PLATFORM_LINK} + ) ELSE() -set(COCOS_NETWORK_LINK - curl - ${PLATFORM_LINK} -) + set(COCOS_NETWORK_LINK + curl + ${PLATFORM_LINK} + ) ENDIF() diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index af4a22ab26..c655dbba03 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -512,6 +512,7 @@ static Data getData(const std::string& filename, bool forString) Data ret; unsigned char* buffer = nullptr; ssize_t size = 0; + size_t readsize; const char* mode = nullptr; if (forString) mode = "rt"; @@ -538,11 +539,16 @@ static Data getData(const std::string& filename, bool forString) buffer = (unsigned char*)malloc(sizeof(unsigned char) * size); } - size = fread(buffer, sizeof(unsigned char), size, fp); + readsize = fread(buffer, sizeof(unsigned char), size, fp); fclose(fp); + + if (forString && readsize < size) + { + buffer[readsize] = '\0'; + } } while (0); - if (nullptr == buffer || 0 == size) + if (nullptr == buffer || 0 == readsize) { std::string msg = "Get data from file("; msg.append(filename).append(") failed!"); @@ -550,7 +556,7 @@ static Data getData(const std::string& filename, bool forString) } else { - ret.fastSet(buffer, size); + ret.fastSet(buffer, readsize); } return ret; diff --git a/cocos/platform/CCGLViewProtocol.cpp b/cocos/platform/CCGLViewProtocol.cpp index d2f821ac8b..194ae5d696 100644 --- a/cocos/platform/CCGLViewProtocol.cpp +++ b/cocos/platform/CCGLViewProtocol.cpp @@ -265,7 +265,7 @@ void GLViewProtocol::handleTouchesBegin(int num, intptr_t ids[], float xs[], flo touch->setTouchInfo(unusedIndex, (x - _viewPortRect.origin.x) / _scaleX, (y - _viewPortRect.origin.y) / _scaleY); - CCLOGINFO("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y); + CCLOGINFO("x = %f y = %f", touch->getLocationInView().x, touch->getLocationInView().y); g_touchIdReorderMap.insert(std::make_pair(id, unusedIndex)); touchEvent._touches.push_back(touch); diff --git a/cocos/platform/android/jni/DPIJni.cpp b/cocos/platform/android/jni/DPIJni.cpp index 85f08c2b5f..74ed9f90f0 100644 --- a/cocos/platform/android/jni/DPIJni.cpp +++ b/cocos/platform/android/jni/DPIJni.cpp @@ -16,4 +16,4 @@ int getDPIJNI() return ret; } -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/cocos/platform/ios/CCCommon.mm b/cocos/platform/ios/CCCommon.mm index 6f1ee35d76..c435c69a94 100644 --- a/cocos/platform/ios/CCCommon.mm +++ b/cocos/platform/ios/CCCommon.mm @@ -58,4 +58,4 @@ void LuaLog(const char * format) NS_CC_END -#endif // CC_PLATFORM_IOS \ No newline at end of file +#endif // CC_PLATFORM_IOS diff --git a/cocos/platform/winrt/CCFreeTypeFont.h b/cocos/platform/winrt/CCFreeTypeFont.h index f2fcbe28a2..7e30b948ee 100644 --- a/cocos/platform/winrt/CCFreeTypeFont.h +++ b/cocos/platform/winrt/CCFreeTypeFont.h @@ -136,4 +136,4 @@ private: NS_CC_END -#endif \ No newline at end of file +#endif diff --git a/cocos/platform/winrt/pch.h b/cocos/platform/winrt/pch.h index 842a70abec..5e0bbb907c 100644 --- a/cocos/platform/winrt/pch.h +++ b/cocos/platform/winrt/pch.h @@ -1,3 +1,3 @@ #pragma once -#include "cocos2d.h" \ No newline at end of file +#include "cocos2d.h" diff --git a/cocos/platform/winrt/sha1.cpp b/cocos/platform/winrt/sha1.cpp index d0d3a2f620..5d9e188c34 100644 --- a/cocos/platform/winrt/sha1.cpp +++ b/cocos/platform/winrt/sha1.cpp @@ -419,4 +419,4 @@ void SHA1ConvertMessageToString(uint8_t *hash_binary, char* hash_string) hash_string[2*i + 1] = alphabet[hash_binary[i] % 16]; } hash_string[SHA1HashSize * 2] = '\0'; -} \ No newline at end of file +} diff --git a/cocos/platform/winrt/sha1.h b/cocos/platform/winrt/sha1.h index 86e5e6f264..e00a028461 100644 --- a/cocos/platform/winrt/sha1.h +++ b/cocos/platform/winrt/sha1.h @@ -90,4 +90,4 @@ int SHA1Result( SHA1Context *, void SHA1ConvertMessageToString(uint8_t *hash_binary, char* hash_string); -#endif \ No newline at end of file +#endif diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.cpp b/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.cpp index c12d51ff67..323d0b556d 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.cpp +++ b/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.cpp @@ -62,4 +62,4 @@ HRESULT Direct3DContentProvider::PrepareResources(_In_ const LARGE_INTEGER* pres HRESULT Direct3DContentProvider::Draw(_In_ ID3D11Device1* device, _In_ ID3D11DeviceContext1* context, _In_ ID3D11RenderTargetView* renderTargetView) { return m_controller->Draw(device, context, renderTargetView); -} \ No newline at end of file +} diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.h b/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.h index 2e81759a7e..7a9d941074 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.h +++ b/cocos/platform/wp8-xaml/cpp/Direct3DContentProvider.h @@ -49,4 +49,4 @@ public: private: PhoneDirect3DXamlAppComponent::Direct3DInterop^ m_controller; Microsoft::WRL::ComPtr m_host; -}; \ No newline at end of file +}; diff --git a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp index 4322e0deee..b01ab9f2be 100644 --- a/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp +++ b/cocos/platform/wp8-xaml/cpp/Direct3DInterop.cpp @@ -185,4 +185,4 @@ bool Direct3DInterop::SendCocos2dEvent(Cocos2dEvent event) return false; } -} \ No newline at end of file +} diff --git a/cocos/platform/wp8-xaml/cpp/DirectXBase.h b/cocos/platform/wp8-xaml/cpp/DirectXBase.h index 69e8daecb5..fee44394ae 100644 --- a/cocos/platform/wp8-xaml/cpp/DirectXBase.h +++ b/cocos/platform/wp8-xaml/cpp/DirectXBase.h @@ -81,4 +81,4 @@ protected private: Microsoft::WRL::ComPtr m_eglPhoneWindow; DirectX::XMMATRIX m_orientationMatrix; float m_aspectRatio; -}; \ No newline at end of file +}; diff --git a/cocos/platform/wp8-xaml/cpp/EditBoxEvent.h b/cocos/platform/wp8-xaml/cpp/EditBoxEvent.h index 7206c6254b..e9a7105baf 100644 --- a/cocos/platform/wp8-xaml/cpp/EditBoxEvent.h +++ b/cocos/platform/wp8-xaml/cpp/EditBoxEvent.h @@ -45,4 +45,4 @@ namespace PhoneDirect3DXamlAppComponent }; } -#endif \ No newline at end of file +#endif diff --git a/cocos/platform/wp8/DirectXBase.h b/cocos/platform/wp8/DirectXBase.h index 72187253a5..cb6df7739a 100644 --- a/cocos/platform/wp8/DirectXBase.h +++ b/cocos/platform/wp8/DirectXBase.h @@ -43,4 +43,4 @@ protected private: }; -#endif // 0 \ No newline at end of file +#endif // 0 diff --git a/cocos/platform/wp8/pch.h b/cocos/platform/wp8/pch.h index 842a70abec..5e0bbb907c 100644 --- a/cocos/platform/wp8/pch.h +++ b/cocos/platform/wp8/pch.h @@ -1,3 +1,3 @@ #pragma once -#include "cocos2d.h" \ No newline at end of file +#include "cocos2d.h" diff --git a/cocos/renderer/CCBatchCommand.cpp b/cocos/renderer/CCBatchCommand.cpp index e122fc1344..af9fa47f40 100644 --- a/cocos/renderer/CCBatchCommand.cpp +++ b/cocos/renderer/CCBatchCommand.cpp @@ -70,4 +70,4 @@ void BatchCommand::execute() _textureAtlas->drawQuads(); } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/renderer/CCCustomCommand.cpp b/cocos/renderer/CCCustomCommand.cpp index c324032116..c8deb9cac8 100644 --- a/cocos/renderer/CCCustomCommand.cpp +++ b/cocos/renderer/CCCustomCommand.cpp @@ -50,4 +50,4 @@ void CustomCommand::execute() } } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/renderer/CCMeshCommand.cpp b/cocos/renderer/CCMeshCommand.cpp index 6b9dda2fbc..f562f94310 100644 --- a/cocos/renderer/CCMeshCommand.cpp +++ b/cocos/renderer/CCMeshCommand.cpp @@ -177,4 +177,4 @@ void MeshCommand::execute() glBindBuffer(GL_ARRAY_BUFFER, 0); } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/renderer/CCMeshCommand.h b/cocos/renderer/CCMeshCommand.h index 031d8b9a51..fb88674b90 100644 --- a/cocos/renderer/CCMeshCommand.h +++ b/cocos/renderer/CCMeshCommand.h @@ -34,7 +34,7 @@ NS_CC_BEGIN class GLProgramState; class GLProgram; -class Uniform; +struct Uniform; //it is a common mesh class MeshCommand : public RenderCommand diff --git a/cocos/renderer/CCQuadCommand.cpp b/cocos/renderer/CCQuadCommand.cpp index 4b497ff253..d5cff627f6 100644 --- a/cocos/renderer/CCQuadCommand.cpp +++ b/cocos/renderer/CCQuadCommand.cpp @@ -97,4 +97,4 @@ void QuadCommand::useMaterial() const _glProgramState->apply(_mv); } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/renderer/CCRenderCommand.cpp b/cocos/renderer/CCRenderCommand.cpp index 0c11c5699b..0996ab2d52 100644 --- a/cocos/renderer/CCRenderCommand.cpp +++ b/cocos/renderer/CCRenderCommand.cpp @@ -60,4 +60,4 @@ void RenderCommand::printID() printf("Command Depth: %f\n", _globalOrder); } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/scripting/lua-bindings/auto/api/ActionTimelineData.lua b/cocos/scripting/lua-bindings/auto/api/ActionTimelineData.lua new file mode 100644 index 0000000000..e587b8c775 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/ActionTimelineData.lua @@ -0,0 +1,22 @@ + +-------------------------------- +-- @module ActionTimelineData +-- @extend Ref + +-------------------------------- +-- @function [parent=#ActionTimelineData] setActionTag +-- @param self +-- @param #int int + +-------------------------------- +-- @function [parent=#ActionTimelineData] getActionTag +-- @param self +-- @return int#int ret (return value: int) + +-------------------------------- +-- @function [parent=#ActionTimelineData] create +-- @param self +-- @param #int int +-- @return timeline::ActionTimelineData#timeline::ActionTimelineData ret (return value: ccs.timeline::ActionTimelineData) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/GUIReader.lua b/cocos/scripting/lua-bindings/auto/api/GUIReader.lua index 5e9509e0e2..c5d7484390 100644 --- a/cocos/scripting/lua-bindings/auto/api/GUIReader.lua +++ b/cocos/scripting/lua-bindings/auto/api/GUIReader.lua @@ -3,6 +3,11 @@ -- @module GUIReader -- @extend Ref +-------------------------------- +-- @function [parent=#GUIReader] setFilePath +-- @param self +-- @param #string str + -------------------------------- -- @function [parent=#GUIReader] widgetFromJsonFile -- @param self diff --git a/cocos/scripting/lua-bindings/auto/api/Label.lua b/cocos/scripting/lua-bindings/auto/api/Label.lua index 158c715090..fe2250adc1 100644 --- a/cocos/scripting/lua-bindings/auto/api/Label.lua +++ b/cocos/scripting/lua-bindings/auto/api/Label.lua @@ -43,11 +43,6 @@ -- @param self -- @return color4b_table#color4b_table ret (return value: color4b_table) --------------------------------- --- @function [parent=#Label] getCommonLineHeight --- @param self --- @return int#int ret (return value: int) - -------------------------------- -- @function [parent=#Label] setWidth -- @param self @@ -90,6 +85,11 @@ -- @param self -- @return FontAtlas#FontAtlas ret (return value: cc.FontAtlas) +-------------------------------- +-- @function [parent=#Label] setLineHeight +-- @param self +-- @param #float float + -------------------------------- -- @function [parent=#Label] setSystemFontSize -- @param self @@ -120,6 +120,11 @@ -- @param #color4b_table color4b -- @param #int int +-------------------------------- +-- @function [parent=#Label] getAdditionalKerning +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- overload function: setCharMap(cc.Texture2D, int, int, int) -- @@ -155,6 +160,11 @@ -- @param self -- @param #cc.TextVAlignment textvalignment +-------------------------------- +-- @function [parent=#Label] getLineHeight +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- @function [parent=#Label] getTTFConfig -- @param self @@ -191,6 +201,11 @@ -- @param #int int -- @return Sprite#Sprite ret (return value: cc.Sprite) +-------------------------------- +-- @function [parent=#Label] setAdditionalKerning +-- @param self +-- @param #float float + -------------------------------- -- @function [parent=#Label] getSystemFontSize -- @param self diff --git a/cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua b/cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua index 2d1a84ff26..dfc80e1093 100644 --- a/cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua +++ b/cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua @@ -18,4 +18,12 @@ -- @function [parent=#SkeletonAnimation] clearTrack -- @param self +-------------------------------- +-- @function [parent=#SkeletonAnimation] onAnimationStateEvent +-- @param self +-- @param #int int +-- @param #spEventType speventtype +-- @param #spEvent spevent +-- @param #int int + return nil diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_studio_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_studio_auto_api.lua index c13a5472e3..832170c05b 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_studio_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_studio_auto_api.lua @@ -146,4 +146,9 @@ -- @field [parent=#ccs] SceneReader#SceneReader SceneReader preloaded module +-------------------------------------------------------- +-- the ccs ActionTimelineData +-- @field [parent=#ccs] ActionTimelineData#ActionTimelineData ActionTimelineData preloaded module + + return nil diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 80ee426c6b..18904e44b5 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -32605,50 +32605,6 @@ int lua_cocos2dx_Label_getTextColor(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Label_getCommonLineHeight(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Label* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getCommonLineHeight'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - return 0; - int ret = cobj->getCommonLineHeight(); - tolua_pushnumber(tolua_S,(lua_Number)ret); - return 1; - } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getCommonLineHeight",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getCommonLineHeight'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_Label_setWidth(lua_State* tolua_S) { int argc = 0; @@ -33026,6 +32982,52 @@ int lua_cocos2dx_Label_getFontAtlas(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_setLineHeight(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_setLineHeight'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0); + if(!ok) + return 0; + cobj->setLineHeight(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setLineHeight",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_setLineHeight'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_setSystemFontSize(lua_State* tolua_S) { int argc = 0; @@ -33308,6 +33310,50 @@ int lua_cocos2dx_Label_enableOutline(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getAdditionalKerning'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + double ret = cobj->getAdditionalKerning(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getAdditionalKerning",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getAdditionalKerning'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_setCharMap(lua_State* tolua_S) { int argc = 0; @@ -33579,6 +33625,50 @@ int lua_cocos2dx_Label_setVerticalAlignment(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_getLineHeight(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getLineHeight'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + double ret = cobj->getLineHeight(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getLineHeight",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getLineHeight'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_getTTFConfig(lua_State* tolua_S) { int argc = 0; @@ -33896,6 +33986,52 @@ int lua_cocos2dx_Label_getLetter(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_setAdditionalKerning(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_setAdditionalKerning'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0); + if(!ok) + return 0; + cobj->setAdditionalKerning(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setAdditionalKerning",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_setAdditionalKerning'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_getSystemFontSize(lua_State* tolua_S) { int argc = 0; @@ -34435,7 +34571,6 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S) tolua_function(tolua_S,"disableEffect",lua_cocos2dx_Label_disableEffect); tolua_function(tolua_S,"setTTFConfig",lua_cocos2dx_Label_setTTFConfig); tolua_function(tolua_S,"getTextColor",lua_cocos2dx_Label_getTextColor); - tolua_function(tolua_S,"getCommonLineHeight",lua_cocos2dx_Label_getCommonLineHeight); tolua_function(tolua_S,"setWidth",lua_cocos2dx_Label_setWidth); tolua_function(tolua_S,"getMaxLineWidth",lua_cocos2dx_Label_getMaxLineWidth); tolua_function(tolua_S,"getHorizontalAlignment",lua_cocos2dx_Label_getHorizontalAlignment); @@ -34444,17 +34579,20 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S) tolua_function(tolua_S,"setSystemFontName",lua_cocos2dx_Label_setSystemFontName); tolua_function(tolua_S,"setBMFontFilePath",lua_cocos2dx_Label_setBMFontFilePath); tolua_function(tolua_S,"getFontAtlas",lua_cocos2dx_Label_getFontAtlas); + tolua_function(tolua_S,"setLineHeight",lua_cocos2dx_Label_setLineHeight); tolua_function(tolua_S,"setSystemFontSize",lua_cocos2dx_Label_setSystemFontSize); tolua_function(tolua_S,"updateContent",lua_cocos2dx_Label_updateContent); tolua_function(tolua_S,"getStringLength",lua_cocos2dx_Label_getStringLength); tolua_function(tolua_S,"setLineBreakWithoutSpace",lua_cocos2dx_Label_setLineBreakWithoutSpace); tolua_function(tolua_S,"getStringNumLines",lua_cocos2dx_Label_getStringNumLines); tolua_function(tolua_S,"enableOutline",lua_cocos2dx_Label_enableOutline); + tolua_function(tolua_S,"getAdditionalKerning",lua_cocos2dx_Label_getAdditionalKerning); tolua_function(tolua_S,"setCharMap",lua_cocos2dx_Label_setCharMap); tolua_function(tolua_S,"getDimensions",lua_cocos2dx_Label_getDimensions); tolua_function(tolua_S,"setMaxLineWidth",lua_cocos2dx_Label_setMaxLineWidth); tolua_function(tolua_S,"getSystemFontName",lua_cocos2dx_Label_getSystemFontName); tolua_function(tolua_S,"setVerticalAlignment",lua_cocos2dx_Label_setVerticalAlignment); + tolua_function(tolua_S,"getLineHeight",lua_cocos2dx_Label_getLineHeight); tolua_function(tolua_S,"getTTFConfig",lua_cocos2dx_Label_getTTFConfig); tolua_function(tolua_S,"getVerticalAlignment",lua_cocos2dx_Label_getVerticalAlignment); tolua_function(tolua_S,"setTextColor",lua_cocos2dx_Label_setTextColor); @@ -34462,6 +34600,7 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S) tolua_function(tolua_S,"getWidth",lua_cocos2dx_Label_getWidth); tolua_function(tolua_S,"enableGlow",lua_cocos2dx_Label_enableGlow); tolua_function(tolua_S,"getLetter",lua_cocos2dx_Label_getLetter); + tolua_function(tolua_S,"setAdditionalKerning",lua_cocos2dx_Label_setAdditionalKerning); tolua_function(tolua_S,"getSystemFontSize",lua_cocos2dx_Label_getSystemFontSize); tolua_function(tolua_S,"getTextAlignment",lua_cocos2dx_Label_getTextAlignment); tolua_function(tolua_S,"getBMFontFilePath",lua_cocos2dx_Label_getBMFontFilePath); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 5eeff5ebfd..44a7ca4c4b 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1545,6 +1545,9 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp index fb68e466e2..55c306c217 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.cpp @@ -494,6 +494,61 @@ int lua_cocos2dx_spine_SkeletonAnimation_clearTrack(lua_State* tolua_S) return 0; } +int lua_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent(lua_State* tolua_S) +{ + int argc = 0; + spine::SkeletonAnimation* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"sp.SkeletonAnimation",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (spine::SkeletonAnimation*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 4) + { + int arg0; + spEventType arg1; + spEvent* arg2; + int arg3; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1); + + #pragma warning NO CONVERSION TO NATIVE FOR spEvent*; + + ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3); + if(!ok) + return 0; + cobj->onAnimationStateEvent(arg0, arg1, arg2, arg3); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "onAnimationStateEvent",argc, 4); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent'.",&tolua_err); +#endif + + return 0; +} static int lua_cocos2dx_spine_SkeletonAnimation_finalize(lua_State* tolua_S) { printf("luabindings: finalizing LUA object (SkeletonAnimation)"); @@ -509,6 +564,7 @@ int lua_register_cocos2dx_spine_SkeletonAnimation(lua_State* tolua_S) tolua_function(tolua_S,"setMix",lua_cocos2dx_spine_SkeletonAnimation_setMix); tolua_function(tolua_S,"clearTracks",lua_cocos2dx_spine_SkeletonAnimation_clearTracks); tolua_function(tolua_S,"clearTrack",lua_cocos2dx_spine_SkeletonAnimation_clearTrack); + tolua_function(tolua_S,"onAnimationStateEvent",lua_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent); tolua_endmodule(tolua_S); std::string typeName = typeid(spine::SkeletonAnimation).name(); g_luaType[typeName] = "sp.SkeletonAnimation"; diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp index c11e809d87..8601fbf0f5 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_spine_auto.hpp @@ -22,4 +22,5 @@ int register_all_cocos2dx_spine(lua_State* tolua_S); + #endif // __cocos2dx_spine_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp index 7e7ac835f2..3cbd51b0c5 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp @@ -12018,6 +12018,52 @@ int lua_register_cocos2dx_studio_ComRender(lua_State* tolua_S) return 1; } +int lua_cocos2dx_studio_GUIReader_setFilePath(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::GUIReader* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccs.GUIReader",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::GUIReader*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_GUIReader_setFilePath'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if(!ok) + return 0; + cobj->setFilePath(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setFilePath",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_GUIReader_setFilePath'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_studio_GUIReader_widgetFromJsonFile(lua_State* tolua_S) { int argc = 0; @@ -12229,6 +12275,7 @@ int lua_register_cocos2dx_studio_GUIReader(lua_State* tolua_S) tolua_cclass(tolua_S,"GUIReader","ccs.GUIReader","cc.Ref",nullptr); tolua_beginmodule(tolua_S,"GUIReader"); + tolua_function(tolua_S,"setFilePath",lua_cocos2dx_studio_GUIReader_setFilePath); tolua_function(tolua_S,"widgetFromJsonFile",lua_cocos2dx_studio_GUIReader_widgetFromJsonFile); tolua_function(tolua_S,"getFilePath",lua_cocos2dx_studio_GUIReader_getFilePath); tolua_function(tolua_S,"getVersionInteger",lua_cocos2dx_studio_GUIReader_getVersionInteger); @@ -12560,6 +12607,151 @@ int lua_register_cocos2dx_studio_SceneReader(lua_State* tolua_S) g_typeCast["SceneReader"] = "ccs.SceneReader"; return 1; } + +int lua_cocos2dx_studio_ActionTimelineData_setActionTag(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::ActionTimelineData* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccs.timeline::ActionTimelineData",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::ActionTimelineData*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineData_setActionTag'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + if(!ok) + return 0; + cobj->setActionTag(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setActionTag",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineData_setActionTag'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_ActionTimelineData_getActionTag(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::ActionTimelineData* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccs.timeline::ActionTimelineData",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::ActionTimelineData*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionTimelineData_getActionTag'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + int ret = cobj->getActionTag(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getActionTag",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineData_getActionTag'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_ActionTimelineData_create(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"ccs.timeline::ActionTimelineData",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + if(!ok) + return 0; + cocostudio::timeline::ActionTimelineData* ret = cocostudio::timeline::ActionTimelineData::create(arg0); + object_to_luaval(tolua_S, "ccs.timeline::ActionTimelineData",(cocostudio::timeline::ActionTimelineData*)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "create",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionTimelineData_create'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_studio_ActionTimelineData_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (ActionTimelineData)"); + return 0; +} + +int lua_register_cocos2dx_studio_ActionTimelineData(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"ccs.timeline::ActionTimelineData"); + tolua_cclass(tolua_S,"ActionTimelineData","ccs.timeline::ActionTimelineData","cc.Ref",nullptr); + + tolua_beginmodule(tolua_S,"ActionTimelineData"); + tolua_function(tolua_S,"setActionTag",lua_cocos2dx_studio_ActionTimelineData_setActionTag); + tolua_function(tolua_S,"getActionTag",lua_cocos2dx_studio_ActionTimelineData_getActionTag); + tolua_function(tolua_S,"create", lua_cocos2dx_studio_ActionTimelineData_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocostudio::timeline::ActionTimelineData).name(); + g_luaType[typeName] = "ccs.timeline::ActionTimelineData"; + g_typeCast["ActionTimelineData"] = "ccs.timeline::ActionTimelineData"; + return 1; +} TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S) { tolua_open(tolua_S); @@ -12571,6 +12763,7 @@ TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S) lua_register_cocos2dx_studio_ContourData(tolua_S); lua_register_cocos2dx_studio_SceneReader(tolua_S); lua_register_cocos2dx_studio_ComAudio(tolua_S); + lua_register_cocos2dx_studio_ActionTimelineData(tolua_S); lua_register_cocos2dx_studio_DisplayData(tolua_S); lua_register_cocos2dx_studio_ArmatureDisplayData(tolua_S); lua_register_cocos2dx_studio_MovementData(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp index a0b42d8a9b..edc1c84387 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp @@ -298,6 +298,11 @@ int register_all_cocos2dx_studio(lua_State* tolua_S); + + + + + diff --git a/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.h b/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.h index e251bac27b..e96cf911ad 100644 --- a/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.h +++ b/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.h @@ -36,4 +36,4 @@ extern "C" extern int cocos2dx_lua_loader(lua_State *L); } -#endif // __COCOS2DX_LUA_LOADER_H__ \ No newline at end of file +#endif // __COCOS2DX_LUA_LOADER_H__ 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 2015c21736..605f157f05 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 @@ -414,4 +414,4 @@ int register_all_cocos2dx_coco_studio_manual(lua_State* L) extendBone(L); return 0; -} \ No newline at end of file +} diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_physics_manual.cpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_physics_manual.cpp index 1d4425767c..f63ae9ef0d 100644 --- a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_physics_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_physics_manual.cpp @@ -1616,4 +1616,4 @@ int register_all_cocos2dx_physics_manual(lua_State* tolua_S) return 0; } -#endif \ No newline at end of file +#endif diff --git a/cocos/ui/CCProtectedNode.cpp b/cocos/ui/CCProtectedNode.cpp index 4819db32c5..ddfaabbc3f 100644 --- a/cocos/ui/CCProtectedNode.cpp +++ b/cocos/ui/CCProtectedNode.cpp @@ -415,4 +415,4 @@ void ProtectedNode::disableCascadeColor() } } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/ui/CCProtectedNode.h b/cocos/ui/CCProtectedNode.h index 0c6eb2f949..c950c5da2b 100644 --- a/cocos/ui/CCProtectedNode.h +++ b/cocos/ui/CCProtectedNode.h @@ -181,4 +181,4 @@ private: NS_CC_END -#endif // __CPROTECTEDCNODE_H__ \ No newline at end of file +#endif // __CPROTECTEDCNODE_H__ diff --git a/cocos/ui/UIHBox.cpp b/cocos/ui/UIHBox.cpp index 9374fc004d..4785742ced 100644 --- a/cocos/ui/UIHBox.cpp +++ b/cocos/ui/UIHBox.cpp @@ -82,4 +82,4 @@ bool HBox::initWithSize(const Size& size) } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/ui/UILayoutManager.cpp b/cocos/ui/UILayoutManager.cpp index b94630982e..c1c1d6d082 100644 --- a/cocos/ui/UILayoutManager.cpp +++ b/cocos/ui/UILayoutManager.cpp @@ -564,4 +564,4 @@ void RelativeLayoutManager::doLayout(LayoutProtocol *layout) } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/ui/UIRelativeBox.cpp b/cocos/ui/UIRelativeBox.cpp index e4798b2438..d46430c279 100644 --- a/cocos/ui/UIRelativeBox.cpp +++ b/cocos/ui/UIRelativeBox.cpp @@ -82,4 +82,4 @@ bool RelativeBox::initWithSize(const Size& size) } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index e1c827199b..49546be2e8 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -490,4 +490,4 @@ std::string RichText::getDescription() const } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/ui/UIVBox.cpp b/cocos/ui/UIVBox.cpp index 060ad1dddb..e9fc24b5bb 100644 --- a/cocos/ui/UIVBox.cpp +++ b/cocos/ui/UIVBox.cpp @@ -82,4 +82,4 @@ bool VBox::initWithSize(const Size& size) } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/docs/Groups.h b/docs/Groups.h index 4c623b70fc..1039b03f22 100644 --- a/docs/Groups.h +++ b/docs/Groups.h @@ -22,4 +22,4 @@ @defgroup sprite_nodes Sprite Nodes @defgroup textures Textures @defgroup tilemap_parallax_nodes TileMap, Parallax - */ \ No newline at end of file + */ diff --git a/docs/MainPage.h b/docs/MainPage.h index 1a844a8ead..42ebd6e4d7 100644 --- a/docs/MainPage.h +++ b/docs/MainPage.h @@ -53,4 +53,4 @@ THE SOFTWARE. \n - Fork our repository on github, commit your changes, and send a "pull request" to us. We will merge your contribution to master - Suggestion, bug fixes, and improvements are highly appreciated. -*/ \ No newline at end of file +*/ diff --git a/extensions/GUI/CCControlExtension/CCControlColourPicker.h b/extensions/GUI/CCControlExtension/CCControlColourPicker.h index f568af2de6..2cb09328c7 100644 --- a/extensions/GUI/CCControlExtension/CCControlColourPicker.h +++ b/extensions/GUI/CCControlExtension/CCControlColourPicker.h @@ -87,4 +87,4 @@ protected: NS_CC_EXT_END -#endif \ No newline at end of file +#endif diff --git a/extensions/GUI/CCControlExtension/CCControlExtensions.h b/extensions/GUI/CCControlExtension/CCControlExtensions.h index 1ae106f967..c4548bf535 100644 --- a/extensions/GUI/CCControlExtension/CCControlExtensions.h +++ b/extensions/GUI/CCControlExtension/CCControlExtensions.h @@ -34,4 +34,4 @@ THE SOFTWARE. #include "CCControlStepper.h" #include "CCControlSwitch.h" -#endif \ No newline at end of file +#endif diff --git a/extensions/GUI/CCControlExtension/CCControlHuePicker.h b/extensions/GUI/CCControlExtension/CCControlHuePicker.h index 896e452618..9f007a2092 100644 --- a/extensions/GUI/CCControlExtension/CCControlHuePicker.h +++ b/extensions/GUI/CCControlExtension/CCControlHuePicker.h @@ -88,4 +88,4 @@ protected: NS_CC_EXT_END -#endif \ No newline at end of file +#endif diff --git a/extensions/GUI/CCControlExtension/CCControlUtils.h b/extensions/GUI/CCControlExtension/CCControlUtils.h index f927822f10..4df2a0f125 100644 --- a/extensions/GUI/CCControlExtension/CCControlUtils.h +++ b/extensions/GUI/CCControlExtension/CCControlUtils.h @@ -104,4 +104,4 @@ public: NS_CC_EXT_END -#endif \ No newline at end of file +#endif diff --git a/extensions/GUI/CCControlExtension/CCInvocation.h b/extensions/GUI/CCControlExtension/CCInvocation.h index 15fa41920d..e8a2a12b8d 100644 --- a/extensions/GUI/CCControlExtension/CCInvocation.h +++ b/extensions/GUI/CCControlExtension/CCInvocation.h @@ -76,4 +76,4 @@ protected: NS_CC_EXT_END -#endif \ No newline at end of file +#endif diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp index 5cef5fd0b8..b3ccf3809e 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.cpp @@ -300,4 +300,4 @@ std::string CCEditBoxImplWp8::PlatformStringTostring( Platform::String^ strSrc ) return strDst; } -NS_CC_EXT_END \ No newline at end of file +NS_CC_EXT_END diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.h b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.h index 7f1cbb4947..4513ec6dfd 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWp8.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWp8.h @@ -84,4 +84,4 @@ private: NS_CC_EXT_END -#endif \ No newline at end of file +#endif diff --git a/extensions/proj.win32/Win32InputBox.h b/extensions/proj.win32/Win32InputBox.h index 88ea1184c4..1fd46a5593 100644 --- a/extensions/proj.win32/Win32InputBox.h +++ b/extensions/proj.win32/Win32InputBox.h @@ -103,4 +103,4 @@ public: #endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */ -#endif \ No newline at end of file +#endif diff --git a/plugin b/plugin index 51ceded726..4a8c94a85a 160000 --- a/plugin +++ b/plugin @@ -1 +1 @@ -Subproject commit 51ceded726cc034cdc939e379e1b24249e0ebad4 +Subproject commit 4a8c94a85a08cddbea5e1bc499c50cce7518fb15 diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 996831f6d8..ab3c791ed5 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -444,6 +444,17 @@ "cocos/editor-support/cocosbuilder/proj.wp8/libCocosBuilder.vcxproj.user", "cocos/editor-support/cocosbuilder/proj.wp8/pch.cpp", "cocos/editor-support/cocosbuilder/proj.wp8/pch.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp", + "cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp", + "cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp", + "cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp", + "cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp", + "cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h", "cocos/editor-support/cocostudio/Android.mk", "cocos/editor-support/cocostudio/CCActionFrame.cpp", "cocos/editor-support/cocostudio/CCActionFrame.h", @@ -3516,6 +3527,7 @@ "cocos/scripting/lua-bindings/auto/api/ActionManager.lua", "cocos/scripting/lua-bindings/auto/api/ActionManagerEx.lua", "cocos/scripting/lua-bindings/auto/api/ActionObject.lua", + "cocos/scripting/lua-bindings/auto/api/ActionTimelineData.lua", "cocos/scripting/lua-bindings/auto/api/ActionTween.lua", "cocos/scripting/lua-bindings/auto/api/Animate.lua", "cocos/scripting/lua-bindings/auto/api/Animation.lua", diff --git a/templates/cpp-template-default/proj.android/jni/Application.mk b/templates/cpp-template-default/proj.android/jni/Application.mk index 6b7a934e06..edd61073c3 100644 --- a/templates/cpp-template-default/proj.android/jni/Application.mk +++ b/templates/cpp-template-default/proj.android/jni/Application.mk @@ -8,4 +8,4 @@ ifeq ($(APP_DEBUG),1) else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release -endif \ No newline at end of file +endif diff --git a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/pch.h b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/pch.h index 842a70abec..5e0bbb907c 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/AppComponent/pch.h +++ b/templates/cpp-template-default/proj.wp8-xaml/AppComponent/pch.h @@ -1,3 +1,3 @@ #pragma once -#include "cocos2d.h" \ No newline at end of file +#include "cocos2d.h" diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/jni/Android.mk b/templates/lua-template-default/frameworks/runtime-src/proj.android/jni/Android.mk index f60e92fa51..ac0e7ddd56 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/jni/Android.mk +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/jni/Android.mk @@ -18,4 +18,4 @@ LOCAL_WHOLE_STATIC_LIBRARIES := cocos_lua_static include $(BUILD_SHARED_LIBRARY) -$(call import-module,scripting/lua-bindings) \ No newline at end of file +$(call import-module,scripting/lua-bindings) diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/jni/Application.mk b/templates/lua-template-default/frameworks/runtime-src/proj.android/jni/Application.mk index 6b7a934e06..edd61073c3 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/jni/Application.mk +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/jni/Application.mk @@ -8,4 +8,4 @@ ifeq ($(APP_DEBUG),1) else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release -endif \ No newline at end of file +endif diff --git a/templates/lua-template-runtime/cocos-project-template.json b/templates/lua-template-runtime/cocos-project-template.json index e1e94991eb..8bc74277ed 100644 --- a/templates/lua-template-runtime/cocos-project-template.json +++ b/templates/lua-template-runtime/cocos-project-template.json @@ -122,7 +122,6 @@ "exclude": [ "proj.android/bin", "proj.android/assets", - "proj.android/libs", "proj.ios_mac/HelloLua.xcodeproj/project.xcworkspace", "proj.ios_mac/HelloLua.xcodeproj/xcuserdata", "proj.win32/Debug.win32", diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Android.mk b/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Android.mk index 9aa5bd9ad6..09f72ea811 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Android.mk +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Android.mk @@ -22,4 +22,4 @@ LOCAL_WHOLE_STATIC_LIBRARIES := cocos_lua_static include $(BUILD_SHARED_LIBRARY) -$(call import-module,scripting/lua-bindings) \ No newline at end of file +$(call import-module,scripting/lua-bindings) diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Application.mk b/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Application.mk index 6b7a934e06..edd61073c3 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Application.mk +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Application.mk @@ -8,4 +8,4 @@ ifeq ($(APP_DEBUG),1) else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release -endif \ No newline at end of file +endif diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/lua/Runtime_android.cpp b/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/lua/Runtime_android.cpp index 9f4aed2ae0..4ef5a738bf 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/lua/Runtime_android.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/lua/Runtime_android.cpp @@ -33,4 +33,4 @@ string getIPAddress() t.env->DeleteLocalRef(str); } return IPAddress; -} \ No newline at end of file +} diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/SimulatorWindow.cpp b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/SimulatorWindow.cpp index 2db1ecbc1d..b9fcb0ef9f 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/SimulatorWindow.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/SimulatorWindow.cpp @@ -350,4 +350,4 @@ void createSimulator(const char* viewName, float width, float height, bool isLan printf("SetWindowLong NewWndProc Error:%d\n",GetLastError()); } -} \ No newline at end of file +} diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp index 7684d909fd..1d0bf2e5d9 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp @@ -69,4 +69,4 @@ std::string getCurAppPath(void) char fuldir[MAX_PATH]={0}; _fullpath(fuldir,strPath.c_str(),MAX_PATH); return fuldir; -} \ No newline at end of file +} diff --git a/tests/cpp-empty-test/CMakeLists.txt b/tests/cpp-empty-test/CMakeLists.txt index 6c2a22f866..88ebaceb4e 100644 --- a/tests/cpp-empty-test/CMakeLists.txt +++ b/tests/cpp-empty-test/CMakeLists.txt @@ -73,7 +73,3 @@ else() endif() target_link_libraries(${APP_NAME} audio cocos2d) -# MinGW builds need to link libws2_32 and libglew32 manually -if (MINGW) - target_link_libraries(${APP_NAME} glew32 ws2_32) -endif() \ No newline at end of file diff --git a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-testComponent/pch.h b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-testComponent/pch.h index 842a70abec..5e0bbb907c 100644 --- a/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-testComponent/pch.h +++ b/tests/cpp-empty-test/proj-wp8-xaml/cpp-empty-testComponent/pch.h @@ -1,3 +1,3 @@ #pragma once -#include "cocos2d.h" \ No newline at end of file +#include "cocos2d.h" diff --git a/tests/cpp-empty-test/proj.android/jni/Application.mk b/tests/cpp-empty-test/proj.android/jni/Application.mk index f0582bf96e..2ccd787827 100644 --- a/tests/cpp-empty-test/proj.android/jni/Application.mk +++ b/tests/cpp-empty-test/proj.android/jni/Application.mk @@ -11,4 +11,4 @@ ifeq ($(APP_DEBUG),1) else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release -endif \ No newline at end of file +endif diff --git a/tests/cpp-tests/Android.mk b/tests/cpp-tests/Android.mk index cedc1f75aa..d440f80477 100644 --- a/tests/cpp-tests/Android.mk +++ b/tests/cpp-tests/Android.mk @@ -54,6 +54,7 @@ Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp \ Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp \ Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp \ Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp \ +Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp \ Classes/ExtensionsTest/CocoStudioComponentsTest/ComponentsTestScene.cpp \ Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.cpp \ Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp \ diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index 06a7413060..e9329ec90e 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -65,6 +65,7 @@ set(SAMPLE_SRC Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp + Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp Classes/ExtensionsTest/CocoStudioComponentsTest/ComponentsTestScene.cpp Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.cpp Classes/ExtensionsTest/CocoStudioComponentsTest/GameOverScene.cpp @@ -202,10 +203,6 @@ target_link_libraries(${APP_NAME} cocos2d box2d ) -# MinGW builds need to link libws2_32 manually -if (MINGW) - target_link_libraries(${APP_NAME} ws2_32) -endif() set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}") diff --git a/tests/cpp-tests/Classes/AppDelegate.cpp b/tests/cpp-tests/Classes/AppDelegate.cpp index 724a110c20..1ca5f4ba2d 100644 --- a/tests/cpp-tests/Classes/AppDelegate.cpp +++ b/tests/cpp-tests/Classes/AppDelegate.cpp @@ -156,4 +156,4 @@ void AppDelegate::setCurrentTest(BaseTest* curTest) BaseTest* AppDelegate::getCurrentTest() { return _curTest; -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp index 5de4ba8bb6..5cac77d929 100644 --- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp +++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp @@ -275,4 +275,4 @@ void Box2DTestScene::runThisTest() Director::getInstance()->replaceScene(this); } - \ No newline at end of file + diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp new file mode 100644 index 0000000000..8f0cc798eb --- /dev/null +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp @@ -0,0 +1,325 @@ +#include "ActionTimelineTestScene.h" +#include "../../testResource.h" +#include "renderer/CCRenderer.h" +#include "renderer/CCCustomCommand.h" + + +using namespace cocos2d; +using namespace cocostudio; + +Layer *NextAnimationTest(); +Layer *BackAnimationTest(); +Layer *RestartAnimationTest(); + +static int s_nActionIdx = -1; + + +Layer *CreateAnimationLayer(int index) +{ + Layer *pLayer = nullptr; + switch(index) + { + case TEST_ANIMATIONELEMENT: + pLayer = new TestActionTimeline(); + break; + case TEST_CHANGE_PLAY_SECTION: + pLayer = new TestChangePlaySection(); + break; + case TEST_TIMELINE_FRAME_EVENT: + pLayer = new TestTimelineFrameEvent(); + break; + case TEST_TIMELINE_PERFORMACE: + pLayer = new TestTimelinePerformance(); + break; + default: + break; + } + + return pLayer; +} + + +Layer *NextAnimationTest() +{ + ++s_nActionIdx; + s_nActionIdx = s_nActionIdx % TEST_ANIMATION_LAYER_COUNT; + + Layer *pLayer = CreateAnimationLayer(s_nActionIdx); + pLayer->autorelease(); + + return pLayer; +} + +Layer *BackAnimationTest() +{ + --s_nActionIdx; + if( s_nActionIdx < 0 ) + s_nActionIdx += TEST_ANIMATION_LAYER_COUNT; + + Layer *pLayer = CreateAnimationLayer(s_nActionIdx); + pLayer->autorelease(); + + return pLayer; +} + +Layer *RestartAnimationTest() +{ + Layer *pLayer = CreateAnimationLayer(s_nActionIdx); + pLayer->autorelease(); + + return pLayer; +} + + +ActionTimelineTestScene::ActionTimelineTestScene(bool bPortrait) +{ + TestScene::init(); + + Sprite *bg = Sprite::create("armature/bg.jpg"); + bg->setPosition(VisibleRect::center()); + + float scaleX = VisibleRect::getVisibleRect().size.width / bg->getContentSize().width; + float scaleY = VisibleRect::getVisibleRect().size.height / bg->getContentSize().height; + + bg->setScaleX(scaleX); + bg->setScaleY(scaleY); + + addChild(bg); +} + +void ActionTimelineTestScene::runThisTest() +{ + s_nActionIdx = -1; + addChild(NextAnimationTest()); + + Director::getInstance()->replaceScene(this); +} + +void ActionTimelineTestScene::MainMenuCallback(Ref *pSender) +{ + //TestScene::MainMenuCallback(pSender); + + removeAllChildren(); +} + + + +void ActionTimelineTestLayer::onEnter() +{ + + Layer::onEnter(); + + // add title and subtitle + std::string str = title(); + const char *pTitle = str.c_str(); + LabelTTF *label = LabelTTF::create(pTitle, "Arial", 18); + label->setColor(Color3B(0, 0, 0)); + addChild(label, 1, 10000); + label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 30) ); + + std::string strSubtitle = subtitle(); + if( ! strSubtitle.empty() ) + { + LabelTTF *l = LabelTTF::create(strSubtitle.c_str(), "Arial", 18); + l->setColor(Color3B(0, 0, 0)); + addChild(l, 1, 10001); + l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 60) ); + } + + // add menu + backItem = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(ActionTimelineTestLayer::backCallback, this) ); + restartItem = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(ActionTimelineTestLayer::restartCallback, this) ); + nextItem = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(ActionTimelineTestLayer::nextCallback, this) ); + + Menu *menu = Menu::create(backItem, restartItem, nextItem, nullptr); + + menu->setPosition(Point::ZERO); + backItem->setPosition(Point(VisibleRect::center().x - restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2)); + restartItem->setPosition(Point(VisibleRect::center().x, VisibleRect::bottom().y + restartItem->getContentSize().height / 2)); + nextItem->setPosition(Point(VisibleRect::center().x + restartItem->getContentSize().width * 2, VisibleRect::bottom().y + restartItem->getContentSize().height / 2)); + + addChild(menu, 100); + + setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); + +} +void ActionTimelineTestLayer::onExit() +{ + removeAllChildren(); + + backItem = restartItem = nextItem = nullptr; + + ActionTimelineCache::getInstance()->purge(); + NodeReader::getInstance()->purge(); + + Layer::onExit(); +} + +std::string ActionTimelineTestLayer::title() const +{ + return "Armature Test Bed"; +} +std::string ActionTimelineTestLayer::subtitle() const +{ + return ""; +} + +void ActionTimelineTestLayer::restartCallback(Ref *pSender) +{ + Scene *s = new ActionTimelineTestScene(); + s->addChild( RestartAnimationTest() ); + Director::getInstance()->replaceScene(s); + s->release(); +} + +void ActionTimelineTestLayer::nextCallback(Ref *pSender) +{ + Scene *s = new ActionTimelineTestScene(); + s->addChild( NextAnimationTest() ); + Director::getInstance()->replaceScene(s); + s->release(); +} +void ActionTimelineTestLayer::backCallback(Ref *pSender) +{ + Scene *s = new ActionTimelineTestScene(); + s->addChild( BackAnimationTest() ); + Director::getInstance()->replaceScene(s); + s->release(); +} + + + +// TestActionTimeline +void TestActionTimeline::onEnter() +{ + ActionTimelineTestLayer::onEnter(); + + SpriteFrameCache::getInstance()->addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png"); + + Node* node = NodeReader::getInstance()->createNode("ActionTimeline/boy_1.ExportJson"); + ActionTimeline* action = ActionTimelineCache::getInstance()->createAction("ActionTimeline/boy_1.ExportJson"); + + node->runAction(action); + action->gotoFrameAndPlay(0, 60, true); + + node->setScale(0.2f); + node->setPosition(150,100); + + addChild(node); +} + +std::string TestActionTimeline::title() const +{ + return "Test ActionTimeline"; +} + + + +// TestActionTimeline +void TestChangePlaySection::onEnter() +{ + ActionTimelineTestLayer::onEnter(); + + SpriteFrameCache::getInstance()->addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png"); + + Node* node = NodeReader::getInstance()->createNode("ActionTimeline/boy_1.ExportJson"); + action = ActionTimelineCache::getInstance()->createAction("ActionTimeline/boy_1.ExportJson"); + + node->runAction(action); + action->gotoFrameAndPlay(70, action->getDuration(), true); + + node->setScale(0.2f); + node->setPosition(150,100); + + // add touch event listener + auto listener = EventListenerTouchAllAtOnce::create(); + listener->onTouchesEnded = CC_CALLBACK_2(TestChangePlaySection::onTouchesEnded, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); + + + addChild(node); +} + +std::string TestChangePlaySection::title() const +{ + return "Test Change Play Section"; +} + +void TestChangePlaySection::onTouchesEnded(const std::vector& touches, Event* event) +{ + if(action->getStartFrame() == 0) + action->gotoFrameAndPlay(70, action->getDuration(), true); + else + action->gotoFrameAndPlay(0, 60, true); +} + +// TestFrameEvent +void TestTimelineFrameEvent::onEnter() +{ + ActionTimelineTestLayer::onEnter(); + + SpriteFrameCache::getInstance()->addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png"); + + Node* node = NodeReader::getInstance()->createNode("ActionTimeline/boy_1.ExportJson"); + ActionTimeline* action = ActionTimelineCache::getInstance()->createAction("ActionTimeline/boy_1.ExportJson"); + + node->runAction(action); + action->gotoFrameAndPlay(0, 60, true); + + node->setScale(0.2f); + node->setPosition(150,100); + addChild(node); + + action->setFrameEventCallFunc(CC_CALLBACK_1(TestTimelineFrameEvent::onFrameEvent, this)); +} + +std::string TestTimelineFrameEvent::title() const +{ + return "Test Frame Event"; +} + +void TestTimelineFrameEvent::onFrameEvent(Frame* frame) +{ + EventFrame* evnt = dynamic_cast(frame); + if(!evnt) + return; + + std::string str = evnt->getEvent(); + + if (str == "changeColor") + { + evnt->getNode()->setColor(Color3B(0,0,0)); + } + else if(str == "endChangeColor") + { + evnt->getNode()->setColor(Color3B(255,255,255)); + } +} + + +// TestTimelinePerformance +void TestTimelinePerformance::onEnter() +{ + ActionTimelineTestLayer::onEnter(); + + SpriteFrameCache::getInstance()->addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png"); + + for (int i = 0; i< 100; i++) + { + Node* node = NodeReader::getInstance()->createNode("ActionTimeline/boy_1.ExportJson"); + ActionTimeline* action = ActionTimelineCache::getInstance()->createAction("ActionTimeline/boy_1.ExportJson"); + + node->runAction(action); + action->gotoFrameAndPlay(70, action->getDuration(), true); + + node->setScale(0.1f); + node->setPosition(i*2,100); + addChild(node); + } +} + +std::string TestTimelinePerformance::title() const +{ + return "Test ActionTimeline performance"; +} + diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h new file mode 100644 index 0000000000..30414845ef --- /dev/null +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h @@ -0,0 +1,88 @@ +#ifndef __ANIMATION_TEST_SCENE_H__ +#define __ANIMATION_TEST_SCENE_H__ + +#include "cocos2d.h" +#include "../../VisibleRect.h" +#include "../../testBasic.h" +#include "cocostudio/CocoStudio.h" + +using namespace cocostudio::timeline; + + +class ActionTimelineTestScene : public TestScene +{ +public: + ActionTimelineTestScene(bool bPortrait = false); + + virtual void runThisTest(); + + // The CallBack for back to the main menu scene + virtual void MainMenuCallback(Ref* pSender); +}; + +enum { + TEST_ANIMATIONELEMENT = 0, + TEST_CHANGE_PLAY_SECTION, + TEST_TIMELINE_FRAME_EVENT, + TEST_TIMELINE_PERFORMACE, + + TEST_ANIMATION_LAYER_COUNT +}; + +class ActionTimelineTestLayer : public Layer +{ +public: + virtual std::string title() const; + virtual std::string subtitle() const; + + virtual void restartCallback(Ref* pSender); + virtual void nextCallback(Ref* pSender); + virtual void backCallback(Ref* pSender); + + // overrides + virtual void onEnter() override; + virtual void onExit() override; + +protected: + MenuItemImage *restartItem; + MenuItemImage *nextItem; + MenuItemImage *backItem; +}; + + +class TestActionTimeline : public ActionTimelineTestLayer +{ +public: + virtual void onEnter(); + virtual std::string title() const override; +}; + +class TestChangePlaySection : public ActionTimelineTestLayer +{ +public: + virtual void onEnter(); + virtual std::string title() const override; + + void onTouchesEnded(const std::vector& touches, Event* event); + +protected: + ActionTimeline* action; +}; + +class TestTimelineFrameEvent : public ActionTimelineTestLayer +{ +public: + virtual void onEnter(); + virtual std::string title() const override; + + void onFrameEvent(Frame* frame); +}; + +class TestTimelinePerformance : public ActionTimelineTestLayer +{ +public: + virtual void onEnter(); + virtual std::string title() const override; +}; + +#endif // __ANIMATION_SCENE_H__ \ No newline at end of file diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 89ee6992ad..9100c94e42 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -411,10 +411,10 @@ void TestPerformance::addArmature(int number) Armature *armature = nullptr; armature = new Armature(); - armature->init("Knight_f/Knight"); + armature->init("Cowboy"); armature->getAnimation()->playWithIndex(0); armature->setPosition(50 + armatureCount * 2, 150); - armature->setScale(0.6f); + armature->setScale(0.1f); addArmatureToParent(armature); armature->release(); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp index 951d775e66..5be1a5b633 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp @@ -55,4 +55,4 @@ void AnimationsTestLayer::onControlButtonJumpClicked(Ref *pSender, Control::Even void AnimationsTestLayer::onControlButtonFunkyClicked(Ref *pSender, Control::EventType pControlEvent) { mAnimationManager->runAnimationsForSequenceNamedTweenDuration("Funky", 0.3f); -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.h index 6bd009d9be..f6c2c91d2b 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.h @@ -31,4 +31,4 @@ private: cocosbuilder::CCBAnimationManager *mAnimationManager; }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp index 30eb172d8b..13b7d55000 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp @@ -61,4 +61,4 @@ void ButtonTestLayer::onControlButtonClicked(cocos2d::Ref *pSender, Control::Eve default: assert(false); // OH SHIT! } -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.h index 922b1e1f5d..ac1ca59dd9 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.h @@ -26,4 +26,4 @@ private: cocos2d::Label * mControlEventLabel; }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.h index 6d63e9fd9c..cdd7ee00a4 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.h @@ -8,4 +8,4 @@ class CocosBuilderTestScene : public TestScene { virtual void runThisTest(); }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/LabelTest/LabelTestLayer.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/LabelTest/LabelTestLayer.h index 3cee0e0d46..9bdb4c7350 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/LabelTest/LabelTestLayer.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/LabelTest/LabelTestLayer.h @@ -9,4 +9,4 @@ class LabelTestLayer : public cocos2d::Layer { CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(LabelTestLayer, create); }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp index 200576e266..8543fe418f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp @@ -41,4 +41,4 @@ void MenuTestLayer::onMenuItemBClicked(cocos2d::Ref *pSender) { void MenuTestLayer::onMenuItemCClicked(cocos2d::Ref *pSender) { this->mMenuItemStatusLabelBMFont->setString("Menu Item C clicked."); -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.h index 19088ec81e..b542adc67d 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.h @@ -28,4 +28,4 @@ class MenuTestLayer cocos2d::Label * mMenuItemStatusLabelBMFont; }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ParticleSystemTest/ParticleSystemTestLayer.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ParticleSystemTest/ParticleSystemTestLayer.h index cf06eb3e87..62dd064f4f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ParticleSystemTest/ParticleSystemTestLayer.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ParticleSystemTest/ParticleSystemTestLayer.h @@ -9,4 +9,4 @@ class ParticleSystemTestLayer : public cocos2d::Layer { CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(ParticleSystemTestLayer, create); }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ScrollViewTest/ScrollViewTestLayer.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ScrollViewTest/ScrollViewTestLayer.h index e16039b3ca..52838de1bf 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ScrollViewTest/ScrollViewTestLayer.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ScrollViewTest/ScrollViewTestLayer.h @@ -9,4 +9,4 @@ class ScrollViewTestLayer : public cocos2d::Layer { CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(ScrollViewTestLayer, create); }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/SpriteTest/SpriteTestLayer.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/SpriteTest/SpriteTestLayer.h index 488a5c4da9..81ca61717f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/SpriteTest/SpriteTestLayer.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/SpriteTest/SpriteTestLayer.h @@ -9,4 +9,4 @@ class SpriteTestLayer : public cocos2d::Layer { CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(SpriteTestLayer, create); }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp index 7bf26107ae..822c007ed4 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp @@ -22,4 +22,4 @@ void TestHeaderLayer::onNodeLoaded(cocos2d::Node * node, cocosbuilder::NodeLoade void TestHeaderLayer::onBackClicked(cocos2d::Ref *pSender) { Director::getInstance()->popScene(); -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.h b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.h index 06792951dc..8e0985f092 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.h @@ -20,4 +20,4 @@ class TestHeaderLayer void onBackClicked(cocos2d::Ref * sender); }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp index 0f1d1dd795..4d664618f3 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ExtensionsTest.cpp @@ -9,6 +9,7 @@ #include "TableViewTest/TableViewTestScene.h" #include "CocoStudioArmatureTest/ArmatureScene.h" +#include "CocoStudioActionTimelineTest/ActionTimelineTestScene.h" #include "CocoStudioComponentsTest/ComponentsTestScene.h" #include "CocoStudioSceneTest/SceneEditorTest.h" @@ -78,6 +79,11 @@ static struct { scene->release(); } }, + { "CocoStudioActionTimelineTest", [](Ref *sender) { ActionTimelineTestScene *scene = new ActionTimelineTestScene(); + scene->runThisTest(); + scene->release(); + } + }, { "CocoStudioComponentsTest", [](Ref *sender) { runComponentsTestLayerTest(); } }, { "CocoStudioSceneTest", [](Ref *sender) { SceneEditorTestScene *scene = new SceneEditorTestScene(); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.h b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.h index 2d25827d23..5d94477680 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.h @@ -48,4 +48,4 @@ public: void runSocketIOTest(); -#endif /* defined(__TestCpp__SocketIOTest__) */ \ No newline at end of file +#endif /* defined(__TestCpp__SocketIOTest__) */ diff --git a/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.h b/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.h index fb1a54cd46..edde512780 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.h @@ -226,4 +226,4 @@ public: virtual std::string title() const override; virtual std::string subtitle() const override; -}; \ No newline at end of file +}; diff --git a/tests/cpp-tests/Classes/InputTest/MouseTest.cpp b/tests/cpp-tests/Classes/InputTest/MouseTest.cpp index 12512dafae..78e1f16094 100644 --- a/tests/cpp-tests/Classes/InputTest/MouseTest.cpp +++ b/tests/cpp-tests/Classes/InputTest/MouseTest.cpp @@ -79,4 +79,4 @@ void MouseTestScene::runThisTest() Director::getInstance()->replaceScene(this); layer->release(); -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index 0d4dc898e6..e0c7dad219 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -78,7 +78,9 @@ static std::function createFunctions[] = CL(LabelFontNameTest), CL(LabelAlignmentTest), CL(LabelIssue4428Test), - CL(LabelIssue4999Test) + CL(LabelIssue4999Test), + CL(LabelLineHeightTest), + CL(LabelAdditionalKerningTest) }; #define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0])) @@ -1773,3 +1775,91 @@ std::string LabelIssue4999Test::subtitle() const { return "Reorder issue #4999.The label should be display cleanly."; } + +LabelLineHeightTest::LabelLineHeightTest() +{ + auto size = Director::getInstance()->getWinSize(); + + auto bg = LayerColor::create(Color4B(200,191,231,255)); + this->addChild(bg); + + TTFConfig ttfConfig("fonts/arial.ttf", 25, GlyphCollection::DYNAMIC,nullptr,false); + + label = Label::createWithTTF(ttfConfig,"Test\nLine\nHeight"); + label->setPosition( Vec2(size.width/2, size.height*0.5f) ); + label->setTextColor( Color4B::RED ); + addChild(label); + + auto slider = ui::Slider::create(); + slider->setTouchEnabled(true); + slider->loadBarTexture("cocosui/sliderTrack.png"); + slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", ""); + slider->loadProgressBarTexture("cocosui/sliderProgress.png"); + slider->setPosition(Vec2(size.width / 2.0f, size.height * 0.15f + slider->getSize().height * 2.0f)); + slider->setPercent(label->getLineHeight()); + slider->addEventListener(CC_CALLBACK_2(LabelLineHeightTest::sliderEvent, this)); + addChild(slider); +} + +void LabelLineHeightTest::sliderEvent(Ref *sender, ui::Slider::EventType type) +{ + if (type == Slider::EventType::ON_PERCENTAGE_CHANGED) + { + Slider* slider = (Slider*)sender; + label->setLineHeight(slider->getPercent()); + } +} + +std::string LabelLineHeightTest::title() const +{ + return "New Label"; +} + +std::string LabelLineHeightTest::subtitle() const +{ + return "Testing line height of label"; +} + +LabelAdditionalKerningTest::LabelAdditionalKerningTest() +{ + auto size = Director::getInstance()->getWinSize(); + + auto bg = LayerColor::create(Color4B(200,191,231,255)); + this->addChild(bg); + + TTFConfig ttfConfig("fonts/arial.ttf", 40, GlyphCollection::DYNAMIC,nullptr,false); + + label = Label::createWithTTF(ttfConfig,"Test additional kerning"); + label->setPosition( Vec2(size.width/2, size.height*0.65f) ); + label->setTextColor( Color4B::RED ); + addChild(label); + + auto slider = ui::Slider::create(); + slider->setTouchEnabled(true); + slider->loadBarTexture("cocosui/sliderTrack.png"); + slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", ""); + slider->loadProgressBarTexture("cocosui/sliderProgress.png"); + slider->setPosition(Vec2(size.width / 2.0f, size.height * 0.15f + slider->getSize().height * 2.0f)); + slider->setPercent(0); + slider->addEventListener(CC_CALLBACK_2(LabelAdditionalKerningTest::sliderEvent, this)); + addChild(slider); +} + +void LabelAdditionalKerningTest::sliderEvent(Ref *sender, ui::Slider::EventType type) +{ + if (type == Slider::EventType::ON_PERCENTAGE_CHANGED) + { + Slider* slider = (Slider*)sender; + label->setAdditionalKerning(slider->getPercent()); + } +} + +std::string LabelAdditionalKerningTest::title() const +{ + return "New Label"; +} + +std::string LabelAdditionalKerningTest::subtitle() const +{ + return "Testing additional kerning of label"; +} diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h index a79942b18a..3450352982 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h @@ -496,6 +496,36 @@ public: virtual std::string subtitle() const override; }; +class LabelLineHeightTest : public AtlasDemoNew +{ +public: + CREATE_FUNC(LabelLineHeightTest); + + LabelLineHeightTest(); + + virtual std::string title() const override; + virtual std::string subtitle() const override; + + void sliderEvent(Ref *sender, ui::Slider::EventType type); +private: + Label* label; +}; + +class LabelAdditionalKerningTest : public AtlasDemoNew +{ +public: + CREATE_FUNC(LabelAdditionalKerningTest); + + LabelAdditionalKerningTest(); + + virtual std::string title() const override; + virtual std::string subtitle() const override; + + void sliderEvent(Ref *sender, ui::Slider::EventType type); +private: + Label* label; +}; + // we don't support linebreak mode #endif diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.cpp index 206e45d265..2d9b8a0a55 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceRendererTest.cpp @@ -52,4 +52,4 @@ void runRendererTest() { auto scene = RenderTestLayer::scene(); Director::getInstance()->replaceScene(scene); -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.vsh.h b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.vsh.h index 3193d9fe3b..e4a99ca648 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.vsh.h +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.vsh.h @@ -8,4 +8,4 @@ void main() gl_Position = CC_MVPMatrix * a_position; } -); \ No newline at end of file +); diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h index 0de6babe69..707d1cb80b 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.h @@ -60,4 +60,4 @@ protected: }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/ShaderTest/shaderTest.psh.h b/tests/cpp-tests/Classes/ShaderTest/shaderTest.psh.h index e21759b9b8..808050a1e4 100644 --- a/tests/cpp-tests/Classes/ShaderTest/shaderTest.psh.h +++ b/tests/cpp-tests/Classes/ShaderTest/shaderTest.psh.h @@ -471,4 +471,4 @@ void main(void) } -); \ No newline at end of file +); diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 5ff2b3b186..99061f711b 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -541,12 +541,13 @@ std::string Sprite3DWithSkinTest::subtitle() const void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p) { - auto sprite = Sprite3D::create("Sprite3DTest/girl.c3t"); + std::string fileName = "Sprite3DTest/scene.c3b"; + auto sprite = Sprite3D::create(fileName); addChild(sprite); sprite->setRotation3D(Vec3(-90.f, 0.f, 0.f)); sprite->setPosition( Vec2( p.x, p.y) ); - auto animation = Animation3D::getOrCreate("Sprite3DTest/girl.c3t"); + auto animation = Animation3D::getOrCreate(fileName); if (animation) { auto animate = Animate3D::create(animation); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp index 8b4538ea94..0cb3dcabcc 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp @@ -137,4 +137,4 @@ void CocoStudioGUITestScene::BackCallback(Ref* pSender) Director::getInstance()->replaceScene(scene); cocostudio::ArmatureDataManager::destroyInstance(); -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp index ba64cc628f..99cfc80547 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp @@ -37,4 +37,4 @@ void CustomReader::setProperties(const std::string &classType, Widget *widget, c customImageView->setText(text); } } -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp index d0ae96f33c..507c0d483b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp @@ -390,4 +390,4 @@ Scene *UISceneManager::currentUIScene() #endif } return NULL; -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp index f6d3a05ff7..c62fcad662 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp @@ -208,4 +208,4 @@ void VideoPlayerTest::videoEventCallback(Ref* sender, VideoPlayer::EventType eve default: break; } -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/UITest/UITest.cpp b/tests/cpp-tests/Classes/UITest/UITest.cpp index d4c931cf0c..242b7dd4e0 100644 --- a/tests/cpp-tests/Classes/UITest/UITest.cpp +++ b/tests/cpp-tests/Classes/UITest/UITest.cpp @@ -5,4 +5,4 @@ void UITestScene::runThisTest() { CocoStudioGUITestScene* pScene = new CocoStudioGUITestScene(); pScene->runThisTest(); -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Resources/ActionTimeline/boy_1.ExportJson b/tests/cpp-tests/Resources/ActionTimeline/boy_1.ExportJson new file mode 100644 index 0000000000..f300787d89 --- /dev/null +++ b/tests/cpp-tests/Resources/ActionTimeline/boy_1.ExportJson @@ -0,0 +1,2198 @@ +{ + "version": "1.0.0.0", + "designWidth": 1000, + "designHeight": 1024, + "dataScale": 1.0, + "textures": [ + "boy0.plist" + ], + "texturesPng": [ + "boy0.png" + ], + "nodeTree": { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.RootGUISurrogate, EditorCommon", + "scaleX": 1.0, + "scaleY": 1.0, + "visible": true, + "width": 0.0, + "height": 0.0, + "frameEvent": null, + "name": "Node", + "classname": "Node" + }, + "children": [ + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/6.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/6.png", + "plistFile": "" + }, + "x": 601.0, + "y": 260.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 440279615, + "tag": 5, + "anchorPointX": 0.34, + "anchorPointY": 0.07, + "frameEvent": "", + "name": "Sprite_4", + "classname": "Sprite" + }, + "children": [ + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/8.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/8.png", + "plistFile": "" + }, + "x": 72.0, + "y": 143.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": -2, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 749769307, + "tag": 3, + "anchorPointX": 0.77, + "anchorPointY": 0.8, + "frameEvent": "", + "name": "Sprite_2", + "classname": "Sprite" + }, + "children": [ + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/3.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/3.png", + "plistFile": "" + }, + "x": 38.0, + "y": 20.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 1042971898, + "tag": 8, + "anchorPointX": 0.5, + "anchorPointY": 0.11, + "frameEvent": "", + "name": "Sprite_7", + "classname": "Sprite" + }, + "children": [], + "name": null, + "classname": "Sprite" + } + ], + "name": null, + "classname": "Sprite" + }, + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/5.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/5.png", + "plistFile": "" + }, + "x": 144.0, + "y": 50.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": -1, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 718719067, + "tag": 6, + "anchorPointX": 0.7, + "anchorPointY": 0.79, + "frameEvent": "", + "name": "Sprite_5", + "classname": "Sprite" + }, + "children": [ + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/4.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/4.png", + "plistFile": "" + }, + "x": 60.0, + "y": -5.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 426784833, + "tag": 7, + "anchorPointX": 0.67, + "anchorPointY": 0.72, + "frameEvent": "", + "name": "Sprite_6", + "classname": "Sprite" + }, + "children": [], + "name": null, + "classname": "Sprite" + } + ], + "name": null, + "classname": "Sprite" + }, + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/2.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/2.png", + "plistFile": "" + }, + "x": 196.0, + "y": 44.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 716668964, + "tag": 9, + "anchorPointX": 0.42, + "anchorPointY": 0.75, + "frameEvent": "", + "name": "Sprite_8", + "classname": "Sprite" + }, + "children": [ + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/7.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/7.png", + "plistFile": "" + }, + "x": 164.0, + "y": 9.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 453863477, + "tag": 4, + "anchorPointX": 0.5, + "anchorPointY": 0.77, + "frameEvent": "", + "name": "Sprite_3", + "classname": "Sprite" + }, + "children": [], + "name": null, + "classname": "Sprite" + } + ], + "name": null, + "classname": "Sprite" + }, + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/hat.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/hat.png", + "plistFile": "" + }, + "x": 137.0, + "y": 301.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 729381978, + "tag": 10, + "anchorPointX": 0.77, + "anchorPointY": 0.25, + "frameEvent": "", + "name": "Sprite_9", + "classname": "Sprite" + }, + "children": [], + "name": null, + "classname": "Sprite" + }, + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/1.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/1.png", + "plistFile": "" + }, + "x": 282.0, + "y": 152.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 255, + "colorG": 255, + "colorB": 255, + "opacity": 255, + "visible": true, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 647613269, + "tag": 2, + "anchorPointX": 0.22, + "anchorPointY": 0.86, + "frameEvent": "", + "name": "Sprite_1", + "classname": "Sprite" + }, + "children": [], + "name": null, + "classname": "Sprite" + } + ], + "name": null, + "classname": "Sprite" + }, + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/4.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/4.png", + "plistFile": "" + }, + "x": 488.0, + "y": 66.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 52, + "colorG": 237, + "colorB": 58, + "opacity": 255, + "visible": false, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 822262162, + "tag": 15, + "anchorPointX": 0.5, + "anchorPointY": 0.5, + "frameEvent": "", + "name": "Sprite_11", + "classname": "Sprite" + }, + "children": [], + "name": null, + "classname": "Sprite" + }, + { + "options": { + "$type": "EditorCommon.JsonModel.Component.GUI.SpriteSurrogate, EditorCommon", + "fileName": "testAnimationResource/7.png", + "fileNameData": { + "resourceType": 1, + "path": "testAnimationResource/7.png", + "plistFile": "" + }, + "x": 722.0, + "y": 65.0, + "scaleX": 1.0, + "scaleY": 1.0, + "rotation": 0.0, + "flipX": false, + "flipY": false, + "colorR": 2, + "colorG": 49, + "colorB": 165, + "opacity": 255, + "visible": false, + "ZOrder": 0, + "classType": "Sprite", + "width": 0.0, + "height": 0.0, + "actionTag": 32747275, + "tag": 16, + "anchorPointX": 0.5, + "anchorPointY": 0.5, + "frameEvent": "", + "name": "Sprite_12", + "classname": "Sprite" + }, + "children": [], + "name": null, + "classname": "Sprite" + } + ], + "name": null, + "classname": "Node" + }, + "action": { + "duration": 130, + "speed": 1.0, + "timelines": [ + { + "frameType": "PositionFrame", + "actionTag": 440279615, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 601.0, + "y": 260.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 601.0, + "y": 243.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 601.0, + "y": 260.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 601.0, + "y": 302.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 601.0, + "y": 276.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 601.0, + "y": 302.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 601.0, + "y": 266.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 601.0, + "y": 302.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 440279615, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 440279615, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -0.9363089, + "y": -0.9363089, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.272187382, + "y": 0.272187382, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -3.800404, + "y": -3.800404, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -5.22106457, + "y": -5.22106457, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 4.140224, + "y": 4.140224, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 6.63524, + "y": 6.63524, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.272187382, + "y": 0.272187382, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "EventFrame", + "actionTag": 440279615, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLineStringFrameSurrogate, EditorCommon", + "value": "", + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLineStringFrameSurrogate, EditorCommon", + "value": "changeColor", + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLineStringFrameSurrogate, EditorCommon", + "value": "endChangeColor", + "frameIndex": 60, + "tween": true + } + ] + }, + { + "frameType": "PositionFrame", + "actionTag": 749769307, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 72.0, + "y": 143.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 74.0, + "y": 150.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 72.0, + "y": 143.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 85.0, + "y": 143.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 74.0, + "y": 133.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 74.0, + "y": 133.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 73.0, + "y": 135.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 77.0, + "y": 136.0, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 80.0, + "y": 141.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 85.0, + "y": 143.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 749769307, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 749769307, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -7.453563, + "y": -7.453563, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -45.5398178, + "y": -45.5398178, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -32.180584, + "y": -32.180584, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -15.1353874, + "y": -15.1353874, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -28.6575718, + "y": -28.6575718, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -53.086937, + "y": -53.086937, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -84.56819, + "y": -84.56819, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -45.5398178, + "y": -45.5398178, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ZOrderFrame", + "actionTag": 749769307, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLineIntFrameSurrogate, EditorCommon", + "value": -2, + "frameIndex": 0, + "tween": true + } + ] + }, + { + "frameType": "PositionFrame", + "actionTag": 1042971898, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 38.0, + "y": 20.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 30.0, + "y": 28.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 38.0, + "y": 20.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 24.0, + "y": 46.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 26.0, + "y": 39.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 23.0, + "y": 35.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 34.0, + "y": 34.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 22.0, + "y": 43.0, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 33.0, + "y": 33.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 24.0, + "y": 46.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 1042971898, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 1042971898, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -5.32836628, + "y": -5.32836628, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -76.14927, + "y": -76.14927, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -79.7780762, + "y": -79.7780762, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -86.0518951, + "y": -86.0518951, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -88.36781, + "y": -88.36781, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -66.165184, + "y": -66.165184, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -39.37061, + "y": -39.37061, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -76.14927, + "y": -76.14927, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "PositionFrame", + "actionTag": 718719067, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 144.0, + "y": 50.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 142.0, + "y": 59.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 144.0, + "y": 50.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 202.0, + "y": 37.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 194.0, + "y": 23.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 203.0, + "y": 7.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 177.0, + "y": 80.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 137.0, + "y": 82.0, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 125.0, + "y": 22.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 202.0, + "y": 37.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 718719067, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 718719067, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -30.4871216, + "y": -30.4871216, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -55.49503, + "y": -55.49503, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -65.75558, + "y": -65.75558, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -39.3511925, + "y": -39.3511925, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -3.07847571, + "y": -3.07847571, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 12.323699, + "y": 12.323699, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -30.4871216, + "y": -30.4871216, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ZOrderFrame", + "actionTag": 718719067, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLineIntFrameSurrogate, EditorCommon", + "value": -1, + "frameIndex": 0, + "tween": true + } + ] + }, + { + "frameType": "PositionFrame", + "actionTag": 426784833, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 60.0, + "y": -5.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 58.0, + "y": 8.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 60.0, + "y": -5.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 44.0, + "y": -10.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 36.0, + "y": 10.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 42.0, + "y": 8.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 63.0, + "y": 5.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 79.0, + "y": 2.0, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 77.0, + "y": -12.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 44.0, + "y": -10.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 426784833, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 426784833, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -1.48815751, + "y": -1.48815751, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 12.4439116, + "y": 12.4439116, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 27.2269726, + "y": 27.2269726, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 35.7791862, + "y": 35.7791862, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.3896717, + "y": 0.3896717, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -19.0932655, + "y": -19.0932655, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -11.7843628, + "y": -11.7843628, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 12.4439116, + "y": 12.4439116, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "PositionFrame", + "actionTag": 716668964, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 196.0, + "y": 44.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 194.0, + "y": 53.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 196.0, + "y": 44.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 167.0, + "y": 31.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 146.0, + "y": 8.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 112.0, + "y": -6.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 143.0, + "y": 10.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 202.0, + "y": 32.0, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 194.0, + "y": 28.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 167.0, + "y": 31.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 716668964, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 716668964, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 23.2254734, + "y": 23.2254734, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 61.1631927, + "y": 61.1631927, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 58.3439522, + "y": 58.3439522, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 25.947691, + "y": 25.947691, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -2.07755661, + "y": -2.07755661, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -23.33069, + "y": -23.33069, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 23.2254734, + "y": 23.2254734, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "PositionFrame", + "actionTag": 453863477, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 164.0, + "y": 9.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 166.0, + "y": 14.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 164.0, + "y": 9.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 167.0, + "y": 41.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 153.0, + "y": 49.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 157.0, + "y": 44.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 162.0, + "y": 19.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 163.0, + "y": 15.0, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 156.0, + "y": 13.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 167.0, + "y": 41.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 453863477, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 453863477, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 2.614448, + "y": 2.614448, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -47.04919, + "y": -47.04919, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -62.07396, + "y": -62.07396, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -33.3642273, + "y": -33.3642273, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -25.57315, + "y": -25.57315, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -19.1204987, + "y": -19.1204987, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -4.30311966, + "y": -4.30311966, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -47.04919, + "y": -47.04919, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "PositionFrame", + "actionTag": 729381978, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 137.0, + "y": 301.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 143.0, + "y": 297.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 137.0, + "y": 301.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 146.0, + "y": 289.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 149.0, + "y": 290.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 146.0, + "y": 287.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 148.0, + "y": 289.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 147.0, + "y": 290.0, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 148.0, + "y": 291.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 146.0, + "y": 289.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 729381978, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 729381978, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 6.1498704, + "y": 6.1498704, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 11.1060257, + "y": 11.1060257, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 11.1060257, + "y": 11.1060257, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 11.1060257, + "y": 11.1060257, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 11.1060257, + "y": 11.1060257, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 11.1060257, + "y": 11.1060257, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "PositionFrame", + "actionTag": 647613269, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 282.0, + "y": 152.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 280.0, + "y": 148.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 282.0, + "y": 152.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 287.0, + "y": 153.0, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 277.0, + "y": 144.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 274.0, + "y": 135.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 279.0, + "y": 147.0, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 281.0, + "y": 153.0, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 288.0, + "y": 149.0, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 287.0, + "y": 153.0, + "frameIndex": 130, + "tween": true + } + ] + }, + { + "frameType": "ScaleFrame", + "actionTag": 647613269, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 1.0, + "y": 1.0, + "frameIndex": 100, + "tween": true + } + ] + }, + { + "frameType": "RotationSkewFrame", + "actionTag": 647613269, + "frames": [ + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 0, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 30, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 0.0, + "y": 0.0, + "frameIndex": 60, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 20.6256847, + "y": 20.6256847, + "frameIndex": 70, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -8.132871, + "y": -8.132871, + "frameIndex": 80, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": -17.91947, + "y": -17.91947, + "frameIndex": 90, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 3.91054678, + "y": 3.91054678, + "frameIndex": 100, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 15.3684883, + "y": 15.3684883, + "frameIndex": 110, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 34.9562759, + "y": 34.9562759, + "frameIndex": 120, + "tween": true + }, + { + "$type": "EditorCommon.JsonModel.Animation.TimeLinePointFrameSurrogate, EditorCommon", + "x": 20.6256847, + "y": 20.6256847, + "frameIndex": 130, + "tween": true + } + ] + } + ] + }, + "name": null, + "classname": null +} \ No newline at end of file diff --git a/tests/cpp-tests/proj.android/jni/Application.mk b/tests/cpp-tests/proj.android/jni/Application.mk index 35642d9b9d..cdd0d48ce0 100644 --- a/tests/cpp-tests/proj.android/jni/Application.mk +++ b/tests/cpp-tests/proj.android/jni/Application.mk @@ -11,4 +11,4 @@ ifeq ($(APP_DEBUG),1) else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release -endif \ No newline at end of file +endif diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj index 237d58b5ac..a5f6d0d258 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj @@ -149,6 +149,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou + @@ -329,6 +330,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou + diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters index 0429dd329f..4f77ffe13f 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters @@ -325,6 +325,9 @@ {45e9becf-58e5-424e-903d-9bc7f9999d5b} + + {fa88df83-76d7-4f41-ad48-801dafd44889} + @@ -840,6 +843,9 @@ Classes\Sprite3DTest + + Classes\ExtensionsTest\CocoStudioActionTimelineTest + @@ -1553,5 +1559,8 @@ Classes\Sprite3DTest + + Classes\ExtensionsTest\CocoStudioActionTimelineTest + \ No newline at end of file diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/pch.h b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/pch.h index 842a70abec..5e0bbb907c 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/pch.h +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/pch.h @@ -1,3 +1,3 @@ #pragma once -#include "cocos2d.h" \ No newline at end of file +#include "cocos2d.h" diff --git a/tests/lua-empty-test/project/proj.android/jni/Application.mk b/tests/lua-empty-test/project/proj.android/jni/Application.mk index f0582bf96e..2ccd787827 100644 --- a/tests/lua-empty-test/project/proj.android/jni/Application.mk +++ b/tests/lua-empty-test/project/proj.android/jni/Application.mk @@ -11,4 +11,4 @@ ifeq ($(APP_DEBUG),1) else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release -endif \ No newline at end of file +endif diff --git a/tests/lua-tests/project/Classes/AppDelegate.cpp b/tests/lua-tests/project/Classes/AppDelegate.cpp index cbcd0f6821..3bad5648b8 100644 --- a/tests/lua-tests/project/Classes/AppDelegate.cpp +++ b/tests/lua-tests/project/Classes/AppDelegate.cpp @@ -47,9 +47,11 @@ bool AppDelegate::applicationDidFinishLaunching() // register lua engine LuaEngine* pEngine = LuaEngine::getInstance(); ScriptEngineManager::getInstance()->setScriptEngine(pEngine); + + LuaStack* stack = pEngine->getLuaStack(); + stack->setXXTEAKeyAndSign("2dxLua", strlen("2dxLua"), "XXTEA", strlen("XXTEA")); #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID ||CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) - LuaStack* stack = pEngine->getLuaStack(); register_assetsmanager_test_sample(stack->getLuaState()); #endif diff --git a/tests/lua-tests/project/proj.android/jni/Application.mk b/tests/lua-tests/project/proj.android/jni/Application.mk index f0582bf96e..2ccd787827 100644 --- a/tests/lua-tests/project/proj.android/jni/Application.mk +++ b/tests/lua-tests/project/proj.android/jni/Application.mk @@ -11,4 +11,4 @@ ifeq ($(APP_DEBUG),1) else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release -endif \ No newline at end of file +endif diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest.luac b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest.luac new file mode 100644 index 0000000000..a80fd1e678 Binary files /dev/null and b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest.luac differ diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua new file mode 100644 index 0000000000..c8d20a7bf4 --- /dev/null +++ b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua @@ -0,0 +1,104 @@ +require("src/ByteCodeEncryptTest/ByteCodeTest") +require("src/ByteCodeEncryptTest/ByteCodeAndEncryptTest") + +local LINE_SPACE = 40 +local ItemTagBasic = 1000 + +local ByteCodeEncryptEnum = +{ + TEST_BYTECODE = 0, + TEST_BYTECODE_ENCRYPT = 1, + TEST_MAX_COUNT = 2, +} + +local TestsName = +{ + "ByteCodeFileTest", + "ByteCodeAndEncryptFileTest", +} + +local CreateByteCodeEncryptTestTable = +{ + runByteCodeFileTest, + runByteCodeAndEncryptFileTest, +} + +local function byteCodeEncryptMainLayer() + local size = cc.Director:getInstance():getWinSize() + + local function createByteCodeEncryptTestScene(index) + local newScene = CreateByteCodeEncryptTestTable[index]() + return newScene + end + + local function menuCallback(tag, sender) + local scene = nil + local index = sender:getLocalZOrder() - ItemTagBasic + local byteCodeEncryptScene = createByteCodeEncryptTestScene(index) + if nil ~= byteCodeEncryptScene then + cc.Director:getInstance():replaceScene(byteCodeEncryptScene) + end + end + + local layer = cc.Layer:create() + local menu = cc.Menu:create() + menu:setPosition(cc.p(0, 0)) + cc.MenuItemFont:setFontName("Arial") + cc.MenuItemFont:setFontSize(24) + + for i = 1, ByteCodeEncryptEnum.TEST_MAX_COUNT do + local item = cc.MenuItemFont:create(TestsName[i]) + item:registerScriptTapHandler(menuCallback) + item:setPosition(size.width / 2, size.height - i * LINE_SPACE) + menu:addChild(item, ItemTagBasic + i) + end + + layer:addChild(menu) + + -- handling touch events + local beginPos = {x = 0, y = 0} + local function onTouchesBegan(touches, event) + beginPos = touches[1]:getLocation() + end + + local function onTouchesMoved(touches, event) + local location = touches[1]:getLocation() + + local nMoveY = location.y - beginPos.y + local curPosx, curPosy = menu:getPosition() + local nextPosy = curPosy + nMoveY + local winSize = cc.Director:getInstance():getWinSize() + if nextPosy < 0 then + menu:setPosition(0, 0) + return + end + + if nextPosy > ((ByteCodeEncryptEnum.TEST_MAX_COUNT + 1) * LINE_SPACE - winSize.height) then + menu:setPosition(0, ((ByteCodeEncryptEnum.TEST_MAX_COUNT + 1) * LINE_SPACE - winSize.height)) + return + end + + menu:setPosition(curPosx, nextPosy) + beginPos = {x = location.x, y = location.y} + end + + local listener = cc.EventListenerTouchAllAtOnce:create() + listener:registerScriptHandler(onTouchesBegan,cc.Handler.EVENT_TOUCHES_BEGAN ) + listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCH_MOVED ) + + local eventDispatcher = layer:getEventDispatcher() + eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer) + + return layer +end +------------------------------------- +-- ByteCodeEncrypt Test +------------------------------------- +function ByteCodeEncryptTestMain() + local scene = cc.Scene:create() + + scene:addChild(byteCodeEncryptMainLayer()) + scene:addChild(CreateBackMenuItem()) + + return scene +end diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest.luac b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest.luac new file mode 100644 index 0000000000..9f782fc431 Binary files /dev/null and b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest.luac differ diff --git a/tests/lua-tests/src/mainMenu.lua b/tests/lua-tests/src/mainMenu.lua index 8d2241a1f4..ce3f86c60c 100644 --- a/tests/lua-tests/src/mainMenu.lua +++ b/tests/lua-tests/src/mainMenu.lua @@ -15,6 +15,7 @@ require "src/ActionsProgressTest/ActionsProgressTest" require "src/ActionsTest/ActionsTest" require "src/AssetsManagerTest/AssetsManagerTest" require "src/BugsTest/BugsTest" +require "src/ByteCodeEncryptTest/ByteCodeEncryptTest" require "src/ClickAndMoveTest/ClickAndMoveTest" require "src/CocosDenshionTest/CocosDenshionTest" require "src/CocoStudioTest/CocoStudioTest" @@ -70,6 +71,7 @@ local _allTests = { { isSupported = false, name = "Box2dTest" , create_func= Box2dTestMain }, { isSupported = false, name = "Box2dTestBed" , create_func= Box2dTestBedMain }, { isSupported = true, name = "BugsTest" , create_func= BugsTestMain }, + { isSupported = true, name = "ByteCodeEncryptTest" , create_func= ByteCodeEncryptTestMain }, { isSupported = false, name = "ChipmunkAccelTouchTest" , create_func= ChipmunkAccelTouchTestMain }, { isSupported = true, name = "ClickAndMoveTest" , create_func = ClickAndMoveTest }, { isSupported = true, name = "CocosDenshionTest" , create_func = CocosDenshionTestMain }, diff --git a/tools/bindings-generator b/tools/bindings-generator index 79153cce44..5f3bf19c5d 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 79153cce443f3efbfd79c08835c63ec58a6c1462 +Subproject commit 5f3bf19c5d59903662571c722fe4b34cae7e9404 diff --git a/tools/cocos2d-console b/tools/cocos2d-console index f5037bab73..3164639ee4 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit f5037bab73a8fb109e8e34656220bed1a1743087 +Subproject commit 3164639ee44570d7cd3efb3c511e52077560e6fb diff --git a/tools/tolua/cocos2dx_spine.ini b/tools/tolua/cocos2dx_spine.ini index f1eefdea94..783e2a052e 100644 --- a/tools/tolua/cocos2dx_spine.ini +++ b/tools/tolua/cocos2dx_spine.ini @@ -37,7 +37,7 @@ classes = Skeleton SkeletonAnimation # functions from all classes. skip = Skeleton::[findBone findSlot getAttachment setAttachment update draw createWith.*], - SkeletonAnimation::[addAnimationState setAnimationStateData update createWith.* (s|g)etBlendFunc addAnimation getCurrent setAnimation onAnimationStateEvent] + SkeletonAnimation::[addAnimationState setAnimationStateData update createWith.* (s|g)etBlendFunc addAnimation getCurrent setAnimation] rename_functions =