diff --git a/.travis.yml b/.travis.yml index 539d4be9e9cb..1bccfbf9d614 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,5 +37,4 @@ before_install: # whitelist branches: only: - - v3.7.1 - v3 diff --git a/AUTHORS b/AUTHORS index 97d2271c2039..3d3b4c5a0ecf 100644 --- a/AUTHORS +++ b/AUTHORS @@ -23,6 +23,7 @@ Framework & Tools Developers: Web Developers: Sijie Wang (VisualSJ) + Menghe Zhang (ZhangMenghe) 3D Developers: Xiao Yang (super626) @@ -136,6 +137,7 @@ Developers: Added Dutch Language support. Added clang support for Windows. Cmake update and remove old scripts from build folder + Fixed building with system prebuilt libs on Linux mchinen fix emulator issue for OpenGL ES 2.0 on Android diff --git a/CHANGELOG b/CHANGELOG index d5c020b8a03f..27ae37284c4e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,30 @@ cocos2d-x-3.8 ?? [FIX] renderer: UI component can't click correctly by moving UI and camera far away of origin. [FIX] JS: Fixed issue of iOS/JS reflection `callStaticMethod` with bool arg +cocos2d-x-3.7.1 ?? + [HIGHLIGHT] studio: Added new skeleton animation support and csb parser for cocos v2.3.2 beta + [HIGHLIGHT] studio: Added new skeleton animation support and JSON parser in the web engine + [HIGHLIGHT] studio: Added Skybox csb/JSON parser for cocos v2.3.2 beta + + [NEW] Node: Added getNodeToParentTransform with selected ancestor + [NEW] studio: Parsed Touch/Click/Event callback in JSON parser + [NEW] web: Added cc.director.setClearColor and support transparent background + [NEW] web: Added Animate's getCurrentFrameIndex function + + [REFINE] studio: Optimized JSON parser's performance by removing audio play + [REFINE] studio: Optimized editor related extension data to a component instead of hosting in _userObject + [REFINE] studio: Updated Game3DNodeReader & UserCameraReader + [REFINE] web: Improved color/opacity manipulations in MenuItems + + [FIX] Scene: Fixed Scene can't be inherited with std::vector members + [FIX] Label: Fixed creation fail if the font(TTF) contains a non-unicode charmap + [FIX] platform: Fixed building with system prebuilt libs on Linux + [FIX] studio: Fixed ccs.Skin construction issue in JSON parser + [FIX] web: Fixed an issue that loading process won't trigger callback problem + [FIX] web: Fixed a bug where not resetting cc.Audio._ignoreEnded when replaying a sound caused it to stay in a "playing" state + [FIX] web: cc.ScrollView and cc.TableView: added check for parent visibility in onTouchBegan method + [FIX] web: Fixed TurnPageDown effect + cocos2d-x-3.7final July.21 2015 [REFINE] JS: Improve manual binding code for `retain`, `release`, `onEnter`, `onExit`, `onEnterTransitionDidFinish` and `onExitTransitionDidStart` [REFINE] web: Add compatible Uint16Array defintion diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f786e775788..7e11bb1b31e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ endif() project (Cocos2d-X) # The version number -set(COCOS2D_X_VERSION 3.7) +set(COCOS2D_X_VERSION 3.7.1) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/") include(CocosBuildHelpers) diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 46ea29887009..64a76a45daf7 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1294,10 +1294,6 @@ 382384451A25915C002C4610 /* SpriteReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 382384421A25915C002C4610 /* SpriteReader.cpp */; }; 382384461A25915C002C4610 /* SpriteReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 382384431A25915C002C4610 /* SpriteReader.h */; }; 382384471A25915C002C4610 /* SpriteReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 382384431A25915C002C4610 /* SpriteReader.h */; }; - 382F7ADC1AB1292A002EBECF /* CCObjectExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 382F7ADA1AB1292A002EBECF /* CCObjectExtensionData.cpp */; }; - 382F7ADD1AB1292A002EBECF /* CCObjectExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 382F7ADA1AB1292A002EBECF /* CCObjectExtensionData.cpp */; }; - 382F7ADE1AB1292A002EBECF /* CCObjectExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 382F7ADB1AB1292A002EBECF /* CCObjectExtensionData.h */; }; - 382F7ADF1AB1292A002EBECF /* CCObjectExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 382F7ADB1AB1292A002EBECF /* CCObjectExtensionData.h */; }; 38ACD1FC1A27111900C3093D /* WidgetCallBackHandlerProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38ACD1FA1A27111900C3093D /* WidgetCallBackHandlerProtocol.cpp */; }; 38ACD1FD1A27111900C3093D /* WidgetCallBackHandlerProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38ACD1FA1A27111900C3093D /* WidgetCallBackHandlerProtocol.cpp */; }; 38ACD1FE1A27111900C3093D /* WidgetCallBackHandlerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 38ACD1FB1A27111900C3093D /* WidgetCallBackHandlerProtocol.h */; }; @@ -1338,6 +1334,10 @@ 3EACC9A519F5014D00EB3C5E /* CCLight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EACC99E19F5014D00EB3C5E /* CCLight.cpp */; }; 3EACC9A619F5014D00EB3C5E /* CCLight.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EACC99F19F5014D00EB3C5E /* CCLight.h */; }; 3EACC9A719F5014D00EB3C5E /* CCLight.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EACC99F19F5014D00EB3C5E /* CCLight.h */; }; + 43015DBF1B60DF4000E75161 /* CCComExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */; }; + 43015DC01B60DF4000E75161 /* CCComExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */; }; + 43015DC11B60DF4000E75161 /* CCComExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */; }; + 43015DC21B60DF4000E75161 /* CCComExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */; }; 464AD6E5197EBB1400E502D8 /* pvr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 464AD6E3197EBB1400E502D8 /* pvr.cpp */; }; 464AD6E6197EBB1400E502D8 /* pvr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 464AD6E3197EBB1400E502D8 /* pvr.cpp */; }; 464AD6E7197EBB1400E502D8 /* pvr.h in Headers */ = {isa = PBXBuildFile; fileRef = 464AD6E4197EBB1400E502D8 /* pvr.h */; }; @@ -1842,6 +1842,17 @@ 826294351AAF004C00CB7CF7 /* HttpCookie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2C1A5349A3004E4C60 /* HttpCookie.cpp */; }; 8525E3A21B291E42008EE815 /* clipper.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 8525E3A11B291E42008EE815 /* clipper.hpp */; }; 8525E3A31B291E42008EE815 /* clipper.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 8525E3A11B291E42008EE815 /* clipper.hpp */; }; + 85505F041B60E3AB003F2CD4 /* CCBoneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306631B60B583001E6D43 /* CCBoneNode.cpp */; }; + 85505F051B60E3B2003F2CD4 /* CCBoneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306641B60B583001E6D43 /* CCBoneNode.h */; }; + 85505F061B60E3B6003F2CD4 /* CCSkeletonNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */; }; + 85505F071B60E3BA003F2CD4 /* CCSkeletonNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306661B60B583001E6D43 /* CCSkeletonNode.h */; }; + 85505F081B60E3BD003F2CD4 /* CCSkinNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306671B60B583001E6D43 /* CCSkinNode.cpp */; }; + 85505F091B60E3C1003F2CD4 /* CCSkinNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306681B60B583001E6D43 /* CCSkinNode.h */; }; + 85505F0A1B60E3CE003F2CD4 /* BoneNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306701B60B5B2001E6D43 /* BoneNodeReader.cpp */; }; + 85505F0B1B60E3D1003F2CD4 /* BoneNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306711B60B5B2001E6D43 /* BoneNodeReader.h */; }; + 85505F0C1B60E3D5003F2CD4 /* CSBoneBinary_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306721B60B5B2001E6D43 /* CSBoneBinary_generated.h */; }; + 85505F0D1B60E3D8003F2CD4 /* SkeletonNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306731B60B5B2001E6D43 /* SkeletonNodeReader.cpp */; }; + 85505F0E1B60E3DB003F2CD4 /* SkeletonNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306741B60B5B2001E6D43 /* SkeletonNodeReader.h */; }; 85B3743A1B204B9400C488D6 /* clipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B374381B204B9400C488D6 /* clipper.cpp */; }; 85B3743B1B204B9400C488D6 /* clipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B374381B204B9400C488D6 /* clipper.cpp */; }; A07A4CAF1783777C0073F6A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1551A342158F2AB200E66CFE /* Foundation.framework */; }; @@ -3572,6 +3583,17 @@ B6DD2FF61B04825B00E47F5F /* fastlz.c in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA51B04825B00E47F5F /* fastlz.c */; }; B6DD2FF71B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; }; B6DD2FF81B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; }; + C50306691B60B583001E6D43 /* CCBoneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306631B60B583001E6D43 /* CCBoneNode.cpp */; }; + C503066A1B60B583001E6D43 /* CCBoneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306641B60B583001E6D43 /* CCBoneNode.h */; }; + C503066B1B60B583001E6D43 /* CCSkeletonNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */; }; + C503066C1B60B583001E6D43 /* CCSkeletonNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306661B60B583001E6D43 /* CCSkeletonNode.h */; }; + C503066D1B60B583001E6D43 /* CCSkinNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306671B60B583001E6D43 /* CCSkinNode.cpp */; }; + C503066E1B60B583001E6D43 /* CCSkinNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306681B60B583001E6D43 /* CCSkinNode.h */; }; + C50306751B60B5B2001E6D43 /* BoneNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306701B60B5B2001E6D43 /* BoneNodeReader.cpp */; }; + C50306761B60B5B2001E6D43 /* BoneNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306711B60B5B2001E6D43 /* BoneNodeReader.h */; }; + C50306771B60B5B2001E6D43 /* CSBoneBinary_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306721B60B5B2001E6D43 /* CSBoneBinary_generated.h */; }; + C50306781B60B5B2001E6D43 /* SkeletonNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306731B60B5B2001E6D43 /* SkeletonNodeReader.cpp */; }; + C50306791B60B5B2001E6D43 /* SkeletonNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306741B60B5B2001E6D43 /* SkeletonNodeReader.h */; }; D0FD03491A3B51AA00825BB5 /* CCAllocatorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = D0FD033B1A3B51AA00825BB5 /* CCAllocatorBase.h */; }; D0FD034A1A3B51AA00825BB5 /* CCAllocatorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = D0FD033B1A3B51AA00825BB5 /* CCAllocatorBase.h */; }; D0FD034B1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0FD033C1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp */; }; @@ -4115,8 +4137,6 @@ 3823843C1A259140002C4610 /* SingleNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleNodeReader.h; sourceTree = ""; }; 382384421A25915C002C4610 /* SpriteReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpriteReader.cpp; sourceTree = ""; }; 382384431A25915C002C4610 /* SpriteReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpriteReader.h; sourceTree = ""; }; - 382F7ADA1AB1292A002EBECF /* CCObjectExtensionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCObjectExtensionData.cpp; sourceTree = ""; }; - 382F7ADB1AB1292A002EBECF /* CCObjectExtensionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCObjectExtensionData.h; sourceTree = ""; }; 38ACD1FA1A27111900C3093D /* WidgetCallBackHandlerProtocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WidgetCallBackHandlerProtocol.cpp; sourceTree = ""; }; 38ACD1FB1A27111900C3093D /* WidgetCallBackHandlerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WidgetCallBackHandlerProtocol.h; sourceTree = ""; }; 38B8E2D319E66581002D7CE7 /* CSLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSLoader.cpp; sourceTree = ""; }; @@ -4143,6 +4163,8 @@ 3EACC99D19F5014D00EB3C5E /* CCCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCamera.h; sourceTree = ""; }; 3EACC99E19F5014D00EB3C5E /* CCLight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLight.cpp; sourceTree = ""; }; 3EACC99F19F5014D00EB3C5E /* CCLight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLight.h; sourceTree = ""; }; + 43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCComExtensionData.cpp; sourceTree = ""; }; + 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComExtensionData.h; sourceTree = ""; }; 464AD6E3197EBB1400E502D8 /* pvr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pvr.cpp; path = ../base/pvr.cpp; sourceTree = ""; }; 464AD6E4197EBB1400E502D8 /* pvr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pvr.h; path = ../base/pvr.h; sourceTree = ""; }; 46A15FCC1807A544005B8026 /* AUTHORS */ = {isa = PBXFileReference; lastKnownFileType = text; name = AUTHORS; path = ../AUTHORS; sourceTree = ""; }; @@ -5494,6 +5516,17 @@ B6DD2FA31B04825B00E47F5F /* DetourTileCacheBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourTileCacheBuilder.h; sourceTree = ""; }; B6DD2FA51B04825B00E47F5F /* fastlz.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fastlz.c; sourceTree = ""; }; B6DD2FA61B04825B00E47F5F /* fastlz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fastlz.h; sourceTree = ""; }; + C50306631B60B583001E6D43 /* CCBoneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBoneNode.cpp; sourceTree = ""; }; + C50306641B60B583001E6D43 /* CCBoneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBoneNode.h; sourceTree = ""; }; + C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSkeletonNode.cpp; sourceTree = ""; }; + C50306661B60B583001E6D43 /* CCSkeletonNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSkeletonNode.h; sourceTree = ""; }; + C50306671B60B583001E6D43 /* CCSkinNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSkinNode.cpp; sourceTree = ""; }; + C50306681B60B583001E6D43 /* CCSkinNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSkinNode.h; sourceTree = ""; }; + C50306701B60B5B2001E6D43 /* BoneNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BoneNodeReader.cpp; path = SkeletonReader/BoneNodeReader.cpp; sourceTree = ""; }; + C50306711B60B5B2001E6D43 /* BoneNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BoneNodeReader.h; path = SkeletonReader/BoneNodeReader.h; sourceTree = ""; }; + C50306721B60B5B2001E6D43 /* CSBoneBinary_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSBoneBinary_generated.h; path = SkeletonReader/CSBoneBinary_generated.h; sourceTree = ""; }; + C50306731B60B5B2001E6D43 /* SkeletonNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkeletonNodeReader.cpp; path = SkeletonReader/SkeletonNodeReader.cpp; sourceTree = ""; }; + C50306741B60B5B2001E6D43 /* SkeletonNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkeletonNodeReader.h; path = SkeletonReader/SkeletonNodeReader.h; sourceTree = ""; }; D0FD033B1A3B51AA00825BB5 /* CCAllocatorBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCAllocatorBase.h; sourceTree = ""; }; D0FD033C1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCAllocatorDiagnostics.cpp; sourceTree = ""; }; D0FD033D1A3B51AA00825BB5 /* CCAllocatorDiagnostics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCAllocatorDiagnostics.h; sourceTree = ""; }; @@ -5563,6 +5596,7 @@ 0634A4C4194B19E400E608AF /* ActionTimeline */ = { isa = PBXGroup; children = ( + C50306621B60B56C001E6D43 /* Skeleton */, 4D76BE381A4AAF0A00102962 /* CCActionTimelineNode.cpp */, 4D76BE391A4AAF0A00102962 /* CCActionTimelineNode.h */, 38B8E2D319E66581002D7CE7 /* CSLoader.cpp */, @@ -6347,8 +6381,6 @@ 382384061A25900F002C4610 /* FlatBuffersSerialize.h */, 38ACD1FA1A27111900C3093D /* WidgetCallBackHandlerProtocol.cpp */, 38ACD1FB1A27111900C3093D /* WidgetCallBackHandlerProtocol.h */, - 382F7ADA1AB1292A002EBECF /* CCObjectExtensionData.cpp */, - 382F7ADB1AB1292A002EBECF /* CCObjectExtensionData.h */, 29E99D1C1957BA7000046604 /* CocoLoader.cpp */, 29E99D1D1957BA7000046604 /* CocoLoader.h */, 0634A4C4194B19E400E608AF /* ActionTimeline */, @@ -6392,6 +6424,8 @@ 1A8C5965180E930E00EF57C3 /* CCComController.h */, 1A8C5966180E930E00EF57C3 /* CCComRender.cpp */, 1A8C5967180E930E00EF57C3 /* CCComRender.h */, + 43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */, + 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */, 1A8C5968180E930E00EF57C3 /* CCDataReaderHelper.cpp */, 1A8C5969180E930E00EF57C3 /* CCDataReaderHelper.h */, 1A8C596A180E930E00EF57C3 /* CCDatas.cpp */, @@ -7580,6 +7614,7 @@ 50FCEB6818C72017004AD434 /* WidgetReader */ = { isa = PBXGroup; children = ( + C503066F1B60B590001E6D43 /* SkeletonReader */, 18956BAF1A9DFBEC006E9155 /* Particle3DReader */, 182C5CE21A9D70C000C30D34 /* UserCameraReader */, 182C5CD31A98F2F400C30D34 /* Sprite3DReader */, @@ -8808,6 +8843,31 @@ path = ../external/recast/fastlz; sourceTree = ""; }; + C50306621B60B56C001E6D43 /* Skeleton */ = { + isa = PBXGroup; + children = ( + C50306631B60B583001E6D43 /* CCBoneNode.cpp */, + C50306641B60B583001E6D43 /* CCBoneNode.h */, + C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */, + C50306661B60B583001E6D43 /* CCSkeletonNode.h */, + C50306671B60B583001E6D43 /* CCSkinNode.cpp */, + C50306681B60B583001E6D43 /* CCSkinNode.h */, + ); + name = Skeleton; + sourceTree = ""; + }; + C503066F1B60B590001E6D43 /* SkeletonReader */ = { + isa = PBXGroup; + children = ( + C50306701B60B5B2001E6D43 /* BoneNodeReader.cpp */, + C50306711B60B5B2001E6D43 /* BoneNodeReader.h */, + C50306721B60B5B2001E6D43 /* CSBoneBinary_generated.h */, + C50306731B60B5B2001E6D43 /* SkeletonNodeReader.cpp */, + C50306741B60B5B2001E6D43 /* SkeletonNodeReader.h */, + ); + name = SkeletonReader; + sourceTree = ""; + }; D0FD03391A3B51AA00825BB5 /* allocator */ = { isa = PBXGroup; children = ( @@ -8955,6 +9015,7 @@ 15AE187B19AAD33D00C27E9E /* CCBAnimationManager.h in Headers */, B665E2841AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandler.h in Headers */, B6CAB52D1AF9AA1A00B9B856 /* btSerializer.h in Headers */, + C503066C1B60B583001E6D43 /* CCSkeletonNode.h in Headers */, B665E3E01AA80A6600DDB1C5 /* CCPUSimpleSpline.h in Headers */, B6DD2FAD1B04825B00E47F5F /* DetourDebugDraw.h in Headers */, B665E42C1AA80A6600DDB1C5 /* CCPUVelocityMatchingAffector.h in Headers */, @@ -8985,6 +9046,7 @@ 1A570073180BC5A10088DEC7 /* CCActionGrid.h in Headers */, 15AE1BCC19AAE01E00C27E9E /* CCControlButton.h in Headers */, B6CAB3D71AF9AA1A00B9B856 /* btSolve2LinearConstraint.h in Headers */, + C50306771B60B5B2001E6D43 /* CSBoneBinary_generated.h in Headers */, B6CAB3E51AF9AA1A00B9B856 /* btActionInterface.h in Headers */, 5034CA3B191D591100CE6051 /* ccShader_PositionColor.vert in Headers */, B665E3101AA80A6500DDB1C5 /* CCPUObserver.h in Headers */, @@ -9214,6 +9276,7 @@ 1A5701F0180BCB8C0088DEC7 /* CCTransitionProgress.h in Headers */, 1A5701F9180BCBAD0088DEC7 /* CCMenu.h in Headers */, B6CAB4A11AF9AA1A00B9B856 /* PosixThreadSupport.h in Headers */, + C50306791B60B5B2001E6D43 /* SkeletonNodeReader.h in Headers */, B665E3001AA80A6500DDB1C5 /* CCPUMaterialTranslator.h in Headers */, B665E33C1AA80A6500DDB1C5 /* CCPUOnEventFlagObserver.h in Headers */, 50ABBD401925AB0000A911A9 /* CCMath.h in Headers */, @@ -9359,6 +9422,7 @@ 1A57028C180BCC900088DEC7 /* CCSpriteFrameCache.h in Headers */, B6CAB21D1AF9AA1A00B9B856 /* btBoxBoxCollisionAlgorithm.h in Headers */, B6CAAFEC1AF9A9E100B9B856 /* CCPhysics3DConstraint.h in Headers */, + C503066E1B60B583001E6D43 /* CCSkinNode.h in Headers */, 5027253A190BF1B900AAF4ED /* cocos2d.h in Headers */, B665E3041AA80A6500DDB1C5 /* CCPUMeshSurfaceEmitter.h in Headers */, 15AE1B5A19AADA9900C27E9E /* UIText.h in Headers */, @@ -9436,6 +9500,7 @@ 50ABBED51925AB6F00A911A9 /* utlist.h in Headers */, 1A5702F4180BCE750088DEC7 /* CCTMXObjectGroup.h in Headers */, B6CAB1EF1AF9AA1A00B9B856 /* btBroadphaseProxy.h in Headers */, + 43015DC11B60DF4000E75161 /* CCComExtensionData.h in Headers */, B6CAB3871AF9AA1A00B9B856 /* btPersistentManifold.h in Headers */, 50ABBDAF1925AB4100A911A9 /* CCRenderer.h in Headers */, B665E30C1AA80A6500DDB1C5 /* CCPUNoise.h in Headers */, @@ -9531,7 +9596,6 @@ B6CAB4351AF9AA1A00B9B856 /* btGpu3DGridBroadphase.h in Headers */, 50ABBE331925AB6F00A911A9 /* CCConfiguration.h in Headers */, B665E2101AA80A6500DDB1C5 /* CCPUBaseForceAffector.h in Headers */, - 382F7ADE1AB1292A002EBECF /* CCObjectExtensionData.h in Headers */, B6CAB4D51AF9AA1A00B9B856 /* SpuGatheringCollisionTask.h in Headers */, 15AE199519AAD39600C27E9E /* LayoutReader.h in Headers */, 15AE183219AAD2F700C27E9E /* CCOBB.h in Headers */, @@ -9559,6 +9623,7 @@ B6CAB2E31AF9AA1A00B9B856 /* btShapeHull.h in Headers */, B29A7E0D19EE1B7700872B35 /* Bone.h in Headers */, 15AE186719AAD31D00C27E9E /* CDXMacOSXSupport.h in Headers */, + C503066A1B60B583001E6D43 /* CCBoneNode.h in Headers */, B6CAB5131AF9AA1A00B9B856 /* btMatrixX.h in Headers */, B6CAB4091AF9AA1A00B9B856 /* btMultiBodyJointLimitConstraint.h in Headers */, B6CAB4B91AF9AA1A00B9B856 /* SpuFakeDma.h in Headers */, @@ -9667,6 +9732,7 @@ B24AA987195A675C007B4522 /* CCFastTMXLayer.h in Headers */, 15AE188F19AAD33D00C27E9E /* CCLabelTTFLoader.h in Headers */, 50ABBEBD1925AB6F00A911A9 /* ccUtils.h in Headers */, + C50306761B60B5B2001E6D43 /* BoneNodeReader.h in Headers */, B6CAB4171AF9AA1A00B9B856 /* btMultiBodySolverConstraint.h in Headers */, 15AE19A119AAD39600C27E9E /* TextAtlasReader.h in Headers */, 50ABC0231926664800A911A9 /* CCGLViewImpl-desktop.h in Headers */, @@ -10050,6 +10116,7 @@ B665E3111AA80A6500DDB1C5 /* CCPUObserver.h in Headers */, 15AE18B819AAD33D00C27E9E /* CCBSequenceProperty.h in Headers */, B665E2311AA80A6500DDB1C5 /* CCPUBoxColliderTranslator.h in Headers */, + 85505F0B1B60E3D1003F2CD4 /* BoneNodeReader.h in Headers */, B6CAB4DE1AF9AA1A00B9B856 /* SpuPreferredPenetrationDirections.h in Headers */, 503DD8E41926736A00CD74DD /* CCDirectorCaller-ios.h in Headers */, 15AE198119AAD35700C27E9E /* CCTimelineMacro.h in Headers */, @@ -10059,6 +10126,7 @@ B6CAB4D61AF9AA1A00B9B856 /* SpuGatheringCollisionTask.h in Headers */, 15AE1B7719AADA9A00C27E9E /* UIPageView.h in Headers */, 50ABBD8A1925AB4100A911A9 /* CCCustomCommand.h in Headers */, + 85505F0C1B60E3D5003F2CD4 /* CSBoneBinary_generated.h in Headers */, 299754F7193EC95400A54AC3 /* ObjectFactory.h in Headers */, 15FB20921AE7C57D00C31518 /* advancing_front.h in Headers */, 50ABBE881925AB6F00A911A9 /* ccMacros.h in Headers */, @@ -10097,6 +10165,7 @@ 15AE1A4F19AAD3D500C27E9E /* b2Shape.h in Headers */, 29394CF519B01DBA00D2DE1A /* UIWebViewImpl-ios.h in Headers */, 50ABBD5B1925AB0000A911A9 /* Vec2.h in Headers */, + 43015DC21B60DF4000E75161 /* CCComExtensionData.h in Headers */, D0FD035E1A3B51AA00825BB5 /* CCAllocatorStrategyGlobalSmallBlock.h in Headers */, 50ABBD411925AB0000A911A9 /* CCMath.h in Headers */, 1A5701A0180BCB590088DEC7 /* CCFont.h in Headers */, @@ -10234,6 +10303,7 @@ B665E3A11AA80A6500DDB1C5 /* CCPUPositionEmitter.h in Headers */, 15AE194E19AAD35100C27E9E /* CCDataReaderHelper.h in Headers */, B665E2691AA80A6500DDB1C5 /* CCPUDoExpireEventHandlerTranslator.h in Headers */, + 85505F091B60E3C1003F2CD4 /* CCSkinNode.h in Headers */, 15AE1ADB19AAD41000C27E9E /* b2Rope.h in Headers */, D0FD03561A3B51AA00825BB5 /* CCAllocatorMacros.h in Headers */, B665E42D1AA80A6600DDB1C5 /* CCPUVelocityMatchingAffector.h in Headers */, @@ -10408,6 +10478,7 @@ 15AE1BAE19AADFDF00C27E9E /* UILayoutParameter.h in Headers */, 15AE18C819AAD33D00C27E9E /* CCMenuItemImageLoader.h in Headers */, B6CAB3AC1AF9AA1A00B9B856 /* btContactConstraint.h in Headers */, + 85505F051B60E3B2003F2CD4 /* CCBoneNode.h in Headers */, B665E2491AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffectorTranslator.h in Headers */, B6CAB4461AF9AA1A00B9B856 /* btParallelConstraintSolver.h in Headers */, 15AE18D119AAD33D00C27E9E /* CCNodeLoaderLibrary.h in Headers */, @@ -10452,6 +10523,7 @@ 1A57030F180BCF190088DEC7 /* CCComponent.h in Headers */, B665E22D1AA80A6500DDB1C5 /* CCPUBoxCollider.h in Headers */, B6CAB22E1AF9AA1A00B9B856 /* btCollisionObject.h in Headers */, + 85505F071B60E3BA003F2CD4 /* CCSkeletonNode.h in Headers */, 15AE1AD519AAD40300C27E9E /* b2WeldJoint.h in Headers */, 15AE18B019AAD33D00C27E9E /* CCBKeyframe.h in Headers */, 15AE18C419AAD33D00C27E9E /* CCLayerGradientLoader.h in Headers */, @@ -10469,7 +10541,6 @@ B6CAB3661AF9AA1A00B9B856 /* btContinuousConvexCollision.h in Headers */, B5668D801B3838E4003CBD5E /* UIScrollViewBar.h in Headers */, 15AE194319AAD35100C27E9E /* CCColliderDetector.h in Headers */, - 382F7ADF1AB1292A002EBECF /* CCObjectExtensionData.h in Headers */, B6CAB3A81AF9AA1A00B9B856 /* btConstraintSolver.h in Headers */, D0FD035C1A3B51AA00825BB5 /* CCAllocatorStrategyFixedBlock.h in Headers */, 15AE1BC419AADFFB00C27E9E /* ExtensionMacros.h in Headers */, @@ -10724,6 +10795,7 @@ 15AE193319AAD35100C27E9E /* CCActionNode.h in Headers */, B6CAB1F01AF9AA1A00B9B856 /* btBroadphaseProxy.h in Headers */, B6CAAFF51AF9A9E100B9B856 /* CCPhysics3DObject.h in Headers */, + 85505F0E1B60E3DB003F2CD4 /* SkeletonNodeReader.h in Headers */, B6CAB35E1AF9AA1A00B9B856 /* gim_radixsort.h in Headers */, 50ABBED21925AB6F00A911A9 /* TGAlib.h in Headers */, B665E2951AA80A6500DDB1C5 /* CCPUEmitter.h in Headers */, @@ -10920,6 +10992,7 @@ 46A170E61807CECA005B8026 /* CCPhysicsBody.cpp in Sources */, B665E40A1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */, B677B0D91B18492D006762CB /* CCNavMeshUtils.cpp in Sources */, + C503066D1B60B583001E6D43 /* CCSkinNode.cpp in Sources */, 50ABBDA71925AB4100A911A9 /* CCRenderCommand.cpp in Sources */, B665E35E1AA80A6500DDB1C5 /* CCPUOnRandomObserverTranslator.cpp in Sources */, B6CAB2931AF9AA1A00B9B856 /* btCompoundShape.cpp in Sources */, @@ -11121,6 +11194,7 @@ 1A5701A5180BCB590088DEC7 /* CCFontAtlasCache.cpp in Sources */, 15AE1A7A19AAD40300C27E9E /* b2PolygonContact.cpp in Sources */, 3823842F1A259112002C4610 /* ParticleReader.cpp in Sources */, + C503066B1B60B583001E6D43 /* CCSkeletonNode.cpp in Sources */, 15AE191119AAD35000C27E9E /* CCProcessBase.cpp in Sources */, B6CAB2B31AF9AA1A00B9B856 /* btConvexShape.cpp in Sources */, 15AE18EE19AAD35000C27E9E /* CCArmature.cpp in Sources */, @@ -11142,6 +11216,7 @@ B6CAB4C51AF9AA1A00B9B856 /* boxBoxDistance.cpp in Sources */, B6CAB29F1AF9AA1A00B9B856 /* btConvex2dShape.cpp in Sources */, B6CAB4331AF9AA1A00B9B856 /* btGpu3DGridBroadphase.cpp in Sources */, + C50306691B60B583001E6D43 /* CCBoneNode.cpp in Sources */, 85B3743A1B204B9400C488D6 /* clipper.cpp in Sources */, 15AE1A8819AAD40300C27E9E /* b2PrismaticJoint.cpp in Sources */, 182C5CB21A95964700C30D34 /* Node3DReader.cpp in Sources */, @@ -11158,7 +11233,6 @@ B6CAB40B1AF9AA1A00B9B856 /* btMultiBodyJointMotor.cpp in Sources */, B6CAB3D51AF9AA1A00B9B856 /* btSolve2LinearConstraint.cpp in Sources */, B6CAB2591AF9AA1A00B9B856 /* btHashedSimplePairCache.cpp in Sources */, - 382F7ADC1AB1292A002EBECF /* CCObjectExtensionData.cpp in Sources */, B6DD2FAB1B04825B00E47F5F /* DetourDebugDraw.cpp in Sources */, 15AE191719AAD35000C27E9E /* CCSpriteFrameCacheHelper.cpp in Sources */, B665E2E21AA80A6500DDB1C5 /* CCPULineAffectorTranslator.cpp in Sources */, @@ -11213,6 +11287,7 @@ B665E2CE1AA80A6500DDB1C5 /* CCPUInterParticleCollider.cpp in Sources */, 50ABBDAD1925AB4100A911A9 /* CCRenderer.cpp in Sources */, 15AE199019AAD37200C27E9E /* ImageViewReader.cpp in Sources */, + C50306781B60B5B2001E6D43 /* SkeletonNodeReader.cpp in Sources */, B6CAB3DD1AF9AA1A00B9B856 /* btTypedConstraint.cpp in Sources */, B665E28A1AA80A6500DDB1C5 /* CCPUDynamicAttribute.cpp in Sources */, B665E2A21AA80A6500DDB1C5 /* CCPUEventHandlerManager.cpp in Sources */, @@ -11228,6 +11303,7 @@ 1A1645B2191B726C008C7C7F /* ConvertUTFWrapper.cpp in Sources */, B665E3B21AA80A6500DDB1C5 /* CCPURendererTranslator.cpp in Sources */, 15AE1BC919AAE01E00C27E9E /* CCControl.cpp in Sources */, + C50306751B60B5B2001E6D43 /* BoneNodeReader.cpp in Sources */, B6CAB3BF1AF9AA1A00B9B856 /* btHinge2Constraint.cpp in Sources */, B29A7DD119EE1B7700872B35 /* Skin.c in Sources */, B6CAB1F51AF9AA1A00B9B856 /* btDbvt.cpp in Sources */, @@ -11637,6 +11713,7 @@ 50ABC05F1926664800A911A9 /* CCApplication-mac.mm in Sources */, B29A7E2119EE1B7700872B35 /* PolygonBatch.cpp in Sources */, 15AE1A9219AAD40300C27E9E /* b2WheelJoint.cpp in Sources */, + 43015DBF1B60DF4000E75161 /* CCComExtensionData.cpp in Sources */, B665E3261AA80A6500DDB1C5 /* CCPUOnCollisionObserverTranslator.cpp in Sources */, B6CAB3ED1AF9AA1A00B9B856 /* btRigidBody.cpp in Sources */, B6CAAFFE1AF9A9E100B9B856 /* CCPhysicsSprite3D.cpp in Sources */, @@ -11728,7 +11805,6 @@ 1A01C68F18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */, B276EF621988D1D500CD400F /* CCVertexIndexData.cpp in Sources */, 50ABBE561925AB6F00A911A9 /* CCEventFocus.cpp in Sources */, - 382F7ADD1AB1292A002EBECF /* CCObjectExtensionData.cpp in Sources */, 15AE183D19AAD2F700C27E9E /* CCSkeleton3D.cpp in Sources */, B6DD2FF21B04825B00E47F5F /* DetourTileCacheBuilder.cpp in Sources */, 503DD8E11926736A00CD74DD /* CCApplication-ios.mm in Sources */, @@ -11911,6 +11987,7 @@ B665E32F1AA80A6500DDB1C5 /* CCPUOnCountObserverTranslator.cpp in Sources */, 15AE192419AAD35100C27E9E /* CocoLoader.cpp in Sources */, B665E3BB1AA80A6500DDB1C5 /* CCPURibbonTrailRender.cpp in Sources */, + 85505F041B60E3AB003F2CD4 /* CCBoneNode.cpp in Sources */, 50ABBE421925AB6F00A911A9 /* CCDirector.cpp in Sources */, 15AE1C0319AAE01E00C27E9E /* CCTableView.cpp in Sources */, B6CAB5361AF9AA1A00B9B856 /* btVector3.cpp in Sources */, @@ -11977,6 +12054,7 @@ 15AE1A9419AAD40300C27E9E /* b2BlockAllocator.cpp in Sources */, B29A7E3C19EE1B7700872B35 /* Animation.c in Sources */, 15AE1A4D19AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */, + 43015DC01B60DF4000E75161 /* CCComExtensionData.cpp in Sources */, B6CAB3D61AF9AA1A00B9B856 /* btSolve2LinearConstraint.cpp in Sources */, B6CAB30C1AF9AA1A00B9B856 /* btTriangleMeshShape.cpp in Sources */, 1A5701A2180BCB590088DEC7 /* CCFontAtlas.cpp in Sources */, @@ -12060,6 +12138,7 @@ 15FB20941AE7C57D00C31518 /* cdt.cc in Sources */, B665E34B1AA80A6500DDB1C5 /* CCPUOnPositionObserver.cpp in Sources */, B6CAB42A1AF9AA1A00B9B856 /* btRaycastVehicle.cpp in Sources */, + 85505F081B60E3BD003F2CD4 /* CCSkinNode.cpp in Sources */, 15AE1AD619AAD40300C27E9E /* b2WheelJoint.cpp in Sources */, 299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */, 1A5701DF180BCB8C0088DEC7 /* CCLayer.cpp in Sources */, @@ -12240,6 +12319,7 @@ B6CAB40C1AF9AA1A00B9B856 /* btMultiBodyJointMotor.cpp in Sources */, B6CAB2D21AF9AA1A00B9B856 /* btMultiSphereShape.cpp in Sources */, B29A7DFC19EE1B7700872B35 /* spine-cocos2dx.cpp in Sources */, + 85505F0D1B60E3D8003F2CD4 /* SkeletonNodeReader.cpp in Sources */, D0FD03501A3B51AA00825BB5 /* CCAllocatorGlobal.cpp in Sources */, B665E2231AA80A6500DDB1C5 /* CCPUBehaviourTranslator.cpp in Sources */, B665E3D71AA80A6600DDB1C5 /* CCPUScriptParser.cpp in Sources */, @@ -12294,6 +12374,7 @@ 50ABBD881925AB4100A911A9 /* CCCustomCommand.cpp in Sources */, B6CAB4301AF9AA1A00B9B856 /* btWheelInfo.cpp in Sources */, 15AE19B019AAD39700C27E9E /* ScrollViewReader.cpp in Sources */, + 85505F061B60E3B6003F2CD4 /* CCSkeletonNode.cpp in Sources */, 50ABBE941925AB6F00A911A9 /* CCProfiling.cpp in Sources */, 5012169B1AC473A3009A4BEA /* CCTechnique.cpp in Sources */, 15AE182D19AAD2F700C27E9E /* CCMeshVertexIndexData.cpp in Sources */, @@ -12364,6 +12445,7 @@ 15AE1B7419AADA9A00C27E9E /* UILoadingBar.cpp in Sources */, 50ABBEA41925AB6F00A911A9 /* CCScriptSupport.cpp in Sources */, B6CAB3E81AF9AA1A00B9B856 /* btDiscreteDynamicsWorld.cpp in Sources */, + 85505F0A1B60E3CE003F2CD4 /* BoneNodeReader.cpp in Sources */, 501216A11AC473AD009A4BEA /* CCMaterial.cpp in Sources */, B665E3971AA80A6500DDB1C5 /* CCPUPointEmitter.cpp in Sources */, B6CAB1E81AF9AA1A00B9B856 /* btAxisSweep3.cpp in Sources */, diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 0d2d075f84f5..6a9dc68a0fde 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1771,6 +1771,28 @@ AffineTransform Node::getNodeToParentAffineTransform() const return ret; } + +Mat4 Node::getNodeToParentTransform(Node* ancestor) const +{ + Mat4 t(this->getNodeToParentTransform()); + + for (Node *p = _parent; p != nullptr && p != ancestor ; p = p->getParent()) + { + t = p->getNodeToParentTransform() * t; + } + + return t; +} + +AffineTransform Node::getNodeToParentAffineTransform(Node* ancestor) const +{ + AffineTransform t(this->getNodeToParentAffineTransform()); + + for (Node *p = _parent; p != nullptr && p != ancestor; p = p->getParent()) + t = AffineTransformConcat(t, p->getNodeToParentAffineTransform()); + + return t; +} const Mat4& Node::getNodeToParentTransform() const { if (_transformDirty) @@ -1926,24 +1948,12 @@ const Mat4& Node::getParentToNodeTransform() const AffineTransform Node::getNodeToWorldAffineTransform() const { - AffineTransform t(this->getNodeToParentAffineTransform()); - - for (Node *p = _parent; p != nullptr; p = p->getParent()) - t = AffineTransformConcat(t, p->getNodeToParentAffineTransform()); - - return t; + return this->getNodeToParentAffineTransform(nullptr); } Mat4 Node::getNodeToWorldTransform() const { - Mat4 t(this->getNodeToParentTransform()); - - for (Node *p = _parent; p != nullptr; p = p->getParent()) - { - t = p->getNodeToParentTransform() * t; - } - - return t; + return this->getNodeToParentTransform(nullptr); } AffineTransform Node::getWorldToNodeAffineTransform() const diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 0b814126c378..2240eed040de 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -1496,6 +1496,29 @@ class CC_DLL Node : public Ref virtual const Mat4& getNodeToParentTransform() const; virtual AffineTransform getNodeToParentAffineTransform() const; + /** + * Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates. + * The matrix is in Pixels. + * Note: If acenstor is not a valid ancestor of the node, the API would return the same value as @see getNodeToWorldTransform + * + * @param ancestor The parent's node pointer. + * @since v3.7 + * @return The transformation matrix. + */ + virtual Mat4 getNodeToParentTransform(Node* ancestor) const; + + /** + * Returns the affline transform matrix that transform the node's (local) space coordinates into the parent's space coordinates. + * The matrix is in Pixels. + * + * Note: If acenstor is not a valid ancestor of the node, the API would return the same value as @see getNodeToWorldAffineTransform + * + * @param ancestor The parent's node pointer. + * @since v3.7 + * @return The affline transformation matrix. + */ + virtual AffineTransform getNodeToParentAffineTransform(Node* ancestor) const; + /** * Sets the transformation matrix manually. * diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index aa6b13d7edf0..5589c155f8dd 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -485,7 +485,10 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + + + @@ -510,7 +513,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* - + @@ -532,6 +535,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + @@ -544,6 +548,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + + @@ -1072,7 +1078,10 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + + + @@ -1099,7 +1108,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* - + @@ -1125,6 +1134,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + @@ -1137,6 +1147,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + + + diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index c1cc7491eccf..c72735b6d9e2 100644 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -277,6 +277,12 @@ {0f3fa25d-9e2b-4a2e-a1df-834b796b3fb3} + + {8405cf93-e86c-4ec1-8b16-01058f542b09} + + + {ca5e1475-3bfd-4aae-ad54-2e19d5021b92} + @@ -1815,9 +1821,6 @@ extension\Particle3D - - cocostudio\json - cocostudio\json @@ -1906,6 +1909,25 @@ external\clipper + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\components + @@ -3621,9 +3643,6 @@ extension\Particle3D - - cocostudio\json - external\poly2tri @@ -3715,6 +3734,28 @@ external\clipper + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\components + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems index 46d1d1538325..f3cbbd775226 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems @@ -353,7 +353,10 @@ + + + @@ -373,6 +376,7 @@ + @@ -380,7 +384,6 @@ - @@ -419,6 +422,9 @@ + + + @@ -957,7 +963,10 @@ + + + @@ -975,6 +984,7 @@ + @@ -982,7 +992,6 @@ - @@ -1016,6 +1025,8 @@ + + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters index be5ec0663c20..c3dad28cc662 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters @@ -1728,9 +1728,6 @@ - - cocostudio\json - 3d @@ -1840,6 +1837,27 @@ external\clipper + + cocostudio\TimelineAction + + + cocostudio\TimelineAction + + + cocostudio\TimelineAction + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\components + @@ -3401,9 +3419,6 @@ - - cocostudio\json - 3d @@ -3516,6 +3531,24 @@ external\clipper + + cocostudio\TimelineAction + + + cocostudio\TimelineAction + + + cocostudio\TimelineAction + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\components + @@ -3785,6 +3818,9 @@ {9a25af30-04d1-41a7-9e55-e34db6b712cd} + + {a40f3972-1316-4674-a6d6-c9fae0b83e88} + diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj index 2a8578da4eac..4d6505c2d091 100644 --- a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj @@ -462,7 +462,10 @@ + + + @@ -480,6 +483,7 @@ + @@ -487,7 +491,6 @@ - @@ -523,6 +526,8 @@ + + @@ -1057,7 +1062,10 @@ + + + @@ -1077,6 +1085,7 @@ + @@ -1084,7 +1093,6 @@ - @@ -1124,6 +1132,9 @@ + + + diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters index cb7dcb98d7db..49aa316aa4fd 100644 --- a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters @@ -254,6 +254,12 @@ {e3a5fe25-a92e-4c98-9026-782b2b5b1388} + + {a10cc84c-5c61-43f4-a665-5e5cbab47ee1} + + + {438e0063-bdbc-4252-a0f5-f55f7d54ed6f} + @@ -843,9 +849,6 @@ cocostudio\components - - cocostudio\json - cocostudio\json @@ -1912,6 +1915,24 @@ external\clipper + + cocostudio\components + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\TimelineAction\Skeleton + @@ -2588,9 +2609,6 @@ cocostudio\components - - cocostudio\json - cocostudio\json @@ -3740,6 +3758,27 @@ external\clipper + + cocostudio\components + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\reader\WidgetReader\SkeletonReader + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\TimelineAction\Skeleton + + + cocostudio\TimelineAction\Skeleton + diff --git a/cocos/base/ccConfig.h b/cocos/base/ccConfig.h index 7529c8a15276..9ce1f73c4411 100644 --- a/cocos/base/ccConfig.h +++ b/cocos/base/ccConfig.h @@ -57,9 +57,9 @@ THE SOFTWARE. * It is recommended to enable whenever possible to improve speed. * If you are migrating your code from GL ES 1.1, then keep it disabled. Once all your code works as expected, turn it on. - + * Default value: Enabled by default - + * @since v2.0.0 */ #ifndef CC_ENABLE_GL_STATE_CACHE @@ -81,9 +81,9 @@ THE SOFTWARE. * - LabelAtlas. * - QuadParticleSystem. * - TileMap. - + * To enabled set it to 1. Disabled by default. - + * @since v0.99.5 */ #ifndef CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL @@ -94,7 +94,7 @@ THE SOFTWARE. * Seconds between FPS updates. * 0.5 seconds, means that the FPS number will be updated every 0.5 seconds. * Having a bigger number means a more reliable FPS. - + * Default value: 0.1f */ #ifndef CC_DIRECTOR_STATS_INTERVAL @@ -115,9 +115,9 @@ THE SOFTWARE. * dispatch all the events, even if there are not events to dispatch. * If your game uses lot's of events (eg: touches) it might be a good idea to enable this feature. * Otherwise, it is safe to leave it disabled. - + * To enable set it to 1. Disabled by default. - + * @warning This feature is experimental. */ #ifndef CC_DIRECTOR_DISPATCH_FAST_EVENTS @@ -165,7 +165,7 @@ THE SOFTWARE. #else /* Some Windows display adapter driver cannot support VAO. * Some android devices cannot support VAO very well, so we disable it by default for android platform. - * Blackberry also doesn't support this feature. + * Blackberry also doesn't support this feature. */ #define CC_TEXTURE_ATLAS_USE_VAO 0 #endif diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp index 423ffb4acd78..ef24266dc809 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp @@ -24,7 +24,7 @@ THE SOFTWARE. #include "CCActionTimeline.h" -#include "cocostudio/CCObjectExtensionData.h" +#include "cocostudio/CCComExtensionData.h" USING_NS_CC; @@ -247,7 +247,7 @@ void ActionTimeline::startWithTarget(Node *target) foreachNodeDescendant(target, [this, target](Node* child) { - ObjectExtensionData* data = dynamic_cast(child->getUserObject()); + ComExtensionData* data = dynamic_cast(child->getComponent("ComExtensionData")); if(data) { diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp new file mode 100644 index 000000000000..fda656e82037 --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp @@ -0,0 +1,593 @@ +/**************************************************************************** +Copyright (c) 2015 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. +****************************************************************************/ + +#include "base/CCDirector.h" +#include "renderer/CCRenderer.h" +#include "renderer/ccGLStateCache.h" +#include "renderer/CCGLProgram.h" +#include "renderer/CCGLProgramState.h" + +#include "CCBoneNode.h" +#include "CCSkeletonNode.h" + +NS_TIMELINE_BEGIN + +BoneNode::BoneNode() +: _isRackShow(false) +, _rackColor(cocos2d::Color4F::WHITE) +, _rackLength(50) +, _rackWidth(20) +, _rootSkeleton(nullptr) +, _blendFunc(cocos2d::BlendFunc::ALPHA_NON_PREMULTIPLIED) +{ +} + + +BoneNode* BoneNode::create() +{ + BoneNode* ret = new (std::nothrow) BoneNode(); + if (ret && ret->init()) + { + ret->autorelease(); + return ret; + } + CC_SAFE_DELETE(ret); + return nullptr; +} + + +BoneNode* BoneNode::create(int length) +{ + BoneNode* ret = new (std::nothrow) BoneNode(); + if (ret && ret->init()) + { + ret->setDebugDrawLength(length); + ret->autorelease(); + } + else + { + CC_SAFE_DELETE(ret); + } + return ret; +} + +void BoneNode::addChild(cocos2d::Node* child, int localZOrder, int tag) +{ + Node::addChild(child, localZOrder, tag); + addToChildrenListHelper(child); +} + +void BoneNode::addChild(Node* child, int localZOrder, const std::string &name) +{ + Node::addChild(child, localZOrder, name); + addToChildrenListHelper(child); +} + +void BoneNode::addSkin(SkinNode* skin, bool isDisplay, bool hideOthers) +{ + CCASSERT(skin != nullptr, "Argument must be non-nil"); + if (hideOthers) + { + for (auto &bonskin : _boneSkins) + { + bonskin->setVisible(false); + } + } + Node::addChild(skin); + skin->setVisible(isDisplay); +} + +void BoneNode::addSkin(SkinNode* skin, bool display) +{ + addSkin(skin, display, false); +} + +void BoneNode::removeChild(Node* child, bool cleanup /* = true */) +{ + Node::removeChild(child, cleanup); + removeFromChildrenListHelper(child); +} + +void BoneNode::removeFromBoneList(BoneNode* bone) +{ + _childBones.eraseObject(bone); + auto skeletonNode = dynamic_cast(bone); + if (skeletonNode != nullptr) // nested skeleton + return; + + bone->_rootSkeleton = nullptr; + auto subBones = bone->getAllSubBones(); + subBones.pushBack(bone); + for (auto &subBone : subBones) + { + subBone->_rootSkeleton = nullptr; + _rootSkeleton->_subBonesMap.erase(subBone->getName()); + if (bone->_isRackShow && bone->_visible) + { + _rootSkeleton->_subDrawBonesDirty = true; + _rootSkeleton->_subDrawBonesOrderDirty = true; + } + } +} + +void BoneNode::addToBoneList(BoneNode* bone) +{ + _childBones.pushBack(bone); + if (bone->_rootSkeleton == nullptr && _rootSkeleton != nullptr) + { + auto subBones = bone->getAllSubBones(); + subBones.pushBack(bone); + for (auto &subBone : subBones) + { + subBone->_rootSkeleton = _rootSkeleton; + auto bonename = subBone->getName(); + if (_rootSkeleton->_subBonesMap.find(bonename) == _rootSkeleton->_subBonesMap.end()) + { + _rootSkeleton->_subBonesMap.insert(subBone->getName(), subBone); + if (bone->_isRackShow && bone->_visible) + { + _rootSkeleton->_subDrawBonesDirty = true; + _rootSkeleton->_subDrawBonesOrderDirty = true; + } + } + else + CCLOG("already has a bone named %s in skeleton %s", bonename.c_str(), _rootSkeleton->getName().c_str()); + } + + if (bone->_isRackShow && bone->_visible) + { + _rootSkeleton->_subDrawBonesDirty = true; + _rootSkeleton->_subDrawBonesOrderDirty = true; + } + } +} + +void BoneNode::addToSkinList(SkinNode* skin) +{ + _boneSkins.pushBack(skin); +} + +void BoneNode::removeFromSkinList(SkinNode* skin) +{ + _boneSkins.eraseObject(skin); +} + +void BoneNode::displaySkin(SkinNode* skin, bool hideOthers) +{ + for (auto boneskin : _boneSkins) + { + if (boneskin == skin) + { + boneskin->setVisible(true); + } + else if (hideOthers) + { + boneskin->setVisible(false); + } + } +} + +void BoneNode::displaySkin(const std::string &skinName, bool hideOthers) +{ + for (auto &skin : _boneSkins) + { + if (skinName == skin->getName()) + { + skin->setVisible(true); + } + else if (hideOthers) + { + skin->setVisible(false); + } + } +} + +cocos2d::Vector BoneNode::getVisibleSkins() const +{ + cocos2d::Vector displayingSkins; + for (const auto &boneskin : _boneSkins) + { + if (boneskin->isVisible()) + { + displayingSkins.pushBack(boneskin); + } + } + return displayingSkins; +} + +cocos2d::Rect BoneNode::getBoundingBox() const +{ + cocos2d::Rect boundingBox = getVisibleSkinsRect(); + return RectApplyAffineTransform(boundingBox, this->getNodeToParentAffineTransform()); +} + +cocos2d::Rect BoneNode::getVisibleSkinsRect() const +{ + float minx, miny, maxx, maxy = 0; + minx = miny = maxx = maxy; + bool first = true; + + cocos2d::Rect displayRect = cocos2d::Rect(0, 0, 0, 0); + if (_isRackShow && _rootSkeleton != nullptr && _rootSkeleton->_isRackShow) + { + maxx = _rackLength; + maxy = _rackWidth; + first = false; + } + + for (const auto& skin : _boneSkins) + { + cocos2d::Rect r = skin->getBoundingBox(); + if (!skin->isVisible() || r.equals(cocos2d::Rect::ZERO)) + continue; + + if (first) + { + minx = r.getMinX(); + miny = r.getMinY(); + maxx = r.getMaxX(); + maxy = r.getMaxY(); + + first = false; + } + else + { + minx = MIN(r.getMinX(), minx); + miny = MIN(r.getMinY(), miny); + maxx = MAX(r.getMaxX(), maxx); + maxy = MAX(r.getMaxY(), maxy); + } + displayRect.setRect(minx, miny, maxx - minx, maxy - miny); + } + return displayRect; +} + +void BoneNode::setBlendFunc(const cocos2d::BlendFunc& blendFunc) +{ + _blendFunc = blendFunc; +} + +void BoneNode::setDebugDrawLength(float length) +{ + _rackLength = length; + updateVertices(); +} + +void BoneNode::setDebugDrawWidth(float width) +{ + _rackWidth = width; + updateVertices(); +} + +void BoneNode::setDebugDrawEnabled(bool isDebugDraw) +{ + if (_isRackShow == isDebugDraw) + return; + _isRackShow = isDebugDraw; + if (_visible && nullptr != _rootSkeleton) + { + _rootSkeleton->_subDrawBonesDirty = true; + _rootSkeleton->_subDrawBonesOrderDirty = true; + } +} + +void BoneNode::setDebugDrawColor(const cocos2d::Color4F &color) +{ + _rackColor = color; + updateColor(); +} + + +void BoneNode::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags) +{ + if (!_isRackShow || nullptr != _rootSkeleton) + return; + + _customCommand.init(_globalZOrder, transform, flags); + _customCommand.func = CC_CALLBACK_0(BoneNode::onDraw, this, transform, flags); + renderer->addCommand(&_customCommand); + + for (int i = 0; i < 4; ++i) + { + cocos2d::Vec4 pos; + pos.x = _squareVertices[i].x; pos.y = _squareVertices[i].y; pos.z = _positionZ; + pos.w = 1; + _modelViewTransform.transformVector(&pos); + _noMVPVertices[i] = cocos2d::Vec3(pos.x, pos.y, pos.z) / pos.w; + } +} + +BoneNode::~BoneNode() +{ +} + +bool BoneNode::init() +{ + _rackLength = 50; + _rackWidth = 20; + updateVertices(); + updateColor(); + setGLProgramState(cocos2d::GLProgramState::getOrCreateWithGLProgramName(cocos2d::GLProgram::SHADER_NAME_POSITION_COLOR_NO_MVP)); + return true; +} + +void BoneNode::updateVertices() +{ + if (_rackLength != _squareVertices[2].x - _anchorPointInPoints.x || _squareVertices[3].y != _rackWidth / 2 - _anchorPointInPoints.y) + { + _squareVertices[1].x = _squareVertices[1].y = _squareVertices[3].y = .0f; + _squareVertices[0].x = _squareVertices[2].x = _rackLength * .1f; + _squareVertices[2].y = _rackWidth * .5f; + _squareVertices[0].y = -_squareVertices[2].y; + _squareVertices[3].x = _rackLength; + + for (int i = 0; i < 4; i++) + { + _squareVertices[i] += _anchorPointInPoints; + } + _transformUpdated = _transformDirty = _inverseDirty = _contentSizeDirty = true; + } +} + +void BoneNode::updateColor() +{ + for (unsigned int i = 0; i < 4; i++) + { + _squareColors[i] = _rackColor; + } + _transformUpdated = _transformDirty = _inverseDirty = _contentSizeDirty = true; +} + +void BoneNode::onDraw(const cocos2d::Mat4 &transform, uint32_t flags) +{ + getGLProgram()->use(); + getGLProgram()->setUniformsForBuiltins(transform); + + cocos2d::GL::enableVertexAttribs(cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION | cocos2d::GL::VERTEX_ATTRIB_FLAG_COLOR); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, _noMVPVertices); + glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, _squareColors); + + cocos2d::GL::blendFunc(_blendFunc.src, _blendFunc.dst); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + +#ifdef CC_STUDIO_ENABLED_VIEW + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, _noMVPVertices); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, _squareColors); + + glEnable(GL_LINE_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); + glDrawArrays(GL_LINE_LOOP, 0, 4); + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8); +#else + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4); +#endif //CC_STUDIO_ENABLED_VIEW + +} + +cocos2d::Vector BoneNode::getAllSubBones() const +{ + cocos2d::Vector allBones; + std::stack boneStack; // for avoid recursive + for (const auto& bone : _childBones) + { + boneStack.push(bone); + } + + while (boneStack.size() > 0) + { + auto top = boneStack.top(); + allBones.pushBack(top); + boneStack.pop(); + auto topchildren = top->getChildBones(); + for (const auto& childbone : topchildren) + { + boneStack.push(childbone); + } + } + return allBones; +} + +cocos2d::Vector BoneNode::getAllSubSkins() const +{ + auto allbones = getAllSubBones(); + cocos2d::Vector allskins; + for (const auto& bone : allbones) + { + for (const auto& skin : bone->getSkins()) + { + allskins.pushBack(skin); + } + } + return allskins; +} + + +void BoneNode::sortAllChildren() +{ + if (_reorderChildDirty) + { + std::sort(_childBones.begin(), _childBones.end(), cocos2d::nodeComparisonLess); + std::sort(_boneSkins.begin(), _boneSkins.end(), cocos2d::nodeComparisonLess); + Node::sortAllChildren(); + } +} + +SkeletonNode* BoneNode::getRootSkeletonNode() const +{ + return _rootSkeleton; +} + +#ifdef CC_STUDIO_ENABLED_VIEW +bool BoneNode::isPointOnRack(const cocos2d::Vec2& bonePoint) +{ + + if (bonePoint.x >= 0.0f && bonePoint.y >= _squareVertices[0].y + && bonePoint.x <= _rackLength && + bonePoint.y <= _squareVertices[2].y) + { + if (_rackLength != 0.0f && _rackWidth != 0.0f) + { + float a1 = (_squareVertices[2].y - _squareVertices[3].y ) / (_squareVertices[3].x - _squareVertices[0].x); + float a2 = (_squareVertices[2].y - _squareVertices[3].y) / (_squareVertices[0].x - _squareVertices[1].x);; + float b1 = a1 * _squareVertices[3].x; + float y1 = bonePoint.y - _squareVertices[1].y; + if (y1 >= a1 * bonePoint.x - b1 && + y1 <= a2 * bonePoint.x && + y1 >= -a2 * bonePoint.x && + y1 <= -a1 * bonePoint.x + b1) + return true; + } + } + return false; +} +#endif //CC_STUDIO_ENABLED_VIEW + +void BoneNode::batchBoneDrawToSkeleton(BoneNode* bone) const +{ + cocos2d::Vec3 vpos[4]; + for (int i = 0; i < 4; i++) + { + cocos2d::Vec4 pos; + pos.x = bone->_squareVertices[i].x; pos.y = bone->_squareVertices[i].y; pos.z = bone->_positionZ; + pos.w = 1; + bone->_modelViewTransform.transformVector(&pos); // call after visit + vpos[i] = cocos2d::Vec3(pos.x, pos.y, pos.z) / pos.w; + } + + int count = bone->_rootSkeleton->_batchedVeticesCount; + if (count + 8 >(int)(bone->_rootSkeleton->_batchedBoneVetices.capacity())) + { + bone->_rootSkeleton->_batchedBoneVetices.resize(count + 100); + bone->_rootSkeleton->_batchedBoneColors.resize(count + 100); + } + for (int i = 0; i < 4; i++) + { + bone->_rootSkeleton->_batchedBoneVetices[count + i] = vpos[i]; + bone->_rootSkeleton->_batchedBoneColors[count + i] = bone->_squareColors[i]; + } + bone->_rootSkeleton->_batchedVeticesCount += 4; + count += 4; +#ifdef CC_STUDIO_ENABLED_VIEW + for (int i = 0; i < 4; i++) + { + bone->_rootSkeleton->_batchedBoneVetices[count + i] = vpos[i]; + bone->_rootSkeleton->_batchedBoneColors[count + i] = bone->_squareColors[i]; + } + bone->_rootSkeleton->_batchedVeticesCount += 4; +#endif //CC_STUDIO_ENABLED_VIEW +} + +void BoneNode::setLocalZOrder(int localZOrder) +{ + Node::setLocalZOrder(localZOrder); + if (_rootSkeleton != nullptr && this->_visible && this->_isRackShow) + _rootSkeleton->_subDrawBonesOrderDirty = true; +} + +void BoneNode::setName(const std::string& name) +{ + auto oldname = getName(); + Node::setName(name); + if (_rootSkeleton != nullptr) + { + auto oiter = _rootSkeleton->_subBonesMap.find(oldname); + auto niter = _rootSkeleton->_subBonesMap.find(name); + if (oiter != _rootSkeleton->_subBonesMap.end() && + niter == _rootSkeleton->_subBonesMap.end()) + { + auto node = oiter->second; + _rootSkeleton->_subBonesMap.erase(oiter); + _rootSkeleton->_subBonesMap.insert(name, node); + } + } +} + +void BoneNode::addToChildrenListHelper(Node * child) +{ + BoneNode* bone = dynamic_cast(child); + if (nullptr != bone) + { + addToBoneList(bone); + } + else + { + SkinNode* skin = dynamic_cast(child); + if (nullptr != skin) + { + addToSkinList(skin); + } + } +} + +void BoneNode::removeFromChildrenListHelper(Node * child) +{ + BoneNode* bone = dynamic_cast(child); + if (nullptr != bone) + { + removeFromBoneList(bone); + if (bone->_isRackShow) + { + _rootSkeleton->_subDrawBonesDirty = true; + _rootSkeleton->_subDrawBonesOrderDirty = true; + } + } + else + { + SkinNode* skin = dynamic_cast(child); + if (nullptr != skin) + { + removeFromSkinList(skin); + } + } +} + +void BoneNode::setVisible(bool visible) +{ + if (_visible == visible) + return; + + Node::setVisible(visible); + if (_isRackShow && _rootSkeleton != nullptr) + { + _rootSkeleton->_subDrawBonesDirty = true; + _rootSkeleton->_subDrawBonesOrderDirty = true; + } +} + +void BoneNode::setContentSize(const cocos2d::Size& contentSize) +{ + Node::setContentSize(contentSize); + updateVertices(); +} + +void BoneNode::setAnchorPoint(const cocos2d::Vec2& anchorPoint) +{ + Node::setAnchorPoint(anchorPoint); + updateVertices(); +} + +NS_TIMELINE_END \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.h b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.h new file mode 100644 index 000000000000..b72984ccbfaa --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.h @@ -0,0 +1,213 @@ +/**************************************************************************** +Copyright (c) 2015 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 __CCBONENODE_H__ +#define __CCBONENODE_H__ + +#include "base/CCProtocols.h" +#include "2d/CCNode.h" +#include "renderer/CCCustomCommand.h" +#include "CCTimelineMacro.h" +#include "cocostudio/CocosStudioExport.h" +#include "CCSkinNode.h" + + +NS_TIMELINE_BEGIN + +class SkeletonNode; + +class CC_STUDIO_DLL BoneNode : public cocos2d::Node, public cocos2d::BlendProtocol +{ +public: + static BoneNode* create(); + static BoneNode* create(int length); + + using Node::addChild; + // add child, and add child to bone list and skeleton's sub bone map or add it to skin list + virtual void addChild(cocos2d::Node* child, int localZOrder, const std::string &name) override; + virtual void addChild(cocos2d::Node* child, int localZOrder, int tag) override; + + // remove child, and remove child from bone list and skeleton's sub bone map or rmeove it from skin list + virtual void removeChild(Node* child, bool cleanup) override; + + // get child bone list + virtual const cocos2d::Vector& getChildBones() const { return _childBones; } + virtual cocos2d::Vector& getChildBones() { return _childBones; } + + + // get this bone's root skeleton, return null while bone is not in a skeleton + virtual SkeletonNode* getRootSkeletonNode() const; + + /** + * @brief: get all bones in this bone tree + */ + cocos2d::Vector getAllSubBones() const; + + /** + *@brief: add a skin + *@param: display, whether display this skin + */ + virtual void addSkin(SkinNode* skin, bool display); + + /** + *@brief: add a skin + *@param: display, whether display this skin + *@param: hideOthers, whether hide other skins added to this bone + */ + virtual void addSkin(SkinNode* skin, bool display, bool hideOthers); + + /** + * @brief: display skin + * @param: hideOthers, set other skins invisible + */ + virtual void displaySkin(SkinNode* skin, bool hideOthers); + + /** + * @brief: display all skins named skinName, if hide display only one skin, + * prefer to use display(SkinNode* skin, bool hideOthers = false) + * @param: hideOthers, set other skins invisible + */ + virtual void displaySkin(const std::string &skinName, bool hideOthers ); + + // get the skins which is visible (displaying skins) + virtual cocos2d::Vector getVisibleSkins() const; + + /** + * get skins in this bone's children + */ + virtual const cocos2d::Vector& getSkins() const { return _boneSkins; } + virtual cocos2d::Vector& getSkins() { return _boneSkins; } + + /** + * @brief: get all skins in this bone tree + */ + cocos2d::Vector getAllSubSkins() const; + + // blendFunc + virtual void setBlendFunc(const cocos2d::BlendFunc &blendFunc) override; + virtual const cocos2d::BlendFunc & getBlendFunc() const override { return _blendFunc; } + + // debug draw show, bone's debugdraw can be draw when bone is visible && enable debug draw + virtual void setDebugDrawEnabled(bool isDebugDraw); + virtual bool isDebugDrawEnabled() const { return _isRackShow; } + + // bone's debug draw's length + virtual void setDebugDrawLength(float length); + virtual float getDebugDrawLength() const { return _rackLength; } + + // bone's debug draw's width + virtual void setDebugDrawWidth(float width); + virtual float getDebugDrawWidth() const { return _rackWidth; } + + // bone's debug draw's width + virtual void setDebugDrawColor(const cocos2d::Color4F &color); + virtual cocos2d::Color4F getDebugDrawColor() const { return _rackColor; } + + // get bone's bondingbox, depends on getVisibleSkinsRect, apply on node to parent's tranform + cocos2d::Rect getBoundingBox() const override; + + /** + *get displayings rect in self transform + */ + virtual cocos2d::Rect getVisibleSkinsRect() const; + + // transform & draw + virtual void draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags) override; + + // set localzorder, and dirty the debugdraw to make debugdraw's render layer right + virtual void setLocalZOrder(int localZOrder) override; + + // set name, and repalace the subbone map in skeleton + virtual void setName(const std::string& name) override; + + // set visible, and dirty the debugdraw to make debugdraw's render layer right + virtual void setVisible(bool visible) override; + + // set contentsize, and reculate debugdraw + virtual void setContentSize(const cocos2d::Size& contentSize) override; + + // set localzorder, and reculate debugdraw + virtual void setAnchorPoint(const cocos2d::Vec2& anchorPoint) override; + +#ifdef CC_STUDIO_ENABLED_VIEW + // hit test , bonePoint is in self coordinate + virtual bool isPointOnRack(const cocos2d::Vec2& bonePoint); +#endif + +CC_CONSTRUCTOR_ACCESS: + BoneNode(); + virtual ~BoneNode(); + virtual bool init() override; + +protected: + + virtual void addToChildrenListHelper(Node * child); + virtual void removeFromChildrenListHelper(Node * child); + + // add bone to children bone list, and add bone to skeleton's subbone map + virtual void addToBoneList(BoneNode* bone); + + // remove bone from children bone list, and remove bone from skeleton's subbone map + virtual void removeFromBoneList(BoneNode* bone); + + // add skin to skin list + virtual void addToSkinList(SkinNode* skin); + + // remove skin from skin list + virtual void removeFromSkinList(SkinNode* skin); + + // sort all _children , bone list and skin list + virtual void sortAllChildren() override; + + virtual void updateVertices(); + virtual void updateColor() override; + + virtual void onDraw(const cocos2d::Mat4 &transform, uint32_t flags); + + // a help function for SkeletonNode + // for batch bone's draw to _rootSkeleton + virtual void batchBoneDrawToSkeleton(BoneNode* bone) const; + +protected: + cocos2d::CustomCommand _customCommand; + cocos2d::BlendFunc _blendFunc; + + bool _isRackShow; + cocos2d::Color4F _rackColor; + int _rackLength; + int _rackWidth; + + cocos2d::Vector _childBones; + cocos2d::Vector _boneSkins; + SkeletonNode* _rootSkeleton; +private: + cocos2d::Vec2 _squareVertices[4]; + cocos2d::Color4F _squareColors[4]; + cocos2d::Vec3 _noMVPVertices[4]; + CC_DISALLOW_COPY_AND_ASSIGN(BoneNode); +}; + +NS_TIMELINE_END +#endif //__CCBONENODE_H__ \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp new file mode 100644 index 000000000000..f5f78c93ea0f --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp @@ -0,0 +1,368 @@ +/**************************************************************************** +Copyright (c) 2015 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. +****************************************************************************/ +#include "CCSkeletonNode.h" + +#include "base/CCDirector.h" +#include "math/TransformUtils.h" +#include "renderer/CCRenderer.h" +#include "renderer/ccGLStateCache.h" +#include "renderer/CCGLProgramState.h" +#include + +using namespace cocos2d::GL; + +NS_TIMELINE_BEGIN + +SkeletonNode* SkeletonNode::create() +{ + SkeletonNode* skeletonNode = new (std::nothrow) SkeletonNode(); + if (skeletonNode && skeletonNode->init()) + { + skeletonNode->autorelease(); + return skeletonNode; + } + CC_SAFE_DELETE(skeletonNode); + return nullptr; +} + + +bool SkeletonNode::init() +{ + _rackLength = _rackWidth = 20; + updateVertices(); + setGLProgramState(cocos2d::GLProgramState::getOrCreateWithGLProgramName(cocos2d::GLProgram::SHADER_NAME_POSITION_COLOR_NO_MVP)); + _rootSkeleton = this; + return true; +} + +cocos2d::Rect SkeletonNode::getBoundingBox() const +{ + float minx, miny, maxx, maxy = 0; + minx = miny = maxx = maxy; + cocos2d::Rect boundingBox = getVisibleSkinsRect(); + bool first = true; + if (!boundingBox.equals(cocos2d::Rect::ZERO)) + { + minx = boundingBox.getMinX(); + miny = boundingBox.getMinY(); + maxx = boundingBox.getMaxX(); + maxy = boundingBox.getMaxY(); + first = false; + } + auto allbones = getAllSubBones(); + for (const auto& bone : allbones) + { + cocos2d::Rect r = RectApplyAffineTransform(bone->getVisibleSkinsRect(), + bone->getNodeToParentAffineTransform(bone->getRootSkeletonNode())); + if (r.equals(cocos2d::Rect::ZERO)) + continue; + + if (first) + { + minx = r.getMinX(); + miny = r.getMinY(); + maxx = r.getMaxX(); + maxy = r.getMaxY(); + + first = false; + } + else + { + minx = MIN(r.getMinX(), minx); + miny = MIN(r.getMinY(), miny); + maxx = MAX(r.getMaxX(), maxx); + maxy = MAX(r.getMaxY(), maxy); + } + } + boundingBox.setRect(minx, miny, maxx - minx, maxy - miny); + return RectApplyAffineTransform(boundingBox, this->getNodeToParentAffineTransform());; +} + +SkeletonNode::SkeletonNode() +: BoneNode() +, _subDrawBonesDirty(true) +, _subDrawBonesOrderDirty(true) +, _batchedVeticesCount(0) +{ +} + +SkeletonNode::~SkeletonNode() +{ +} + +void SkeletonNode::updateVertices() +{ + if (_rackLength != _squareVertices[6].x - _anchorPointInPoints.x || _rackWidth != _squareVertices[3].y - _anchorPointInPoints.y) + { + const float radiusl = _rackLength * .5f; + const float radiusw = _rackWidth * .5f; + const float radiusl_2 = radiusl * .25f; + const float radiusw_2 = radiusw * .25f; + _squareVertices[5].y = _squareVertices[2].y = _squareVertices[1].y = _squareVertices[6].y + = _squareVertices[0].x = _squareVertices[4].x = _squareVertices[7].x = _squareVertices[3].x = .0f; + _squareVertices[5].x = -radiusl; _squareVertices[0].y = -radiusw; + _squareVertices[6].x = radiusl; _squareVertices[3].y = radiusw; + _squareVertices[1].x = radiusl_2; _squareVertices[7].y = radiusw_2; + _squareVertices[2].x = - radiusl_2; _squareVertices[4].y = - radiusw_2; + + + for (int i = 0; i < 8; i++) + { + _squareVertices[i] += _anchorPointInPoints; + } + + _transformUpdated = _transformDirty = _inverseDirty = _contentSizeDirty = true; + } +} + +void SkeletonNode::updateColor() +{ + for (unsigned int i = 0; i < 8; i++) + { + _squareColors[i] = _rackColor; + } + _transformUpdated = _transformDirty = _inverseDirty = _contentSizeDirty = true; +} + +void SkeletonNode::visit(cocos2d::Renderer *renderer, const cocos2d::Mat4& parentTransform, uint32_t parentFlags) +{ + // quick return if not visible. children won't be drawn. + if (!_visible) + { + return; + } + + uint32_t flags = processParentFlags(parentTransform, parentFlags); + + // IMPORTANT: + // To ease the migration to v3.0, we still support the Mat4 stack, + // but it is deprecated and your code should not rely on it + _director->pushMatrix(cocos2d::MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); + _director->loadMatrix(cocos2d::MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform); + + bool visibleByCamera = isVisitableByVisitingCamera(); + + int i = 0; + + if (!_children.empty()) + { + sortAllChildren(); + // draw children zOrder < 0 + for (; i < _children.size(); i++) + { + auto node = _children.at(i); + + if (node && node->getLocalZOrder() < 0) + node->visit(renderer, _modelViewTransform, flags); + else + break; + } + + for (auto it = _children.cbegin() + i; it != _children.cend(); ++it) + (*it)->visit(renderer, _modelViewTransform, flags); + } + + if (visibleByCamera) + { + this->draw(renderer, _modelViewTransform, flags); + // batch draw all sub bones + _batchBoneCommand.init(_globalZOrder, _modelViewTransform, parentFlags); + _batchBoneCommand.func = CC_CALLBACK_0(SkeletonNode::batchDrawAllSubBones, this, _modelViewTransform); + renderer->addCommand(&_batchBoneCommand); + } + _director->popMatrix(cocos2d::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; +} + +void SkeletonNode::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags) +{ + if (!_isRackShow) + return; + + _customCommand.init(_globalZOrder, transform, flags); + _customCommand.func = CC_CALLBACK_0(SkeletonNode::onDraw, this, transform, flags); + renderer->addCommand(&_customCommand); + for (int i = 0; i < 8; ++i) + { + cocos2d::Vec4 pos; + pos.x = _squareVertices[i].x; pos.y = _squareVertices[i].y; pos.z = _positionZ; + pos.w = 1; + _modelViewTransform.transformVector(&pos); + _noMVPVertices[i] = cocos2d::Vec3(pos.x, pos.y, pos.z) / pos.w; + } +} + +void SkeletonNode::batchDrawAllSubBones(const cocos2d::Mat4 &transform) +{ + if (_subDrawBonesDirty) + { + updateAllDrawBones(); + } + if (_subDrawBonesOrderDirty) + sortAllDrawBones(); + + _batchedVeticesCount = 0; + for (const auto& bone : _subDrawBones) + { + batchBoneDrawToSkeleton(bone); + } + cocos2d::Vec3* vetices = _batchedBoneVetices.data(); + cocos2d::Color4F* veticesColor = _batchedBoneColors.data(); + getGLProgram()->use(); + getGLProgram()->setUniformsForBuiltins(transform); + + cocos2d::GL::enableVertexAttribs(cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION | cocos2d::GL::VERTEX_ATTRIB_FLAG_COLOR); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, vetices); + glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, veticesColor); + + cocos2d::GL::blendFunc(_blendFunc.src, _blendFunc.dst); + +#ifdef CC_STUDIO_ENABLED_VIEW + glLineWidth(1); + glEnable(GL_LINE_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); + for(int i= 0; i < _batchedVeticesCount; i += 8) + { + glDrawArrays(GL_TRIANGLE_FAN, i, 4); + glDrawArrays(GL_LINE_LOOP, i + 4, 4); + } + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _batchedVeticesCount); +#else + for (int i = 0; i < _batchedVeticesCount; i += 4) + { + glDrawArrays(GL_TRIANGLE_FAN, i, 4); + } + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _batchedVeticesCount); +#endif //CC_STUDIO_ENABLED_VIEW +} + + +void SkeletonNode::onDraw(const cocos2d::Mat4 &transform, uint32_t flags) +{ + getGLProgram()->use(); + getGLProgram()->setUniformsForBuiltins(transform); + + cocos2d::GL::enableVertexAttribs(cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION | cocos2d::GL::VERTEX_ATTRIB_FLAG_COLOR); + + // + // Attributes + // +#ifdef EMSCRIPTEN + setGLBufferData(_noMVPVertices, 8 * sizeof(Vec3), 0); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, 0); + + setGLBufferData(_squareColors, 8 * sizeof(Color4F), 1); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, 0); +#else + glBindBuffer(GL_ARRAY_BUFFER, 0); + glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, _noMVPVertices); + glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, _squareColors); +#endif // EMSCRIPTEN + + cocos2d::GL::blendFunc(_blendFunc.src, _blendFunc.dst); + + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 4, 4); + + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8); +} + +void SkeletonNode::changeSkins(const std::map& boneSkinNameMap) +{ + for (auto &boneskin : boneSkinNameMap) + { + auto bone = getBoneNode(boneskin.first); + if ( nullptr != bone) + bone->displaySkin(boneskin.second, true); + } +} + +void SkeletonNode::changeSkins(const std::string& skinGroupName) +{ + auto suit = _skinGroupMap.find(skinGroupName); + if (suit != _skinGroupMap.end()) + { + changeSkins(suit->second); + } +} + +BoneNode* SkeletonNode::getBoneNode(const std::string& boneName) +{ + auto iter = _subBonesMap.find(boneName); + if (iter != _subBonesMap.end()) + { + return iter->second; + } + return nullptr; +} + +const cocos2d::Map& SkeletonNode::getAllSubBonesMap() const +{ + return _subBonesMap; +} + +void SkeletonNode::addSkinGroup(std::string groupName, std::map boneSkinNameMap) +{ + _skinGroupMap.insert(std::make_pair(groupName, boneSkinNameMap)); +} + +void SkeletonNode::updateAllDrawBones() +{ + _subDrawBones.clear(); + // get All Visible SubBones + // get all sub bones as visit with visible + std::stack boneStack; + for (const auto& bone : _childBones) + { + if (bone->isVisible() && bone->isDebugDrawEnabled()) + boneStack.push(bone); + } + + while (boneStack.size() > 0) + { + auto top = boneStack.top(); + _subDrawBones.pushBack(top); + boneStack.pop(); + auto topChildren = top->getChildBones(); + for (const auto& childbone : topChildren) + { + if (childbone->isVisible() && childbone->isDebugDrawEnabled()) + boneStack.push(childbone); + } + } + _subDrawBonesDirty = false; +} + +void SkeletonNode::sortAllDrawBones() +{ + std::sort(_subDrawBones.begin(), _subDrawBones.end(), cocos2d::nodeComparisonLess); + _subDrawBonesOrderDirty = false; +} + +NS_TIMELINE_END \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h new file mode 100644 index 000000000000..8fc4d99fa9d2 --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h @@ -0,0 +1,117 @@ +/**************************************************************************** +Copyright (c) 2015 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 __CCSKELETONNODE_H__ +#define __CCSKELETONNODE_H__ + +#include "CCTimelineMacro.h" +#include "renderer/CCRenderer.h" +#include "cocostudio/CocosStudioExport.h" +#include "base/CCMap.h" + +#include "CCBoneNode.h" + +NS_TIMELINE_BEGIN + +class CC_STUDIO_DLL SkeletonNode : public BoneNode +{ + friend class BoneNode; + +public: + static SkeletonNode* create(); + + /** + *get bonenode in skeleton node by bone name + */ + BoneNode* getBoneNode(const std::string& boneName); + + /** + *get All bones in this skeleton, + */ + const cocos2d::Map& getAllSubBonesMap() const; + + /** + *@brief: change displays + *@param: boneSkinNameMap, map + */ + void changeSkins(const std::map& boneSkinNameMap); + + /** + *@brief: change displays + *@param: skinGroupName have + */ + void changeSkins(const std::string& skinGroupName); + + /** + *@brief: add a boneSkinNameMap as a SkinGroup named groupName + *@param: groupName, key + *@param: boneSkinNameMap, map + */ + void addSkinGroup(std::string groupName, std::map boneSkinNameMap); + + cocos2d::Rect getBoundingBox() const override; + +CC_CONSTRUCTOR_ACCESS: + SkeletonNode(); + virtual ~SkeletonNode(); + virtual bool init() override; + +protected: + virtual void updateVertices() override; + virtual void updateColor() override; + + virtual void visit(cocos2d::Renderer *renderer, const cocos2d::Mat4& parentTransform, uint32_t parentFlags) override; + virtual void draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags) override; + virtual void onDraw(const cocos2d::Mat4 &transform, uint32_t flags) override; + +protected: + cocos2d::Map _subBonesMap; + +private: + cocos2d::Vec2 _squareVertices[8]; + cocos2d::Color4F _squareColors[8]; + cocos2d::Vec3 _noMVPVertices[8]; + + std::map > _skinGroupMap; // map< suit name, map< bone name, skin name> > + CC_DISALLOW_COPY_AND_ASSIGN(SkeletonNode); + + + // for batch draw sub bones + bool _subDrawBonesDirty; + bool _subDrawBonesOrderDirty; + cocos2d::Vector _subDrawBones; // for draw faster, cache a list from _subBonesMap, sorted by render order + std::vector _batchedBoneVetices; + std::vector _batchedBoneColors; + int _batchedVeticesCount; + cocos2d::CustomCommand _batchBoneCommand; + + void updateAllDrawBones(); + void sortAllDrawBones(); + void batchDrawAllSubBones(const cocos2d::Mat4 &transform); + void batchSubBone(BoneNode* bone); +}; + +NS_TIMELINE_END + +#endif //__CCSKELETONNODE_H__ diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCSkinNode.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCSkinNode.cpp new file mode 100644 index 000000000000..94d30011b412 --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCSkinNode.cpp @@ -0,0 +1,31 @@ +/**************************************************************************** +Copyright (c) 2015 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. +****************************************************************************/ + +#include "CCSkinNode.h" +using namespace cocos2d; + + +NS_TIMELINE_BEGIN + +NS_TIMELINE_END \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCSkinNode.h b/cocos/editor-support/cocostudio/ActionTimeline/CCSkinNode.h new file mode 100644 index 000000000000..a34c1af511ba --- /dev/null +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCSkinNode.h @@ -0,0 +1,38 @@ +/**************************************************************************** +Copyright (c) 2015 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 __CCSKINNODE_H__ +#define __CCSKINNODE_H__ + +#include "2d/CCNode.h" +#include "CCTimelineMacro.h" + + +NS_TIMELINE_BEGIN + +typedef cocos2d::Node SkinNode; + +NS_TIMELINE_END + +#endif //__CCSKINNODE_H__ diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp index 7465a985c463..b18eec0efce3 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp @@ -63,7 +63,8 @@ #include "cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.h" #include "cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h" #include "cocostudio/WidgetReader/Particle3DReader/Particle3DReader.h" - +#include "cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.h" +#include "cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.h" #include "flatbuffers/flatbuffers.h" #include "flatbuffers/util.h" @@ -212,6 +213,8 @@ CSLoader::CSLoader() CREATE_CLASS_NODE_READER_INFO(Sprite3DReader); CREATE_CLASS_NODE_READER_INFO(UserCameraReader); CREATE_CLASS_NODE_READER_INFO(Particle3DReader); + CREATE_CLASS_NODE_READER_INFO(BoneNodeReader); + CREATE_CLASS_NODE_READER_INFO(SkeletonNodeReader); } void CSLoader::purge() diff --git a/cocos/editor-support/cocostudio/Android.mk b/cocos/editor-support/cocostudio/Android.mk index 8ced24200ad4..7d7c70593a3f 100644 --- a/cocos/editor-support/cocostudio/Android.mk +++ b/cocos/editor-support/cocostudio/Android.mk @@ -65,16 +65,21 @@ WidgetReader/Node3DReader/Node3DReader.cpp \ WidgetReader/Sprite3DReader/Sprite3DReader.cpp \ WidgetReader/UserCameraReader/UserCameraReader.cpp \ WidgetReader/Particle3DReader/Particle3DReader.cpp \ +WidgetReader/SkeletonReader/BoneNodeReader.cpp \ +WidgetReader/SkeletonReader/SkeletonNodeReader.cpp \ ActionTimeline/CCActionTimelineCache.cpp \ ActionTimeline/CCFrame.cpp \ ActionTimeline/CCTimeLine.cpp \ ActionTimeline/CCActionTimeline.cpp \ ActionTimeline/CCActionTimelineNode.cpp \ ActionTimeline/CSLoader.cpp \ +ActionTimeline/CCBoneNode.cpp \ +ActionTimeline/CCSkeletonNode.cpp \ +ActionTimeline/CCSkinNode.cpp \ FlatBuffersSerialize.cpp \ WidgetCallBackHandlerProtocol.cpp \ WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp \ -CCObjectExtensionData.cpp \ +CCComExtensionData.cpp \ CocoStudio.cpp diff --git a/cocos/editor-support/cocostudio/CCObjectExtensionData.cpp b/cocos/editor-support/cocostudio/CCComExtensionData.cpp similarity index 72% rename from cocos/editor-support/cocostudio/CCObjectExtensionData.cpp rename to cocos/editor-support/cocostudio/CCComExtensionData.cpp index 8db5ffcdeefa..2d438493ceac 100644 --- a/cocos/editor-support/cocostudio/CCObjectExtensionData.cpp +++ b/cocos/editor-support/cocostudio/CCComExtensionData.cpp @@ -22,17 +22,29 @@ THE SOFTWARE. ****************************************************************************/ -#include "CCObjectExtensionData.h" +#include "CCComExtensionData.h" #include "cocostudio/ActionTimeline/CCActionTimeline.h" namespace cocostudio { - - ObjectExtensionData* ObjectExtensionData::create() + IMPLEMENT_CLASS_COMPONENT_INFO(ComExtensionData) + ComExtensionData::ComExtensionData() + : _customProperty("") + , _timelineData(nullptr) + { + _name = "ComExtensionData"; + } + + ComExtensionData::~ComExtensionData() { - ObjectExtensionData * ret = new (std::nothrow) ObjectExtensionData(); + CC_SAFE_RELEASE(_timelineData); + } + + ComExtensionData* ComExtensionData::create() + { + ComExtensionData * ret = new (std::nothrow) ComExtensionData(); if (ret && ret->init()) { ret->autorelease(); @@ -44,18 +56,8 @@ namespace cocostudio return ret; } - ObjectExtensionData::ObjectExtensionData() - : _customProperty("") - , _timelineData(nullptr) - { - } - - ObjectExtensionData::~ObjectExtensionData() - { - CC_SAFE_RELEASE(_timelineData); - } - bool ObjectExtensionData::init() + bool ComExtensionData::init() { _timelineData = cocostudio::timeline::ActionTimelineData::create(0); CC_SAFE_RETAIN(_timelineData); @@ -63,12 +65,30 @@ namespace cocostudio return true; } - void ObjectExtensionData::setActionTag(int actionTag) + void ComExtensionData::onEnter() + { + } + + void ComExtensionData::onExit() + { + onRemove(); + } + + void ComExtensionData::onAdd() + { + } + + void ComExtensionData::onRemove() + { + CC_SAFE_RELEASE_NULL(_timelineData); + } + + void ComExtensionData::setActionTag(int actionTag) { _timelineData->setActionTag(actionTag); } - const int ObjectExtensionData::getActionTag() const + const int ComExtensionData::getActionTag() const { return _timelineData->getActionTag(); } diff --git a/cocos/editor-support/cocostudio/CCObjectExtensionData.h b/cocos/editor-support/cocostudio/CCComExtensionData.h similarity index 74% rename from cocos/editor-support/cocostudio/CCObjectExtensionData.h rename to cocos/editor-support/cocostudio/CCComExtensionData.h index 7fad70f1c8a0..dca3e17cd036 100644 --- a/cocos/editor-support/cocostudio/CCObjectExtensionData.h +++ b/cocos/editor-support/cocostudio/CCComExtensionData.h @@ -26,9 +26,8 @@ #define __cocos2d_libs__CCObjectExtensionData__ #include - -#include "base/CCRef.h" - +#include "CCComBase.h" +#include "2d/CCComponent.h" #include "cocostudio/CocosStudioExport.h" namespace cocostudio @@ -41,22 +40,42 @@ namespace cocostudio namespace cocostudio { - class CC_STUDIO_DLL ObjectExtensionData : public cocos2d::Ref + class CC_STUDIO_DLL ComExtensionData : public cocos2d::Component { - + DECLARE_CLASS_COMPONENT_INFO public: - static ObjectExtensionData* create(); - + /** + * @js NA + * @lua NA + */ + virtual void onEnter() override; + /** + * @js NA + * @lua NA + */ + virtual void onExit() override; + /** + * @js NA + * @lua NA + */ + virtual void onAdd() override; + /** + * @js NA + * @lua NA + */ + virtual void onRemove() override; + static ComExtensionData* create(); + virtual bool init() override; + virtual void setCustomProperty(const std::string& customProperty) { _customProperty = customProperty; } virtual std::string getCustomProperty() const { return _customProperty; }; virtual void setActionTag(int actionTag); virtual const int getActionTag() const; - CC_CONSTRUCTOR_ACCESS: - ObjectExtensionData(); - ~ObjectExtensionData(); - virtual bool init(); + public: + ComExtensionData(); + ~ComExtensionData(); protected: std::string _customProperty; diff --git a/cocos/editor-support/cocostudio/CMakeLists.txt b/cocos/editor-support/cocostudio/CMakeLists.txt index 6f497d09439f..c8d0b1d27041 100644 --- a/cocos/editor-support/cocostudio/CMakeLists.txt +++ b/cocos/editor-support/cocostudio/CMakeLists.txt @@ -43,7 +43,7 @@ set(COCOS_CS_SRC editor-support/cocostudio/TriggerMng.cpp editor-support/cocostudio/TriggerObj.cpp editor-support/cocostudio/FlatBuffersSerialize.cpp - editor-support/cocostudio/CCObjectExtensionData.cpp + editor-support/cocostudio/CCComExtensionData.cpp editor-support/cocostudio/CocoStudio.cpp editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp @@ -65,6 +65,8 @@ set(COCOS_CS_SRC editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.cpp editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp + editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.cpp + editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.cpp editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp @@ -77,6 +79,9 @@ set(COCOS_CS_SRC editor-support/cocostudio/ActionTimeline/CCFrame.cpp editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp editor-support/cocostudio/ActionTimeline/CSLoader.cpp + editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp + editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp + editor-support/cocostudio/ActionTimeline/CCSkinNode.cpp editor-support/cocostudio/FlatBuffersSerialize.cpp editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp ) diff --git a/cocos/editor-support/cocostudio/CSParse3DBinary_generated.h b/cocos/editor-support/cocostudio/CSParse3DBinary_generated.h index 32f0191696ea..e8ef83081dc9 100644 --- a/cocos/editor-support/cocostudio/CSParse3DBinary_generated.h +++ b/cocos/editor-support/cocostudio/CSParse3DBinary_generated.h @@ -93,6 +93,92 @@ MANUALLY_ALIGNED_STRUCT(4) Vector3 { }; STRUCT_END(Vector3, 12); +struct GameNode3DOption : private flatbuffers::Table { + const flatbuffers::String *name() const { return GetPointer(4); } + int32_t skyBoxMask() const { return GetField(6, 0); } + uint8_t skyBoxEnabled() const { return GetField(8, 0); } + const ResourceData *leftFileData() const { return GetPointer(10); } + const ResourceData *rightFileData() const { return GetPointer(12); } + const ResourceData *upFileData() const { return GetPointer(14); } + const ResourceData *downFileData() const { return GetPointer(16); } + const ResourceData *forwardFileData() const { return GetPointer(18); } + const ResourceData *backFileData() const { return GetPointer(20); } + const flatbuffers::String *frameEvent() const { return GetPointer(22); } + const flatbuffers::String *customProperty() const { return GetPointer(24); } + bool Verify(flatbuffers::Verifier &verifier) const { + return VerifyTableStart(verifier) && + VerifyField(verifier, 4 /* nodeOptions */) && + verifier.Verify(name()) && + VerifyField(verifier, 6 /* skyBoxMask */) && + VerifyField(verifier, 8 /* skyBoxEnabled */) && + VerifyField(verifier, 10 /* leftFileData */) && + verifier.VerifyTable(leftFileData()) && + VerifyField(verifier, 12 /* rightFileData */) && + verifier.VerifyTable(rightFileData()) && + VerifyField(verifier, 14 /* upFileData */) && + verifier.VerifyTable(upFileData()) && + VerifyField(verifier, 16 /* downFileData */) && + verifier.VerifyTable(downFileData()) && + VerifyField(verifier, 18 /* forwardFileData */) && + verifier.VerifyTable(forwardFileData()) && + VerifyField(verifier, 20 /* backFileData */) && + verifier.VerifyTable(backFileData()) && + VerifyField(verifier, 22 /* frameEvent */) && + verifier.Verify(frameEvent()) && + VerifyField(verifier, 24 /* customProperty */) && + verifier.Verify(customProperty()) && + verifier.EndTable(); + } +}; + +struct GameNode3DOptionBuilder { + flatbuffers::FlatBufferBuilder &fbb_; + flatbuffers::uoffset_t start_; + void add_name(flatbuffers::Offset name) { fbb_.AddOffset(4, name); } + void add_skyBoxMask(int32_t skyBoxMask) { fbb_.AddElement(6, skyBoxMask, 0); } + void add_skyboxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement(8, skyBoxEnabled, 0); } + void add_leftFileData(flatbuffers::Offset leftFileData) { fbb_.AddOffset(10, leftFileData); } + void add_rightFileData(flatbuffers::Offset rightFileData) { fbb_.AddOffset(12, rightFileData); } + void add_upFileData(flatbuffers::Offset upFileData) { fbb_.AddOffset(14, upFileData); } + void add_downFileData(flatbuffers::Offset downFileData) { fbb_.AddOffset(16, downFileData); } + void add_forwardFileData(flatbuffers::Offset forwardFileData) { fbb_.AddOffset(18, forwardFileData); } + void add_backFileData(flatbuffers::Offset backFileData) { fbb_.AddOffset(20, backFileData); } + void add_frameEvent(flatbuffers::Offset frameEvent) { fbb_.AddOffset(22, frameEvent); } + void add_customProperty(flatbuffers::Offset customProperty) { fbb_.AddOffset(24, customProperty); } + GameNode3DOptionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } + flatbuffers::Offset Finish() { + auto o = flatbuffers::Offset(fbb_.EndTable(start_, 11)); + return o; + } +}; + +inline flatbuffers::Offset CreateGameNode3DOption(flatbuffers::FlatBufferBuilder &_fbb, + flatbuffers::Offset name = 0, + int32_t skyBoxMask = 0, + uint8_t skyBoxEnabled = 0, + flatbuffers::Offset leftFileData = 0, + flatbuffers::Offset rightFileData = 0, + flatbuffers::Offset upFileData = 0, + flatbuffers::Offset downFileData = 0, + flatbuffers::Offset forwardFileData = 0, + flatbuffers::Offset backFileData = 0, + flatbuffers::Offset frameEvent = 0, + flatbuffers::Offset customProperty = 0) { + GameNode3DOptionBuilder builder_(_fbb); + builder_.add_customProperty(customProperty); + builder_.add_frameEvent(frameEvent); + builder_.add_backFileData(backFileData); + builder_.add_forwardFileData(forwardFileData); + builder_.add_downFileData(downFileData); + builder_.add_upFileData(upFileData); + builder_.add_rightFileData(rightFileData); + builder_.add_leftFileData(leftFileData); + builder_.add_skyboxEnabled(skyBoxEnabled); + builder_.add_skyBoxMask(skyBoxMask); + builder_.add_name(name); + return builder_.Finish(); +} + struct Node3DOption : private flatbuffers::Table { const flatbuffers::WidgetOptions *nodeOptions() const { return GetPointer(4); } const Vector3 *position3D() const { return GetStruct(6); } @@ -223,6 +309,13 @@ struct UserCameraOptions : private flatbuffers::Table { float nearClip() const { return GetField(8, 1); } float farClip() const { return GetField(10, 1000); } int32_t cameraFlag() const { return GetField(12, 0); } + uint8_t skyBoxEnabled() const { return GetField(14, 0); } + const ResourceData *leftFileData() const { return GetPointer(16); } + const ResourceData *rightFileData() const { return GetPointer(18); } + const ResourceData *upFileData() const { return GetPointer(20); } + const ResourceData *downFileData() const { return GetPointer(22); } + const ResourceData *forwardFileData() const { return GetPointer(24); } + const ResourceData *backFileData() const { return GetPointer(26); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField(verifier, 4 /* node3DOption */) && @@ -231,6 +324,19 @@ struct UserCameraOptions : private flatbuffers::Table { VerifyField(verifier, 8 /* nearClip */) && VerifyField(verifier, 10 /* farClip */) && VerifyField(verifier, 12 /* cameraFlag */) && + VerifyField(verifier, 14 /* skyBoxEnabled */) && + VerifyField(verifier, 16 /* leftFileData */) && + verifier.VerifyTable(leftFileData()) && + VerifyField(verifier, 18 /* rightFileData */) && + verifier.VerifyTable(rightFileData()) && + VerifyField(verifier, 20 /* upFileData */) && + verifier.VerifyTable(upFileData()) && + VerifyField(verifier, 22 /* downFileData */) && + verifier.VerifyTable(downFileData()) && + VerifyField(verifier, 24 /* forwardFileData */) && + verifier.VerifyTable(forwardFileData()) && + VerifyField(verifier, 26 /* backFileData */) && + verifier.VerifyTable(backFileData()) && verifier.EndTable(); } }; @@ -243,10 +349,17 @@ struct UserCameraOptionsBuilder { void add_nearClip(float nearClip) { fbb_.AddElement(8, nearClip, 1); } void add_farClip(float farClip) { fbb_.AddElement(10, farClip, 1000); } void add_cameraFlag(int32_t cameraFlag) { fbb_.AddElement(12, cameraFlag, 0); } + void add_skyboxEnabled(uint8_t skyBoxEnabled) { fbb_.AddElement(14, skyBoxEnabled, 0); } + void add_leftFileData(flatbuffers::Offset leftFileData) { fbb_.AddOffset(16, leftFileData); } + void add_rightFileData(flatbuffers::Offset rightFileData) { fbb_.AddOffset(18, rightFileData); } + void add_upFileData(flatbuffers::Offset upFileData) { fbb_.AddOffset(20, upFileData); } + void add_downFileData(flatbuffers::Offset downFileData) { fbb_.AddOffset(22, downFileData); } + void add_forwardFileData(flatbuffers::Offset forwardFileData) { fbb_.AddOffset(24, forwardFileData); } + void add_backFileData(flatbuffers::Offset backFileData) { fbb_.AddOffset(26, backFileData); } UserCameraOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } UserCameraOptionsBuilder &operator=(const UserCameraOptionsBuilder &); flatbuffers::Offset Finish() { - auto o = flatbuffers::Offset(fbb_.EndTable(start_, 5)); + auto o = flatbuffers::Offset(fbb_.EndTable(start_, 12)); return o; } }; @@ -256,8 +369,22 @@ inline flatbuffers::Offset CreateUserCameraOptions(flatbuffer float fov = 60, float nearClip = 1, float farClip = 1000, - int32_t cameraFlag = 0) { + int32_t cameraFlag = 0, + uint8_t skyBoxEnabled = 0, + flatbuffers::Offset leftFileData = 0, + flatbuffers::Offset rightFileData = 0, + flatbuffers::Offset upFileData = 0, + flatbuffers::Offset downFileData = 0, + flatbuffers::Offset forwardFileData = 0, + flatbuffers::Offset backFileData = 0) { UserCameraOptionsBuilder builder_(_fbb); + builder_.add_backFileData(backFileData); + builder_.add_forwardFileData(forwardFileData); + builder_.add_downFileData(downFileData); + builder_.add_upFileData(upFileData); + builder_.add_rightFileData(rightFileData); + builder_.add_leftFileData(leftFileData); + builder_.add_skyboxEnabled(skyBoxEnabled); builder_.add_cameraFlag(cameraFlag); builder_.add_farClip(farClip); builder_.add_nearClip(nearClip); diff --git a/cocos/editor-support/cocostudio/CocoStudio.h b/cocos/editor-support/cocostudio/CocoStudio.h index 55c15653a486..d4237f84a64f 100644 --- a/cocos/editor-support/cocostudio/CocoStudio.h +++ b/cocos/editor-support/cocostudio/CocoStudio.h @@ -62,6 +62,8 @@ THE SOFTWARE. #include "cocostudio/ActionTimeline/CCTimeLine.h" #include "cocostudio/ActionTimeline/CCActionTimeline.h" #include "cocostudio/ActionTimeline/CCActionTimelineNode.h" +#include "cocostudio/ActionTimeline/CCBoneNode.h" +#include "cocostudio/ActionTimeline/CCSkeletonNode.h" #include "cocostudio/CocosStudioExport.h" #include "cocostudio/ActionTimeline/CSLoader.h" diff --git a/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp b/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp index c07a6e385800..699b303ac74e 100644 --- a/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp +++ b/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp @@ -257,6 +257,21 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str else if (name == "ObjectData") // nodeTree { const tinyxml2::XMLElement* objectData = child; + + auto nameElem = objectData->FirstAttribute(); + while (nameElem) + { + if (0 == strcmp("ctype", nameElem->Name())) + { + rootType = nameElem->Value(); + break; + } + else + nameElem = nameElem->Next(); + } + if (rootType == "GameNodeObjectData" || rootType == "GameLayerObjectData") // for adaptate old version + rootType = "NodeObjectData"; + nodeTree = createNodeTree(objectData, rootType); } else if (name == "AnimationList") // animation list @@ -1292,6 +1307,19 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato else if (name == "ObjectData") // nodeTree { const tinyxml2::XMLElement* objectData = child; + auto nameElem = objectData->FirstAttribute(); + while (nameElem) + { + if (0 == strcmp("ctype", nameElem->Name())) + { + rootType = nameElem->Value(); + break; + } + else + nameElem = nameElem->Next(); + } + if (rootType == "GameNodeObjectData" || rootType == "GameLayerObjectData") // for adaptate old version + rootType = "NodeObjectData"; nodeTree = createNodeTreeForSimulator(objectData, rootType); } else if (name == "AnimationList") // animation list diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.cpp new file mode 100644 index 000000000000..3cb5c3b2c241 --- /dev/null +++ b/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.cpp @@ -0,0 +1,431 @@ +/**************************************************************************** + Copyright (c) 2014 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 "GameNode3DReader.h" + +#include "cocostudio/CCComExtensionData.h" +#include "cocostudio/CSParseBinary_generated.h" +#include "cocostudio/CSParse3DBinary_generated.h" + +#include "cocostudio/FlatBuffersSerialize.h" +#include "cocostudio/WidgetReader/NodeReader/NodeReader.h" + +#include "tinyxml2.h" +#include "flatbuffers/flatbuffers.h" + +USING_NS_CC; +using namespace flatbuffers; + +namespace cocostudio +{ + IMPLEMENT_CLASS_NODE_READER_INFO(GameNode3DReader) + + GameNode3DReader::GameNode3DReader() + { + + } + + GameNode3DReader::~GameNode3DReader() + { + + } + + static GameNode3DReader* _instanceNode3DReader = nullptr; + + GameNode3DReader* GameNode3DReader::getInstance() + { + if (!_instanceNode3DReader) + { + _instanceNode3DReader = new GameNode3DReader(); + } + + return _instanceNode3DReader; + } + + void GameNode3DReader::purge() + { + CC_SAFE_DELETE(_instanceNode3DReader); + } + + void GameNode3DReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceNode3DReader); + } + + Offset GameNode3DReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, + flatbuffers::FlatBufferBuilder *builder) + { + std::string name = ""; + int skyBoxMask = 1; + bool skyBoxEnabled = false; + + std::string leftPath = ""; + std::string leftPlistFile = ""; + int leftResourceType = 0; + + std::string rightPath = ""; + std::string rightPlistFile = ""; + int rightResourceType = 0; + + std::string upPath = ""; + std::string upPlistFile = ""; + int upResourceType = 0; + + std::string downPath = ""; + std::string downPlistFile = ""; + int downResourceType = 0; + + std::string forwardPath = ""; + std::string forwardPlistFile = ""; + int forwardResourceType = 0; + + std::string backPath = ""; + std::string backPlistFile = ""; + int backResourceType = 0; + + std::string frameEvent = ""; + std::string customProperty = ""; + + // attributes + const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute(); + while (attribute) + { + std::string attriname = attribute->Name(); + std::string value = attribute->Value(); + + if (attriname == "Name") + { + name = value; + } + else if (attriname == "SkyBoxEnabled") + { + skyBoxEnabled = (value == "True") ? true : false; + } + else if (attriname == "skyBoxMask") + { + skyBoxMask = atoi(value.c_str()); + } + else if (attriname == "UserData") + { + customProperty = value; + } + else if (attriname == "FrameEvent") + { + frameEvent = value; + } + + attribute = attribute->Next(); + } + + const tinyxml2::XMLElement* child = objectData->FirstChildElement(); + while (child) + { + std::string name = child->Name(); + + if (name == "LeftImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + leftPath = value; + } + else if (name == "Type") + { + leftResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + leftPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (leftResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(leftPlistFile)); + } + } + else if (name == "RightImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + rightPath = value; + } + else if (name == "Type") + { + rightResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + rightPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (rightResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(rightPlistFile)); + } + } + else if (name == "UpImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + upPath = value; + } + else if (name == "Type") + { + upResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + upPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (upResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(upPlistFile)); + } + } + else if (name == "DownImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + downPath = value; + } + else if (name == "Type") + { + downResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + downPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (downResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(downPlistFile)); + } + } + else if (name == "ForwardImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + forwardPath = value; + } + else if (name == "Type") + { + forwardResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + forwardPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (forwardResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(forwardPlistFile)); + } + } + else if (name == "BackImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + backPath = value; + } + else if (name == "Type") + { + backResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + backPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (backResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(backPlistFile)); + } + } + + child = child->NextSiblingElement(); + } + + auto options = CreateGameNode3DOption(*builder, + builder->CreateString(name), + skyBoxMask, + skyBoxEnabled, + CreateResourceData(*builder, + builder->CreateString(leftPath), + builder->CreateString(leftPlistFile), + leftResourceType), + CreateResourceData(*builder, + builder->CreateString(rightPath), + builder->CreateString(rightPlistFile), + rightResourceType), + CreateResourceData(*builder, + builder->CreateString(upPath), + builder->CreateString(upPlistFile), + upResourceType), + CreateResourceData(*builder, + builder->CreateString(downPath), + builder->CreateString(downPlistFile), + downResourceType), + CreateResourceData(*builder, + builder->CreateString(forwardPath), + builder->CreateString(forwardPlistFile), + forwardResourceType), + CreateResourceData(*builder, + builder->CreateString(backPath), + builder->CreateString(backPlistFile), + backResourceType), + builder->CreateString(frameEvent), + builder->CreateString(customProperty) + ); + + return *(Offset
*)(&options); + } + + void GameNode3DReader::setPropsWithFlatBuffers(cocos2d::Node *node, + const flatbuffers::Table* node3DOptions) + { + auto options = (GameNode3DOption*)node3DOptions; + + std::string name = options->name()->c_str(); + node->setName(name); + + bool skyBoxEnabled = options->skyBoxEnabled() != 0; + if (skyBoxEnabled) + { + auto leftFileData = options->leftFileData()->path()->c_str(); + auto rightFileData = options->rightFileData()->path()->c_str(); + auto upFileData = options->upFileData()->path()->c_str(); + auto downFileData = options->downFileData()->path()->c_str(); + auto forwardFileData = options->forwardFileData()->path()->c_str(); + auto backFileData = options->backFileData()->path()->c_str(); + + Skybox* childBox = Skybox::create(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData); + unsigned short cameraFlag = 1 << 10; + childBox->setCameraMask(cameraFlag, false); + node->addChild(childBox,0,"_innerSkyBox"); + } + + std::string customProperty = options->customProperty()->c_str(); + ComExtensionData* extensionData = ComExtensionData::create(); + extensionData->setCustomProperty(customProperty);\ + if (node->getComponent("ComExtensionData")) + { + node->removeComponent("ComExtensionData"); + } + node->addComponent(extensionData); + } + + Node* GameNode3DReader::createNodeWithFlatBuffers(const flatbuffers::Table *node3DOptions) + { + Node* node = Node::create(); + + setPropsWithFlatBuffers(node, (Table*)node3DOptions); + + return node; + } + + int GameNode3DReader::getResourceType(std::string key) + { + if (key == "Normal" || key == "Default") + { + return 0; + } + + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + if (fbs->_isSimulator) + { + if (key == "MarkedSubImage") + { + return 0; + } + } + return 1; + } +} diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.h b/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.h new file mode 100644 index 000000000000..df7b5ea2a08e --- /dev/null +++ b/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.h @@ -0,0 +1,63 @@ +/**************************************************************************** + Copyright (c) 2014 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 __cocos2d_libs__Node3DReader__ +#define __cocos2d_libs__Node3DReader__ + +#include "cocos2d.h" +#include "cocostudio/CocosStudioExport.h" +#include "cocostudio/WidgetReader/NodeReaderProtocol.h" +#include "cocostudio/WidgetReader/NodeReaderDefine.h" + +namespace tinyxml2 +{ + class XMLAttribute; +} + +namespace cocostudio +{ + class CC_STUDIO_DLL GameNode3DReader : public cocos2d::Ref, public NodeReaderProtocol + { + DECLARE_CLASS_NODE_READER_INFO + + public: + GameNode3DReader(); + ~GameNode3DReader(); + + static GameNode3DReader* getInstance(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); + + flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, + flatbuffers::FlatBufferBuilder* builder); + void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* node3DOptions); + cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* node3DOptions); + + protected: + int getResourceType(std::string key); + }; +} + +#endif /* defined(__cocos2d_libs__Node3DReader__) */ diff --git a/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp index 5435505e48d7..8775e6612b71 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp @@ -401,7 +401,7 @@ namespace cocostudio node->setScaleZ(scale->z()); } - node->setCameraMask(cameraMask, true); + node->setCameraMask(cameraMask, false); auto nodeReader = NodeReader::getInstance(); nodeReader->setPropsWithFlatBuffers(node, (Table*)(options->nodeOptions())); diff --git a/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp index f97ee09e2f7b..9d34dac00af3 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp @@ -26,7 +26,7 @@ #include "cocostudio/CSParseBinary_generated.h" #include "cocostudio/ActionTimeline/CCActionTimeline.h" -#include "cocostudio/CCObjectExtensionData.h" +#include "cocostudio/CCComExtensionData.h" #include "tinyxml2.h" #include "flatbuffers/flatbuffers.h" @@ -470,7 +470,7 @@ namespace cocostudio float rotationSkewY = options->rotationSkew()->rotationSkewY(); float anchorx = options->anchorPoint()->scaleX(); float anchory = options->anchorPoint()->scaleY(); - int zorder = options->zOrder(); + int zorder = options->zOrder(); int tag = options->tag(); int actionTag = options->actionTag(); bool visible = options->visible() != 0; @@ -509,10 +509,14 @@ namespace cocostudio node->setTag(tag); - ObjectExtensionData* extensionData = ObjectExtensionData::create(); + ComExtensionData* extensionData = ComExtensionData::create(); extensionData->setCustomProperty(customProperty); extensionData->setActionTag(actionTag); - node->setUserObject(extensionData); + if (node->getComponent("ComExtensionData")) + { + node->removeComponent("ComExtensionData"); + } + node->addComponent(extensionData); node->setCascadeColorEnabled(true); diff --git a/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.cpp new file mode 100644 index 000000000000..28ae147be5ad --- /dev/null +++ b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +Copyright (c) 2015 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. +****************************************************************************/ + +#include "tinyxml2/tinyxml2.h" +#include "flatbuffers/flatbuffers.h" +#include "cocostudio/WidgetReader/NodeReader/NodeReader.h" +#include "cocostudio/CSParseBinary_generated.h" +#include "cocostudio/WidgetReader/SkeletonReader/CSBoneBinary_generated.h" +#include "cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.h" +#include "cocostudio/ActionTimeline/CCBoneNode.h" + + +USING_NS_CC; +USING_NS_TIMELINE; +using namespace cocostudio; +using namespace flatbuffers; + +IMPLEMENT_CLASS_NODE_READER_INFO(BoneNodeReader) + +BoneNodeReader::BoneNodeReader() +{ + +} + +BoneNodeReader::~BoneNodeReader() +{ + +} + +static BoneNodeReader* _instanceBoneNodeReader = nullptr; + +BoneNodeReader* BoneNodeReader::getInstance() +{ + if (_instanceBoneNodeReader == nullptr) + { + _instanceBoneNodeReader = new (std::nothrow) BoneNodeReader(); + } + return _instanceBoneNodeReader; +} + +void BoneNodeReader::destroyInstance() +{ + CC_SAFE_DELETE(_instanceBoneNodeReader); +} + +Offset
BoneNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, + flatbuffers::FlatBufferBuilder *builder) +{ + + auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder); + auto nodeOptions = *(Offset*)(&temp); + + float length = 0; + cocos2d::BlendFunc blendFunc = cocos2d::BlendFunc::ALPHA_PREMULTIPLIED; + + const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute(); + while (attribute) + { + std::string name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Length") + { + length = atof(value.c_str()); + } + attribute = attribute->Next(); + } + + const tinyxml2::XMLElement* child = objectData->FirstChildElement(); + while (child) + { + std::string name = child->Name(); + if (name == "BlendFunc") + { + const tinyxml2::XMLAttribute* battribute = child->FirstAttribute(); + + while (battribute) + { + name = battribute->Name(); + std::string value = battribute->Value(); + + if (name == "Src") + { + blendFunc.src = atoi(value.c_str()); + } + else if (name == "Dst") + { + blendFunc.dst = atoi(value.c_str()); + } + + battribute = battribute->Next(); + } + } + + child = child->NextSiblingElement(); + } + flatbuffers::BlendFunc f_blendFunc(blendFunc.src, blendFunc.dst); + + auto options = CreateBoneOptions(*builder, + nodeOptions, + length, + &f_blendFunc); + + return *(Offset
*)(&options); +} + +void BoneNodeReader::setPropsWithFlatBuffers(cocos2d::Node *node, + const flatbuffers::Table *nodeOptions) +{ + + auto* bone = static_cast(node); + auto options = (flatbuffers::BoneOptions*)nodeOptions; + + float length = options->length(); + bone->setDebugDrawLength(length); + + auto f_blendFunc = options->blendFunc(); + if (f_blendFunc) + { + cocos2d::BlendFunc blendFunc = cocos2d::BlendFunc::ALPHA_PREMULTIPLIED; + blendFunc.src = f_blendFunc->src(); + blendFunc.dst = f_blendFunc->dst(); + bone->setBlendFunc(blendFunc); + } +} + +cocos2d::Node* BoneNodeReader::createNodeWithFlatBuffers(const flatbuffers::Table *nodeOptions) +{ + auto bone = BoneNode::create(); + + // self options + auto options = (flatbuffers::BoneOptions*)nodeOptions; + setPropsWithFlatBuffers(bone, (Table*)options); + + // super options (node) + auto nodeReader = NodeReader::getInstance(); + nodeReader->setPropsWithFlatBuffers(bone, (Table*)options->nodeOptions()); + + return bone; +} diff --git a/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.h b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.h new file mode 100644 index 000000000000..392ecf01c1c1 --- /dev/null +++ b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.h @@ -0,0 +1,53 @@ +/**************************************************************************** +Copyright (c) 2015 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 __BONENODEREADER_H_ +#define __BONENODEREADER_H_ + +#include "cocos2d.h" +#include "cocostudio/WidgetReader/NodeReaderProtocol.h" +#include "cocostudio/WidgetReader/NodeReaderDefine.h" + +class BoneNodeReader : public cocos2d::Ref, public cocostudio::NodeReaderProtocol +{ + DECLARE_CLASS_NODE_READER_INFO + +public: + + BoneNodeReader(); + ~BoneNodeReader(); + + static BoneNodeReader* getInstance(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); + + flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, + flatbuffers::FlatBufferBuilder* builder) override; + void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* boneOptions) override; + + cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* boneOptions) override; +}; + +#endif /* defined(__BONENODEREADER_H_) */ diff --git a/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/CSBoneBinary_generated.h b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/CSBoneBinary_generated.h new file mode 100644 index 000000000000..fbd86d1b9f68 --- /dev/null +++ b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/CSBoneBinary_generated.h @@ -0,0 +1,140 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +#ifndef FLATBUFFERS_GENERATED_CSBONEBINARY_FLATBUFFERS_H_ +#define FLATBUFFERS_GENERATED_CSBONEBINARY_FLATBUFFERS_H_ + +#include "flatbuffers/flatbuffers.h" + +namespace flatbuffers { +struct CSParseBinary; +struct NodeTree; +struct Options; +struct WidgetOptions; +struct LayoutComponentTable; +struct SingleNodeOptions; +struct SpriteOptions; +struct ParticleSystemOptions; +struct GameMapOptions; +struct ButtonOptions; +struct CheckBoxOptions; +struct ImageViewOptions; +struct TextAtlasOptions; +struct TextBMFontOptions; +struct TextOptions; +struct TextFieldOptions; +struct LoadingBarOptions; +struct SliderOptions; +struct PanelOptions; +struct ScrollViewOptions; +struct PageViewOptions; +struct ListViewOptions; +struct ProjectNodeOptions; +struct ComponentOptions; +struct ComAudioOptions; +struct AnimationInfo; +struct NodeAction; +struct TimeLine; +struct Frame; +struct PointFrame; +struct ScaleFrame; +struct ColorFrame; +struct TextureFrame; +struct EventFrame; +struct IntFrame; +struct BoolFrame; +struct InnerActionFrame; +struct EasingData; +struct RotationSkew; +struct Position; +struct Scale; +struct AnchorPoint; +struct Color; +struct ColorVector; +struct FlatSize; +struct CapInsets; +struct BlendFunc; +struct ResourceData; +} // namespace flatbuffers + +namespace flatbuffers { + +struct BoneOptions; +struct SkeletonOptions; + +struct BoneOptions : private flatbuffers::Table { + const flatbuffers::WidgetOptions *nodeOptions() const { return GetPointer(4); } + float length() const { return GetField(6, 0); } + const flatbuffers::BlendFunc *blendFunc() const { return GetStruct(8); } + bool Verify(flatbuffers::Verifier &verifier) const { + return VerifyTableStart(verifier) && + VerifyField(verifier, 4 /* nodeOptions */) && + verifier.VerifyTable(nodeOptions()) && + VerifyField(verifier, 6 /* length */) && + VerifyField(verifier, 8 /* blendFunc */) && + verifier.EndTable(); + } +}; + +struct BoneOptionsBuilder { + flatbuffers::FlatBufferBuilder &fbb_; + flatbuffers::uoffset_t start_; + void add_nodeOptions(flatbuffers::Offset nodeOptions) { fbb_.AddOffset(4, nodeOptions); } + void add_length(float length) { fbb_.AddElement(6, length, 0); } + void add_blendFunc(const flatbuffers::BlendFunc *blendFunc) { fbb_.AddStruct(8, blendFunc); } + BoneOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } + BoneOptionsBuilder &operator=(const BoneOptionsBuilder &); + flatbuffers::Offset Finish() { + auto o = flatbuffers::Offset(fbb_.EndTable(start_, 3)); + return o; + } +}; + +inline flatbuffers::Offset CreateBoneOptions(flatbuffers::FlatBufferBuilder &_fbb, + flatbuffers::Offset nodeOptions = 0, + float length = 0, + const flatbuffers::BlendFunc *blendFunc = 0) { + BoneOptionsBuilder builder_(_fbb); + builder_.add_blendFunc(blendFunc); + builder_.add_length(length); + builder_.add_nodeOptions(nodeOptions); + return builder_.Finish(); +} + +struct SkeletonOptions : private flatbuffers::Table { + const BoneOptions *boneOptions() const { return GetPointer(4); } + bool Verify(flatbuffers::Verifier &verifier) const { + return VerifyTableStart(verifier) && + VerifyField(verifier, 4 /* boneOptions */) && + verifier.VerifyTable(boneOptions()) && + verifier.EndTable(); + } +}; + +struct SkeletonOptionsBuilder { + flatbuffers::FlatBufferBuilder &fbb_; + flatbuffers::uoffset_t start_; + void add_boneOptions(flatbuffers::Offset boneOptions) { fbb_.AddOffset(4, boneOptions); } + SkeletonOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } + SkeletonOptionsBuilder &operator=(const SkeletonOptionsBuilder &); + flatbuffers::Offset Finish() { + auto o = flatbuffers::Offset(fbb_.EndTable(start_, 1)); + return o; + } +}; + +inline flatbuffers::Offset CreateSkeletonOptions(flatbuffers::FlatBufferBuilder &_fbb, + flatbuffers::Offset boneOptions = 0) { + SkeletonOptionsBuilder builder_(_fbb); + builder_.add_boneOptions(boneOptions); + return builder_.Finish(); +} + +inline const BoneOptions *GetBoneOptions(const void *buf) { return flatbuffers::GetRoot(buf); } + +inline bool VerifyBoneOptionsBuffer(flatbuffers::Verifier &verifier) { return verifier.VerifyBuffer(); } + +inline void FinishBoneOptionsBuffer(flatbuffers::FlatBufferBuilder &fbb, flatbuffers::Offset root) { fbb.Finish(root); } + +} // namespace flatbuffers + +#endif // FLATBUFFERS_GENERATED_CSBONEBINARY_FLATBUFFERS_H_ diff --git a/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.cpp new file mode 100644 index 000000000000..9b0244d38d71 --- /dev/null +++ b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +Copyright (c) 2015 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. +****************************************************************************/ + +#include "tinyxml2/tinyxml2.h" +#include "flatbuffers/flatbuffers.h" +#include "cocostudio/WidgetReader/SkeletonReader/CSBoneBinary_generated.h" +#include "cocostudio/WidgetReader/NodeReader/NodeReader.h" +#include "cocostudio/CSParseBinary_generated.h" +#include "cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.h" +#include "cocostudio/ActionTimeline/CCSkeletonNode.h" + +USING_NS_CC; +USING_NS_TIMELINE; +using namespace cocostudio; +using namespace flatbuffers; + +IMPLEMENT_CLASS_NODE_READER_INFO(SkeletonNodeReader) + +SkeletonNodeReader::SkeletonNodeReader() +{ + +} + +SkeletonNodeReader::~SkeletonNodeReader() +{ + +} + +static SkeletonNodeReader* _instanceSkeletonNodeReader = nullptr; + +SkeletonNodeReader* SkeletonNodeReader::getInstance() +{ + if (_instanceSkeletonNodeReader == nullptr) + { + _instanceSkeletonNodeReader = new (std::nothrow) SkeletonNodeReader(); + } + return _instanceSkeletonNodeReader; +} + +void SkeletonNodeReader::destroyInstance() +{ + CC_SAFE_DELETE(_instanceSkeletonNodeReader); +} + +cocos2d::Node* SkeletonNodeReader::createNodeWithFlatBuffers(const flatbuffers::Table *nodeOptions) +{ + auto bone = SkeletonNode::create(); + + // self options + auto options = (flatbuffers::BoneOptions*)nodeOptions; + setPropsWithFlatBuffers(bone, (Table*)options); + + // super options (node) + auto nodeReader = NodeReader::getInstance(); + nodeReader->setPropsWithFlatBuffers(bone, (Table*)options->nodeOptions()); + + return bone; +} diff --git a/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.h b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.h new file mode 100644 index 000000000000..5ac054944d28 --- /dev/null +++ b/cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.h @@ -0,0 +1,47 @@ +/**************************************************************************** +Copyright (c) 2015 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 _SKELETONNODEREADER_H_ +#define _SKELETONNODEREADER_H_ + +#include "cocos2d.h" +#include "cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.h" + +class SkeletonNodeReader : public BoneNodeReader +{ + DECLARE_CLASS_NODE_READER_INFO + +public: + + SkeletonNodeReader(); + ~SkeletonNodeReader(); + + static SkeletonNodeReader* getInstance(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); + + cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* boneOptions) override; +}; +#endif //_SKELETONNODEREADER_H_ \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp index 618811f1c0fb..48ea48db4c20 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp @@ -225,16 +225,12 @@ namespace cocostudio auto fileData = options->fileData(); std::string path = fileData->path()->c_str(); - Sprite3D* ret = NULL; - if(!FileUtils::getInstance()->isFileExist(path)) + Sprite3D* ret = Sprite3D::create(); + if(FileUtils::getInstance()->isFileExist(path)) { - ret = Sprite3D::create(); + ret->initWithFile(path); } - else - { - ret = Sprite3D::create(path); - } - + setPropsWithFlatBuffers(ret, sprite3DOptions); return ret; diff --git a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp index f05bd905f378..7c105e2dfe0d 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp @@ -107,7 +107,8 @@ namespace cocostudio float fov = 60.f; unsigned int cameraFlag = 0; - + bool skyBoxEnabled = false; + std::string attriname; const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute(); while(attribute) @@ -121,17 +122,52 @@ namespace cocostudio } else if(attriname == "UserCameraFlagMode") { - if(value == "DEFAULT") cameraFlag = 1; - else if(value == "USER1") cameraFlag = 1 << 1; - else if(value == "USER2") cameraFlag = 1 << 2; - else if(value == "USER3") cameraFlag = 1 << 3; - else if(value == "USER4") cameraFlag = 1 << 4; + if (cameraFlag == 0) + { + if (value == "DEFAULT") cameraFlag = 1; + else if (value == "USER1") cameraFlag = 1 << 1; + else if (value == "USER2") cameraFlag = 1 << 2; + else if (value == "USER3") cameraFlag = 1 << 3; + else if (value == "USER4") cameraFlag = 1 << 4; + } + } + else if (attriname == "CameraFlagData") + { + cameraFlag = atoi(value.c_str()); + } + else if (attriname == "SkyBoxEnabled") + { + skyBoxEnabled = (value == "True") ? true : false; } attribute = attribute->Next(); } Vec2 clipPlane(1, 1000); + + std::string leftPath = ""; + std::string leftPlistFile = ""; + int leftResourceType = 0; + + std::string rightPath = ""; + std::string rightPlistFile = ""; + int rightResourceType = 0; + + std::string upPath = ""; + std::string upPlistFile = ""; + int upResourceType = 0; + + std::string downPath = ""; + std::string downPlistFile = ""; + int downResourceType = 0; + + std::string forwardPath = ""; + std::string forwardPlistFile = ""; + int forwardResourceType = 0; + + std::string backPath = ""; + std::string backPlistFile = ""; + int backResourceType = 0; // FileData const tinyxml2::XMLElement* child = objectData->FirstChildElement(); @@ -143,7 +179,192 @@ namespace cocostudio { attribute = child->FirstAttribute(); clipPlane = getVec2Attribute(attribute); - break; + } + else if (name == "LeftImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + leftPath = value; + } + else if (name == "Type") + { + leftResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + leftPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (leftResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(leftPlistFile)); + } + } + else if (name == "RightImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + rightPath = value; + } + else if (name == "Type") + { + rightResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + rightPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (rightResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(rightPlistFile)); + } + } + else if (name == "UpImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + upPath = value; + } + else if (name == "Type") + { + upResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + upPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (upResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(upPlistFile)); + } + } + else if (name == "DownImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + downPath = value; + } + else if (name == "Type") + { + downResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + downPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (downResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(downPlistFile)); + } + } + else if (name == "ForwardImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + forwardPath = value; + } + else if (name == "Type") + { + forwardResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + forwardPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (forwardResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(forwardPlistFile)); + } + } + else if (name == "BackImage") + { + attribute = child->FirstAttribute(); + + while (attribute) + { + name = attribute->Name(); + std::string value = attribute->Value(); + + if (name == "Path") + { + backPath = value; + } + else if (name == "Type") + { + backResourceType = getResourceType(value);; + } + else if (name == "Plist") + { + backPlistFile = value; + } + + attribute = attribute->Next(); + } + + if (backResourceType == 1) + { + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + fbs->_textures.push_back(builder->CreateString(backPlistFile)); + } } child = child->NextSiblingElement(); @@ -154,7 +375,32 @@ namespace cocostudio fov, clipPlane.x, clipPlane.y, - cameraFlag + cameraFlag, + skyBoxEnabled, + CreateResourceData(*builder, + builder->CreateString(leftPath), + builder->CreateString(leftPlistFile), + leftResourceType), + CreateResourceData(*builder, + builder->CreateString(rightPath), + builder->CreateString(rightPlistFile), + rightResourceType), + CreateResourceData(*builder, + builder->CreateString(upPath), + builder->CreateString(upPlistFile), + upResourceType), + CreateResourceData(*builder, + builder->CreateString(downPath), + builder->CreateString(downPlistFile), + downResourceType), + CreateResourceData(*builder, + builder->CreateString(forwardPath), + builder->CreateString(forwardPlistFile), + forwardResourceType), + CreateResourceData(*builder, + builder->CreateString(backPath), + builder->CreateString(backPlistFile), + backResourceType) ); return *(Offset
*)(&options); @@ -169,6 +415,21 @@ namespace cocostudio int cameraFlag = options->cameraFlag(); camera->setCameraFlag((CameraFlag)cameraFlag); + bool skyBoxEnabled = options->skyBoxEnabled() != 0; + if (skyBoxEnabled) + { + auto leftFileData = options->leftFileData()->path()->c_str(); + auto rightFileData = options->rightFileData()->path()->c_str(); + auto upFileData = options->upFileData()->path()->c_str(); + auto downFileData = options->downFileData()->path()->c_str(); + auto forwardFileData = options->forwardFileData()->path()->c_str(); + auto backFileData = options->backFileData()->path()->c_str(); + + Skybox* childBox = Skybox::create(leftFileData, rightFileData, upFileData, downFileData, forwardFileData, backFileData); + childBox->setCameraMask(cameraFlag); + node->addChild(childBox,0,"_innerSkyBox"); + } + auto node3DReader = Node3DReader::getInstance(); node3DReader->setPropsWithFlatBuffers(node, (Table*)(options->node3DOption())); } @@ -188,4 +449,22 @@ namespace cocostudio return camera; } + + int UserCameraReader::getResourceType(std::string key) + { + if (key == "Normal" || key == "Default") + { + return 0; + } + + FlatBuffersSerialize* fbs = FlatBuffersSerialize::getInstance(); + if (fbs->_isSimulator) + { + if (key == "MarkedSubImage") + { + return 0; + } + } + return 1; + } } diff --git a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h index 00f920897317..420ca7cfcbc5 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h @@ -56,7 +56,7 @@ namespace cocostudio cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* userCameraOptions); protected: - + int getResourceType(std::string key); cocos2d::Vec2 getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const; }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp index 612f417fec8a..37e8693031cf 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp @@ -5,7 +5,7 @@ #include "cocostudio/CocoLoader.h" #include "ui/UIButton.h" #include "../ActionTimeline/CCActionTimeline.h" -#include "cocostudio/CCObjectExtensionData.h" +#include "cocostudio/CCComExtensionData.h" #include "cocostudio/CSParseBinary_generated.h" #include "tinyxml2.h" @@ -805,10 +805,14 @@ namespace cocostudio std::string customProperty = options->customProperty()->c_str(); - ObjectExtensionData* extensionData = ObjectExtensionData::create(); + ComExtensionData* extensionData = ComExtensionData::create(); extensionData->setCustomProperty(customProperty); extensionData->setActionTag(actionTag); - node->setUserObject(extensionData); + if (node->getComponent("ComExtensionData")) + { + node->removeComponent(extensionData); + } + node->addComponent(extensionData); bool touchEnabled = options->touchEnabled() != 0; widget->setTouchEnabled(touchEnabled); diff --git a/cocos/platform/mac/CCDevice-mac.mm b/cocos/platform/mac/CCDevice-mac.mm index 0fa532d45def..09d6c17a9ebd 100644 --- a/cocos/platform/mac/CCDevice-mac.mm +++ b/cocos/platform/mac/CCDevice-mac.mm @@ -158,20 +158,18 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch CC_BREAK_IF(realDimensions.width <= 0 || realDimensions.height <= 0); CGSize dimensions = CGSizeMake(info->width, info->height); - - - if(dimensions.width <= 0 && dimensions.height <= 0) { - dimensions.width = realDimensions.width; - dimensions.height = realDimensions.height; - } else if (dimensions.height <= 0) { - dimensions.height = realDimensions.height; - } + if(dimensions.width <= 0.f) { + dimensions.width = realDimensions.width; + } + if (dimensions.height <= 0.f) { + dimensions.height = realDimensions.height; + } - NSInteger POTWide = dimensions.width; - NSInteger POTHigh = MAX(dimensions.height, realDimensions.height); - unsigned char* data; + NSInteger POTWide = dimensions.width; + NSInteger POTHigh = dimensions.height; + unsigned char* data = nullptr; + //Alignment - CGFloat xPadding = 0; switch (textAlign) { case NSLeftTextAlignment: xPadding = 0; break; @@ -180,13 +178,16 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch default: break; } - // 1: TOP - // 2: BOTTOM - // 3: CENTER - CGFloat yPadding = (1 == vertFlag || realDimensions.height >= dimensions.height) ? (dimensions.height - realDimensions.height) // align to top - : (2 == vertFlag) ? 0 // align to bottom - : (dimensions.height - realDimensions.height) / 2.0f; // align to center - + CGFloat yPadding = 0.f; + switch (vertFlag) { + // align to top + case 1: yPadding = dimensions.height - realDimensions.height; break; + // align to bottom + case 2: yPadding = 0.f; break; + // align to center + case 3: yPadding = (dimensions.height - realDimensions.height) / 2.0f; break; + default: break; + } NSRect textRect = NSMakeRect(xPadding, POTHigh - dimensions.height + yPadding, realDimensions.width, realDimensions.height); //Disable antialias diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index e3dd619b5dc5..d8505a2a7707 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -1020,9 +1020,11 @@ getRotation3D : function ( /** * @method getNodeToParentAffineTransform - * @return {cc.AffineTransform} - */ -getNodeToParentAffineTransform : function ( +* @param {cc.Node} node +* @return {cc.AffineTransform|cc.AffineTransform} +*/ +getNodeToParentAffineTransform : function( +node ) { return cc.AffineTransform; @@ -1182,9 +1184,11 @@ getChildrenCount : function ( /** * @method getNodeToParentTransform - * @return {mat4_object} - */ -getNodeToParentTransform : function ( +* @param {cc.Node} node +* @return {mat4_object|mat4_object} +*/ +getNodeToParentTransform : function( +node ) { return cc.Mat4; diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js index cfad8eb3dab7..57804d202e81 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_studio_auto_api.js @@ -4413,38 +4413,312 @@ ActionTimeline : function ( }; /** - * @class ObjectExtensionData + * @class BoneNode */ -ccs.ObjectExtensionData = { +ccs.BoneNode = { /** - * @method setActionTag - * @param {int} arg0 + * @method getDebugDrawWidth + * @return {float} */ -setActionTag : function ( +getDebugDrawWidth : function ( +) +{ + return 0; +}, + +/** + * @method getChildBones +* @return {Array|Array} +*/ +getChildBones : function( +) +{ + return new Array(); +}, + +/** + * @method getBlendFunc + * @return {cc.BlendFunc} + */ +getBlendFunc : function ( +) +{ + return cc.BlendFunc; +}, + +/** + * @method getAllSubBones + * @return {Array} + */ +getAllSubBones : function ( +) +{ + return new Array(); +}, + +/** + * @method setBlendFunc + * @param {cc.BlendFunc} arg0 + */ +setBlendFunc : function ( +blendfunc +) +{ +}, + +/** + * @method setDebugDrawEnabled + * @param {bool} arg0 + */ +setDebugDrawEnabled : function ( +bool +) +{ +}, + +/** + * @method getVisibleSkinsRect + * @return {rect_object} + */ +getVisibleSkinsRect : function ( +) +{ + return cc.Rect; +}, + +/** + * @method getAllSubSkins + * @return {Array} + */ +getAllSubSkins : function ( +) +{ + return new Array(); +}, + +/** + * @method displaySkin +* @param {String|cc.Node} str +* @param {bool|bool} bool +*/ +displaySkin : function( +node, +bool +) +{ +}, + +/** + * @method isDebugDrawEnabled + * @return {bool} + */ +isDebugDrawEnabled : function ( +) +{ + return false; +}, + +/** + * @method addSkin +* @param {cc.Node|cc.Node} node +* @param {bool|bool} bool +* @param {bool} bool +*/ +addSkin : function( +node, +bool, +bool +) +{ +}, + +/** + * @method getRootSkeletonNode + * @return {ccs.timeline::SkeletonNode} + */ +getRootSkeletonNode : function ( +) +{ + return ccs.timeline::SkeletonNode; +}, + +/** + * @method setDebugDrawLength + * @param {float} arg0 + */ +setDebugDrawLength : function ( +float +) +{ +}, + +/** + * @method getSkins +* @return {Array|Array} +*/ +getSkins : function( +) +{ + return new Array(); +}, + +/** + * @method getVisibleSkins + * @return {Array} + */ +getVisibleSkins : function ( +) +{ + return new Array(); +}, + +/** + * @method setDebugDrawWidth + * @param {float} arg0 + */ +setDebugDrawWidth : function ( +float +) +{ +}, + +/** + * @method getDebugDrawLength + * @return {float} + */ +getDebugDrawLength : function ( +) +{ + return 0; +}, + +/** + * @method setDebugDrawColor + * @param {color4f_object} arg0 + */ +setDebugDrawColor : function ( +color4f +) +{ +}, + +/** + * @method getDebugDrawColor + * @return {color4f_object} + */ +getDebugDrawColor : function ( +) +{ + return cc.Color4F; +}, + +/** + * @method create +* @param {int} int +* @return {ccs.timeline::BoneNode|ccs.timeline::BoneNode} +*/ +create : function( int ) { + return ccs.timeline::BoneNode; }, /** - * @method setCustomProperty + * @method BoneNode + * @constructor + */ +BoneNode : function ( +) +{ +}, + +}; + +/** + * @class SkeletonNode + */ +ccs.SkeletonNode = { + +/** + * @method getBoneNode * @param {String} arg0 + * @return {ccs.timeline::BoneNode} */ -setCustomProperty : function ( +getBoneNode : function ( str ) { + return ccs.timeline::BoneNode; }, /** - * @method init - * @return {bool} + * @method changeSkins +* @param {String|map_object} str +*/ +changeSkins : function( +map +) +{ +}, + +/** + * @method addSkinGroup + * @param {String} arg0 + * @param {map_object} arg1 */ -init : function ( +addSkinGroup : function ( +str, +map +) +{ +}, + +/** + * @method getAllSubBonesMap + * @return {map_object} + */ +getAllSubBonesMap : function ( +) +{ + return map_object; +}, + +/** + * @method create + * @return {ccs.timeline::SkeletonNode} + */ +create : function ( +) +{ + return ccs.timeline::SkeletonNode; +}, + +/** + * @method SkeletonNode + * @constructor + */ +SkeletonNode : function ( +) +{ +}, + +}; + +/** + * @class ComExtensionData + */ +ccs.ComExtensionData = { + +/** + * @method setActionTag + * @param {int} arg0 + */ +setActionTag : function ( +int ) { - return false; }, /** @@ -4467,21 +4741,31 @@ getActionTag : function ( return 0; }, +/** + * @method setCustomProperty + * @param {String} arg0 + */ +setCustomProperty : function ( +str +) +{ +}, + /** * @method create - * @return {ccs.ObjectExtensionData} + * @return {ccs.ComExtensionData} */ create : function ( ) { - return ccs.ObjectExtensionData; + return ccs.ComExtensionData; }, /** - * @method ObjectExtensionData + * @method ComExtensionData * @constructor */ -ObjectExtensionData : function ( +ComExtensionData : function ( ) { }, diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index d63952cefb82..9bc84ff7be13 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -2654,19 +2654,46 @@ bool js_cocos2dx_Node_getRotation3D(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + bool ok = true; + + JS::RootedObject obj(cx); + cocos2d::Node* cobj = NULL; + obj = args.thisv().toObjectOrNull(); js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); + cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentAffineTransform : Invalid Native Object"); - if (argc == 0) { - cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform(); - jsval jsret = JSVAL_NULL; - jsret = ccaffinetransform_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } + do { + if (argc == 1) { + cocos2d::Node* arg0; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + if (!ok) { ok = true; break; } + cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform(arg0); + jsval jsret = JSVAL_NULL; + jsret = ccaffinetransform_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + } while(0); + + do { + if (argc == 0) { + cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform(); + jsval jsret = JSVAL_NULL; + jsret = ccaffinetransform_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + } while(0); - JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentAffineTransform : wrong number of arguments"); return false; } bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp) @@ -2983,19 +3010,46 @@ bool js_cocos2dx_Node_getChildrenCount(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_Node_getNodeToParentTransform(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + bool ok = true; + + JS::RootedObject obj(cx); + cocos2d::Node* cobj = NULL; + obj = args.thisv().toObjectOrNull(); js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); + cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentTransform : Invalid Native Object"); - if (argc == 0) { - const cocos2d::Mat4& ret = cobj->getNodeToParentTransform(); - jsval jsret = JSVAL_NULL; - jsret = matrix_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } + do { + if (argc == 1) { + cocos2d::Node* arg0; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JSObject *tmpObj = args.get(0).toObjectOrNull(); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + if (!ok) { ok = true; break; } + cocos2d::Mat4 ret = cobj->getNodeToParentTransform(arg0); + jsval jsret = JSVAL_NULL; + jsret = matrix_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + } while(0); + + do { + if (argc == 0) { + const cocos2d::Mat4& ret = cobj->getNodeToParentTransform(); + jsval jsret = JSVAL_NULL; + jsret = matrix_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + } while(0); - JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentTransform : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentTransform : wrong number of arguments"); return false; } bool js_cocos2dx_Node_convertToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp) diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp index 428c4be87235..54c83e209b04 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_studio_auto.hpp @@ -740,19 +740,61 @@ bool js_cocos2dx_studio_ActionTimeline_setCurrentFrame(JSContext *cx, uint32_t a bool js_cocos2dx_studio_ActionTimeline_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_studio_ActionTimeline_ActionTimeline(JSContext *cx, uint32_t argc, jsval *vp); -extern JSClass *jsb_cocostudio_ObjectExtensionData_class; -extern JSObject *jsb_cocostudio_ObjectExtensionData_prototype; - -bool js_cocos2dx_studio_ObjectExtensionData_constructor(JSContext *cx, uint32_t argc, jsval *vp); -void js_cocos2dx_studio_ObjectExtensionData_finalize(JSContext *cx, JSObject *obj); -void js_register_cocos2dx_studio_ObjectExtensionData(JSContext *cx, JS::HandleObject global); -void register_all_cocos2dx_studio(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_studio_ObjectExtensionData_setActionTag(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_studio_ObjectExtensionData_setCustomProperty(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_studio_ObjectExtensionData_init(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_studio_ObjectExtensionData_getCustomProperty(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_studio_ObjectExtensionData_getActionTag(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_studio_ObjectExtensionData_create(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_studio_ObjectExtensionData_ObjectExtensionData(JSContext *cx, uint32_t argc, jsval *vp); +extern JSClass *jsb_cocostudio_timeline_BoneNode_class; +extern JSObject *jsb_cocostudio_timeline_BoneNode_prototype; + +bool js_cocos2dx_studio_BoneNode_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_cocos2dx_studio_BoneNode_finalize(JSContext *cx, JSObject *obj); +void js_register_cocos2dx_studio_BoneNode(JSContext *cx, JS::HandleObject global); +void register_all_cocos2dx_studio(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_studio_BoneNode_getDebugDrawWidth(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getChildBones(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getAllSubBones(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_setDebugDrawEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getVisibleSkinsRect(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getAllSubSkins(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_displaySkin(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_isDebugDrawEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_addSkin(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getRootSkeletonNode(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_setDebugDrawLength(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getSkins(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getVisibleSkins(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_setDebugDrawWidth(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getDebugDrawLength(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_setDebugDrawColor(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_getDebugDrawColor(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_create(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_BoneNode_BoneNode(JSContext *cx, uint32_t argc, jsval *vp); + +extern JSClass *jsb_cocostudio_timeline_SkeletonNode_class; +extern JSObject *jsb_cocostudio_timeline_SkeletonNode_prototype; + +bool js_cocos2dx_studio_SkeletonNode_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_cocos2dx_studio_SkeletonNode_finalize(JSContext *cx, JSObject *obj); +void js_register_cocos2dx_studio_SkeletonNode(JSContext *cx, JS::HandleObject global); +void register_all_cocos2dx_studio(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_studio_SkeletonNode_getBoneNode(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_SkeletonNode_changeSkins(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_SkeletonNode_addSkinGroup(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_SkeletonNode_getAllSubBonesMap(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_SkeletonNode_create(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_SkeletonNode_SkeletonNode(JSContext *cx, uint32_t argc, jsval *vp); + +extern JSClass *jsb_cocostudio_ComExtensionData_class; +extern JSObject *jsb_cocostudio_ComExtensionData_prototype; + +bool js_cocos2dx_studio_ComExtensionData_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_cocos2dx_studio_ComExtensionData_finalize(JSContext *cx, JSObject *obj); +void js_register_cocos2dx_studio_ComExtensionData(JSContext *cx, JS::HandleObject global); +void register_all_cocos2dx_studio(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_studio_ComExtensionData_setActionTag(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_ComExtensionData_getCustomProperty(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_ComExtensionData_getActionTag(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_ComExtensionData_setCustomProperty(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_ComExtensionData_create(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_studio_ComExtensionData_ComExtensionData(JSContext *cx, uint32_t argc, jsval *vp); #endif // __cocos2dx_studio_h__ diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.h b/cocos/scripting/js-bindings/manual/ScriptingCore.h index ddcf8a70ccd1..04d67003f0ae 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.h +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.h @@ -39,7 +39,7 @@ #include #include -#define ENGINE_VERSION "Cocos2d-JS v3.7" +#define ENGINE_VERSION "Cocos2d-JS v3.7.1" void js_log(const char *format, ...); diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp index ade4dcc2ae50..e3c026cc2d9b 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp @@ -1692,6 +1692,61 @@ bool jsval_to_vector_v3fc4bt2f(JSContext* cx, JS::HandleValue v, std::vector* ret) +{ + if (v.isNullOrUndefined()) + { + return true; + } + + JS::RootedObject tmp(cx, v.toObjectOrNull()); + if (!tmp) + { + CCLOG("%s", "jsval_to_std_map_string_string: the jsval is not an object."); + return false; + } + + JS::RootedObject it(cx, JS_NewPropertyIterator(cx, tmp)); + + std::map& dict = *ret; + + while (true) + { + JS::RootedId idp(cx); + JS::RootedValue key(cx); + if (! JS_NextProperty(cx, it, idp.address()) || ! JS_IdToValue(cx, idp, &key)) + { + return false; // error + } + + if (key.isNullOrUndefined()) + { + break; // end of iteration + } + + if (!key.isString()) + { + continue; // only take account of string key + } + + JSStringWrapper keyWrapper(key.toString(), cx); + + JS::RootedValue value(cx); + JS_GetPropertyById(cx, tmp, idp, &value); + if (value.isString()) + { + JSStringWrapper valueWapper(value.toString(), cx); + dict[keyWrapper.get()] = valueWapper.get(); + } + else + { + CCASSERT(false, "jsval_to_std_map_string_string: not supported map type"); + } + } + + return true; +} + // native --> jsval jsval ccarray_to_jsval(JSContext* cx, __Array *arr) @@ -2763,4 +2818,27 @@ jsval vector_vec2_to_jsval(JSContext *cx, const std::vector& v) ++i; } return OBJECT_TO_JSVAL(jsretArr); +} + +jsval std_map_string_string_to_jsval(JSContext* cx, const std::map& v) +{ + JS::RootedObject proto(cx); + JS::RootedObject parent(cx); + JS::RootedObject jsRet(cx, JS_NewObject(cx, NULL, proto, parent)); + + for (auto iter = v.begin(); iter != v.end(); ++iter) + { + JS::RootedValue element(cx); + + std::string key = iter->first; + std::string obj = iter->second; + + element = std_string_to_jsval(cx, obj); + + if (!key.empty()) + { + JS_SetProperty(cx, jsRet, key.c_str(), element); + } + } + return OBJECT_TO_JSVAL(jsRet); } \ No newline at end of file diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.h b/cocos/scripting/js-bindings/manual/js_manual_conversions.h index 7c2f6cc14f32..584fea58c914 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.h +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.h @@ -192,6 +192,7 @@ bool jsval_to_cctex2f(JSContext* cx, JS::HandleValue vp, cocos2d::Tex2F* ret); bool jsval_to_v3fc4bt2f(JSContext* cx, JS::HandleValue v, cocos2d::V3F_C4B_T2F* ret); bool jsval_to_v3fc4bt2f_quad(JSContext* cx, JS::HandleValue v, cocos2d::V3F_C4B_T2F_Quad* ret); bool jsval_to_vector_v3fc4bt2f(JSContext* cx, JS::HandleValue v, std::vector* ret); +bool jsval_to_std_map_string_string(JSContext* cx, JS::HandleValue v, std::map* ret); template bool jsval_to_ccmap_string_key(JSContext *cx, JS::HandleValue v, cocos2d::Map* ret) @@ -340,6 +341,7 @@ jsval vector3_to_jsval(JSContext *cx, const cocos2d::Vec3& v); jsval vector4_to_jsval(JSContext *cx, const cocos2d::Vec4& v); jsval blendfunc_to_jsval(JSContext *cx, const cocos2d::BlendFunc& v); jsval vector_vec2_to_jsval(JSContext *cx, const std::vector& v); +jsval std_map_string_string_to_jsval(JSContext* cx, const std::map& v); #endif /* __JS_MANUAL_CONVERSIONS_H__ */ diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj index 92fc15ac5cd8..96cda7a2c999 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj @@ -206,4 +206,4 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*" - \ No newline at end of file + diff --git a/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/cocos/scripting/js-bindings/script/jsb_cocos2d.js index 1cbe3f1c0e8d..c0e393c41755 100644 --- a/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -26,7 +26,7 @@ // CCConfig.js // -cc.ENGINE_VERSION = "Cocos2d-JS v3.7"; +cc.ENGINE_VERSION = "Cocos2d-JS v3.7.1"; cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0; cc.DIRECTOR_STATS_POSITION = {x: 0, y: 0}; @@ -2482,6 +2482,26 @@ cc.affineTransformConcat = function (t1, t2) { ty: t1.tx * t2.b + t1.ty * t2.d + t2.ty}; //ty }; +/** + * Concatenate a transform matrix to another
+ * The results are reflected in the first matrix.
+ * t' = t1 * t2 + * @function + * @param {cc.AffineTransform} t1 The first transform object + * @param {cc.AffineTransform} t2 The transform object to concatenate + * @return {cc.AffineTransform} The result of concatenation + */ +cc.affineTransformConcatIn = function (t1, t2) { + var a = t1.a, b = t1.b, c = t1.c, d = t1.d, tx = t1.tx, ty = t1.ty; + t1.a = a * t2.a + b * t2.c; + t1.b = a * t2.b + b * t2.d; + t1.c = c * t2.a + d * t2.c; + t1.d = c * t2.b + d * t2.d; + t1.tx = tx * t2.a + ty * t2.c + t2.tx; + t1.ty = tx * t2.b + ty * t2.d + t2.ty; + return t1; +}; + /** * Return true if `t1' and `t2' are equal, false otherwise. * @memberOf cc diff --git a/cocos/scripting/js-bindings/script/studio/jsb_studio_boot.js b/cocos/scripting/js-bindings/script/studio/jsb_studio_boot.js index 033ee6999f03..e64312fc7efd 100644 --- a/cocos/scripting/js-bindings/script/studio/jsb_studio_boot.js +++ b/cocos/scripting/js-bindings/script/studio/jsb_studio_boot.js @@ -66,4 +66,8 @@ ccs.Sprite.extend = ccs.Sprite.extend || cc.Sprite.extend; * @extends ccs.Class */ ccs.Component = ccs.Component || cc.Component; -ccs.Component.extend = ccs.Component.extend || cc.Component.extend; \ No newline at end of file +ccs.Component.extend = ccs.Component.extend || cc.Component.extend; + +ccs.SkinNode = cc.Node; +ccs.BoneNode.extend = cc.Class.extend; +ccs.SkeletonNode.extend = cc.Class.extend; \ No newline at end of file diff --git a/cocos/scripting/js-bindings/script/studio/jsb_studio_create_apis.js b/cocos/scripting/js-bindings/script/studio/jsb_studio_create_apis.js index 55ee7b08ac76..e477d4025b92 100644 --- a/cocos/scripting/js-bindings/script/studio/jsb_studio_create_apis.js +++ b/cocos/scripting/js-bindings/script/studio/jsb_studio_create_apis.js @@ -61,8 +61,8 @@ ccs.Skin.prototype._ctor = function(fileName, rect) { if(fileName[0] == "#"){ ccs.Skin.prototype.initWithSpriteFrameName.call(this, fileName.substr(1)); } else { - rect ? ccs.Skin.prototype.initWithFile.call(this, fileName) - : ccs.Skin.prototype.initWithFile.call(this, fileName, rect); + rect ? ccs.Skin.prototype.initWithFile.call(this, fileName, rect) + : ccs.Skin.prototype.initWithFile.call(this, fileName); } } }; @@ -98,6 +98,15 @@ ccs.ActionTimelineData.prototype._ctor = function(actionTag) { } }; -ccs.ObjectExtensionData.prototype._ctor = function() { - ccs.ObjectExtensionData.prototype.init.call(this); +ccs.ComExtensionData.prototype._ctor = function() { + ccs.ComExtensionData.prototype.init.call(this); +}; + +ccs.BoneNode.prototype._ctor = function (length) { + ccs.BoneNode.prototype.init.call(this); + length !== undefined && this.setDebugDrawLength(length); +}; + +ccs.SkeletonNode.prototype._ctor = function () { + ccs.SkeletonNode.prototype.init.call(this); }; \ No newline at end of file diff --git a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js index 5672333e08bf..0957cfb85312 100644 --- a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js +++ b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js @@ -112,12 +112,16 @@ node.setTag(json["Tag"] || 0); var actionTag = json["ActionTag"] || 0; - var extensionData = new ccs.ObjectExtensionData(); + var extensionData = new ccs.ComExtensionData(); var customProperty = json["UserData"]; if(customProperty !== undefined) extensionData.setCustomProperty(customProperty); extensionData.setActionTag(actionTag); - node.setUserObject(extensionData); + if (node.getComponent("ComExtensionData")) + { + node.removeComponent("ComExtensionData"); + } + node.addComponent(extensionData); node.setCascadeColorEnabled(true); node.setCascadeOpacityEnabled(true); @@ -152,6 +156,13 @@ } }; + var getSkyboxRes = function(json, key) { + if(json.hasOwnProperty(key) && json[key].hasOwnProperty("Path")) { + return json[key]["Path"]; + } + return ""; + } + /** * SingleNode * @param json @@ -165,6 +176,25 @@ if(color != null) node.setColor(getColor(color)); + if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"]) + { + var leftFileData = getSkyboxRes(json, "LeftImage"); + var rightFileData = getSkyboxRes(json, "RightImage"); + var upFileData = getSkyboxRes(json, "UpImage"); + var downFileData = getSkyboxRes(json, "DownImage"); + var forwardFileData = getSkyboxRes(json, "ForwardImage"); + var backFileData = getSkyboxRes(json, "BackImage"); + var cameraFlag = json["SkyBoxMask"]; + if(undefined === cameraFlag || isNaN(cameraFlag)) { + cameraFlag = 1024; + } + + var skyBox = new jsb.Skybox(); + skyBox.init(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData); + skyBox.setCameraMask(cameraFlag, false); + node.addChild(skyBox); + } + return node; }; @@ -258,12 +288,16 @@ var actionTag = json["ActionTag"] || 0; widget.setActionTag(actionTag); - var extensionData = new ccs.ObjectExtensionData(); + var extensionData = new ccs.ComExtensionData(); var customProperty = json["UserData"]; if(customProperty !== undefined) extensionData.setCustomProperty(customProperty); extensionData.setActionTag(actionTag); - widget.setUserObject(extensionData); + if (widget.getComponent("ComExtensionData")) + { + widget.removeComponent("ComExtensionData"); + } + widget.addComponent(extensionData); var rotationSkewX = json["RotationSkewX"]; if (rotationSkewX) @@ -1151,15 +1185,13 @@ */ parser.initSimpleAudio = function(json, resourcePath){ + var node = new ccs.ComAudio(); var loop = json["Loop"] || false; - var volume = json["Volume"] || 0; - cc.audioEngine.setMusicVolume(volume); - //var name = json["Name"]; - + //var volume = json["Volume"] || 0; + //cc.audioEngine.setMusicVolume(volume); + node.setLoop(loop); loadTexture(json["FileData"], resourcePath, function(path, type){ - cc.loader.load(path, function(){ - cc.audioEngine.playMusic(path, loop); - }); + node.setFile(path); }); }; @@ -1265,6 +1297,28 @@ return node; }; + parser.initBoneNode = function(json, resourcePath){ + + var node = new ccs.BoneNode(); + + var length = json["Length"]; + if(length !== undefined) + node.setDebugDrawLength(length); + + var blendFunc = json["BlendFunc"]; + if(blendFunc) + node.setBlendFunc(new cc.BlendFunc(blendFunc["Src"] || 0, blendFunc["Dst"] || 0)); + + parser.generalAttributes(node, json); + return node; + }; + + parser.initSkeletonNode = function(json){ + var node = new ccs.SkeletonNode(); + parser.generalAttributes(node, json); + return node; + }; + var loadedPlist = {}; var loadTexture = function(json, resourcePath, cb){ if(json != null){ @@ -1408,28 +1462,49 @@ this.general3DAttributes(node, json); var camMode = json["UserCameraFlagMode"]; - switch(camMode){ - case "USER1": - node.setCameraFlag(cc.CameraFlag.USER1); break; - case "USER2": - node.setCameraFlag(cc.CameraFlag.USER2); break; - case "USER3": - node.setCameraFlag(cc.CameraFlag.USER3); break; - case "USER4": - node.setCameraFlag(cc.CameraFlag.USER4); break; - case "USER5": - node.setCameraFlag(cc.CameraFlag.USER5); break; - case "USER6": - node.setCameraFlag(cc.CameraFlag.USER6); break; - case "USER7": - node.setCameraFlag(cc.CameraFlag.USER7); break; - case "USER8": - node.setCameraFlag(cc.CameraFlag.USER8); break; - case "DEFAULT": - node.setCameraFlag(cc.CameraFlag.DEFAULT); break; - default: - node.setCameraFlag(cc.CameraFlag.USER1); + var cameraFlagData = json["CameraFlagData"]; + var cameraFlag = cc.CameraFlag.USER1; + if(undefined === cameraFlagData || isNaN(cameraFlagData) || 0 === cameraFlagData) + { + switch(camMode){ + case "USER1": + cameraFlag = cc.CameraFlag.USER1; break; + case "USER2": + cameraFlag = cc.CameraFlag.USER2; break; + case "USER3": + cameraFlag = cc.CameraFlag.USER3; break; + case "USER4": + cameraFlag = cc.CameraFlag.USER4; break; + case "USER5": + cameraFlag = cc.CameraFlag.USER5; break; + case "USER6": + cameraFlag = cc.CameraFlag.USER6; break; + case "USER7": + cameraFlag = cc.CameraFlag.USER7; break; + case "USER8": + cameraFlag = cc.CameraFlag.USER8; break; + case "DEFAULT": + cameraFlag = cc.CameraFlag.DEFAULT; break; + } + } else { + cameraFlag = cameraFlagData; } + node.setCameraFlag(cameraFlag); + } + + if(json.hasOwnProperty("SkyBoxEnabled") && true == json["SkyBoxEnabled"]) + { + var leftFileData = getSkyboxRes(json, "LeftImage"); + var rightFileData = getSkyboxRes(json, "RightImage"); + var upFileData = getSkyboxRes(json, "UpImage"); + var downFileData = getSkyboxRes(json, "DownImage"); + var forwardFileData = getSkyboxRes(json, "ForwardImage"); + var backFileData = getSkyboxRes(json, "BackImage"); + + var skyBox = new jsb.Skybox(); + skyBox.init(leftFileData,rightFileData,upFileData,downFileData,forwardFileData,backFileData); + skyBox.setCameraMask(cameraFlag); + node.addChild(skyBox); } return node; @@ -1526,6 +1601,8 @@ {name: "GameMapObjectData", handle: parser.initGameMap}, {name: "ProjectNodeObjectData", handle: parser.initProjectNode}, {name: "ArmatureNodeObjectData", handle: parser.initArmature}, + {name: "BoneNodeObjectData", handle: parser.initBoneNode}, + {name: "SkeletonNodeObjectData", handle: parser.initSkeletonNode}, {name: "Sprite3DObjectData", handle: parser.initSprite3D}, {name: "Particle3DObjectData", handle: parser.initParticle3D}, diff --git a/cocos/scripting/lua-bindings/auto/api/BoneNode.lua b/cocos/scripting/lua-bindings/auto/api/BoneNode.lua new file mode 100644 index 000000000000..85c1c0b0cdb6 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/BoneNode.lua @@ -0,0 +1,223 @@ + +-------------------------------- +-- @module BoneNode +-- @extend Node,BlendProtocol +-- @parent_module ccs + +-------------------------------- +-- +-- @function [parent=#BoneNode] getDebugDrawWidth +-- @param self +-- @return float#float ret (return value: float) + +-------------------------------- +-- @overload self +-- @overload self +-- @function [parent=#BoneNode] getChildBones +-- @param self +-- @return array_table#array_table ret (return value: array_table) + +-------------------------------- +-- +-- @function [parent=#BoneNode] getBlendFunc +-- @param self +-- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc) + +-------------------------------- +-- brief: get all bones in this bone tree +-- @function [parent=#BoneNode] getAllSubBones +-- @param self +-- @return array_table#array_table ret (return value: array_table) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setBlendFunc +-- @param self +-- @param #cc.BlendFunc blendFunc +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setDebugDrawEnabled +-- @param self +-- @param #bool isDebugDraw +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- get displayings rect in self transform +-- @function [parent=#BoneNode] getVisibleSkinsRect +-- @param self +-- @return rect_table#rect_table ret (return value: rect_table) + +-------------------------------- +-- brief: get all skins in this bone tree +-- @function [parent=#BoneNode] getAllSubSkins +-- @param self +-- @return array_table#array_table ret (return value: array_table) + +-------------------------------- +-- @overload self, string, bool +-- @overload self, cc.Node, bool +-- @function [parent=#BoneNode] displaySkin +-- @param self +-- @param #cc.Node skin +-- @param #bool hideOthers +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] isDebugDrawEnabled +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- @overload self, cc.Node, bool, bool +-- @overload self, cc.Node, bool +-- @function [parent=#BoneNode] addSkin +-- @param self +-- @param #cc.Node skin +-- @param #bool display +-- @param #bool hideOthers +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] getRootSkeletonNode +-- @param self +-- @return SkeletonNode#SkeletonNode ret (return value: ccs.SkeletonNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setDebugDrawLength +-- @param self +-- @param #float length +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- @overload self +-- @overload self +-- @function [parent=#BoneNode] getSkins +-- @param self +-- @return array_table#array_table ret (return value: array_table) + +-------------------------------- +-- +-- @function [parent=#BoneNode] getVisibleSkins +-- @param self +-- @return array_table#array_table ret (return value: array_table) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setDebugDrawWidth +-- @param self +-- @param #float width +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] getDebugDrawLength +-- @param self +-- @return float#float ret (return value: float) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setDebugDrawColor +-- @param self +-- @param #color4f_table color +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] getDebugDrawColor +-- @param self +-- @return color4f_table#color4f_table ret (return value: color4f_table) + +-------------------------------- +-- @overload self, int +-- @overload self +-- @function [parent=#BoneNode] create +-- @param self +-- @param #int length +-- @return BoneNode#BoneNode ret (return value: ccs.BoneNode) + +-------------------------------- +-- @overload self, cc.Node, int, int +-- @overload self, cc.Node, int, string +-- @function [parent=#BoneNode] addChild +-- @param self +-- @param #cc.Node child +-- @param #int localZOrder +-- @param #string name +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] draw +-- @param self +-- @param #cc.Renderer renderer +-- @param #mat4_table transform +-- @param #unsigned int flags +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setName +-- @param self +-- @param #string name +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setAnchorPoint +-- @param self +-- @param #vec2_table anchorPoint +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setLocalZOrder +-- @param self +-- @param #int localZOrder +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] removeChild +-- @param self +-- @param #cc.Node child +-- @param #bool cleanup +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] init +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- +-- @function [parent=#BoneNode] getBoundingBox +-- @param self +-- @return rect_table#rect_table ret (return value: rect_table) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setContentSize +-- @param self +-- @param #size_table contentSize +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] setVisible +-- @param self +-- @param #bool visible +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +-------------------------------- +-- +-- @function [parent=#BoneNode] BoneNode +-- @param self +-- @return BoneNode#BoneNode self (return value: ccs.BoneNode) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/ComExtensionData.lua b/cocos/scripting/lua-bindings/auto/api/ComExtensionData.lua new file mode 100644 index 000000000000..bd2022d55e76 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/ComExtensionData.lua @@ -0,0 +1,71 @@ + +-------------------------------- +-- @module ComExtensionData +-- @extend Component +-- @parent_module ccs + +-------------------------------- +-- +-- @function [parent=#ComExtensionData] setActionTag +-- @param self +-- @param #int actionTag +-- @return ComExtensionData#ComExtensionData self (return value: ccs.ComExtensionData) + +-------------------------------- +-- +-- @function [parent=#ComExtensionData] getCustomProperty +-- @param self +-- @return string#string ret (return value: string) + +-------------------------------- +-- +-- @function [parent=#ComExtensionData] getActionTag +-- @param self +-- @return int#int ret (return value: int) + +-------------------------------- +-- +-- @function [parent=#ComExtensionData] setCustomProperty +-- @param self +-- @param #string customProperty +-- @return ComExtensionData#ComExtensionData self (return value: ccs.ComExtensionData) + +-------------------------------- +-- +-- @function [parent=#ComExtensionData] create +-- @param self +-- @return ComExtensionData#ComExtensionData ret (return value: ccs.ComExtensionData) + +-------------------------------- +-- +-- @function [parent=#ComExtensionData] createInstance +-- @param self +-- @return Ref#Ref ret (return value: cc.Ref) + +-------------------------------- +-- +-- @function [parent=#ComExtensionData] init +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- js NA
+-- lua NA +-- @function [parent=#ComExtensionData] onRemove +-- @param self +-- @return ComExtensionData#ComExtensionData self (return value: ccs.ComExtensionData) + +-------------------------------- +-- js NA
+-- lua NA +-- @function [parent=#ComExtensionData] onAdd +-- @param self +-- @return ComExtensionData#ComExtensionData self (return value: ccs.ComExtensionData) + +-------------------------------- +-- +-- @function [parent=#ComExtensionData] ComExtensionData +-- @param self +-- @return ComExtensionData#ComExtensionData self (return value: ccs.ComExtensionData) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Node.lua b/cocos/scripting/lua-bindings/auto/api/Node.lua index cafaffb4fb30..406ac0a66eba 100644 --- a/cocos/scripting/lua-bindings/auto/api/Node.lua +++ b/cocos/scripting/lua-bindings/auto/api/Node.lua @@ -353,11 +353,13 @@ -- @return Node#Node self (return value: cc.Node) -------------------------------- --- --- @function [parent=#Node] getNodeToParentAffineTransform +-- @overload self, cc.Node +-- @overload self +-- @function [parent=#Node] getNodeToParentAffineTransform -- @param self +-- @param #cc.Node ancestor -- @return AffineTransform#AffineTransform ret (return value: cc.AffineTransform) - + -------------------------------- -- -- @function [parent=#Node] isCascadeOpacityEnabled @@ -396,13 +398,13 @@ -- @return vec3_table#vec3_table ret (return value: vec3_table) -------------------------------- --- Returns the matrix that transform the node's (local) space coordinates into the parent's space coordinates.
--- The matrix is in Pixels.
--- return The transformation matrix. --- @function [parent=#Node] getNodeToParentTransform +-- @overload self, cc.Node +-- @overload self +-- @function [parent=#Node] getNodeToParentTransform -- @param self +-- @param #cc.Node ancestor -- @return mat4_table#mat4_table ret (return value: mat4_table) - + -------------------------------- -- converts a Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).
-- param touch A given touch.
diff --git a/cocos/scripting/lua-bindings/auto/api/SkeletonNode.lua b/cocos/scripting/lua-bindings/auto/api/SkeletonNode.lua new file mode 100644 index 000000000000..f2059d3ac048 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/SkeletonNode.lua @@ -0,0 +1,62 @@ + +-------------------------------- +-- @module SkeletonNode +-- @extend BoneNode +-- @parent_module ccs + +-------------------------------- +-- get bonenode in skeleton node by bone name +-- @function [parent=#SkeletonNode] getBoneNode +-- @param self +-- @param #string boneName +-- @return BoneNode#BoneNode ret (return value: ccs.BoneNode) + +-------------------------------- +-- @overload self, string +-- @overload self, map_table +-- @function [parent=#SkeletonNode] changeSkins +-- @param self +-- @param #map_table boneSkinNameMap +-- @return SkeletonNode#SkeletonNode self (return value: ccs.SkeletonNode) + +-------------------------------- +-- brief: add a boneSkinNameMap as a SkinGroup named groupName
+-- param: groupName, key
+-- param: boneSkinNameMap, map +-- @function [parent=#SkeletonNode] addSkinGroup +-- @param self +-- @param #string groupName +-- @param #map_table boneSkinNameMap +-- @return SkeletonNode#SkeletonNode self (return value: ccs.SkeletonNode) + +-------------------------------- +-- get All bones in this skeleton, +-- @function [parent=#SkeletonNode] getAllSubBonesMap +-- @param self +-- @return map_table#map_table ret (return value: map_table) + +-------------------------------- +-- +-- @function [parent=#SkeletonNode] create +-- @param self +-- @return SkeletonNode#SkeletonNode ret (return value: ccs.SkeletonNode) + +-------------------------------- +-- +-- @function [parent=#SkeletonNode] getBoundingBox +-- @param self +-- @return rect_table#rect_table ret (return value: rect_table) + +-------------------------------- +-- +-- @function [parent=#SkeletonNode] init +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- +-- @function [parent=#SkeletonNode] SkeletonNode +-- @param self +-- @return SkeletonNode#SkeletonNode self (return value: ccs.SkeletonNode) + +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 1e8459650927..0969800bef41 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 @@ -276,4 +276,19 @@ -- @field [parent=#ccs] ActionTimelineNode#ActionTimelineNode ActionTimelineNode preloaded module +-------------------------------------------------------- +-- the ccs BoneNode +-- @field [parent=#ccs] BoneNode#BoneNode BoneNode preloaded module + + +-------------------------------------------------------- +-- the ccs SkeletonNode +-- @field [parent=#ccs] SkeletonNode#SkeletonNode SkeletonNode preloaded module + + +-------------------------------------------------------- +-- the ccs ComExtensionData +-- @field [parent=#ccs] ComExtensionData#ComExtensionData ComExtensionData 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 66116ac952c9..f0dc62249745 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -4941,39 +4941,43 @@ int lua_cocos2dx_Node_getNodeToParentAffineTransform(lua_State* tolua_S) int argc = 0; cocos2d::Node* 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.Node",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_getNodeToParentAffineTransform'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_getNodeToParentAffineTransform'", nullptr); - return 0; + do{ + if (argc == 1) { + cocos2d::Node* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.Node:getNodeToParentAffineTransform"); + + if (!ok) { break; } + cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform(arg0); + affinetransform_to_luaval(tolua_S, ret); + return 1; } - cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform(); - affinetransform_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:getNodeToParentAffineTransform",argc, 0); + }while(0); + ok = true; + do{ + if (argc == 0) { + cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform(); + affinetransform_to_luaval(tolua_S, ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:getNodeToParentAffineTransform",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 @@ -5226,39 +5230,43 @@ int lua_cocos2dx_Node_getNodeToParentTransform(lua_State* tolua_S) int argc = 0; cocos2d::Node* 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.Node",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_getNodeToParentTransform'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Node_getNodeToParentTransform'", nullptr); - return 0; + do{ + if (argc == 1) { + cocos2d::Node* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.Node:getNodeToParentTransform"); + + if (!ok) { break; } + cocos2d::Mat4 ret = cobj->getNodeToParentTransform(arg0); + mat4_to_luaval(tolua_S, ret); + return 1; } - const cocos2d::Mat4& ret = cobj->getNodeToParentTransform(); - mat4_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:getNodeToParentTransform",argc, 0); + }while(0); + ok = true; + do{ + if (argc == 0) { + const cocos2d::Mat4& ret = cobj->getNodeToParentTransform(); + mat4_to_luaval(tolua_S, ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Node:getNodeToParentTransform",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 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 ac4bfc445785..21581cf59e69 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.cpp @@ -1,5 +1,6 @@ #include "lua_cocos2dx_studio_auto.hpp" #include "CocoStudio.h" +#include "CCComExtensionData.h" #include "lua-cocos-studio-conversions.h" #include "tolua_fix.h" #include "LuaBasicConversions.h" @@ -22699,6 +22700,1698 @@ int lua_register_cocos2dx_studio_ActionTimelineNode(lua_State* tolua_S) g_typeCast["ActionTimelineNode"] = "ccs.ActionTimelineNode"; return 1; } + +int lua_cocos2dx_studio_BoneNode_getDebugDrawWidth(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawWidth'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawWidth'", nullptr); + return 0; + } + double ret = cobj->getDebugDrawWidth(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getDebugDrawWidth",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawWidth'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getChildBones(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getChildBones'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 0) { + cocos2d::Vector& ret = cobj->getChildBones(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 0) { + const cocos2d::Vector& ret = cobj->getChildBones(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getChildBones",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getChildBones'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getBlendFunc'", nullptr); + return 0; + } + const cocos2d::BlendFunc& ret = cobj->getBlendFunc(); + blendfunc_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getBlendFunc",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getBlendFunc'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getAllSubBones(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getAllSubBones'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getAllSubBones'", nullptr); + return 0; + } + cocos2d::Vector ret = cobj->getAllSubBones(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getAllSubBones",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getAllSubBones'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_setBlendFunc(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_setBlendFunc'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::BlendFunc arg0; + + ok &= luaval_to_blendfunc(tolua_S, 2, &arg0, "ccs.BoneNode:setBlendFunc"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_setBlendFunc'", nullptr); + return 0; + } + cobj->setBlendFunc(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:setBlendFunc",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_setBlendFunc'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_setDebugDrawEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccs.BoneNode:setDebugDrawEnabled"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawEnabled'", nullptr); + return 0; + } + cobj->setDebugDrawEnabled(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:setDebugDrawEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getVisibleSkinsRect(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getVisibleSkinsRect'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getVisibleSkinsRect'", nullptr); + return 0; + } + cocos2d::Rect ret = cobj->getVisibleSkinsRect(); + rect_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getVisibleSkinsRect",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getVisibleSkinsRect'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getAllSubSkins(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getAllSubSkins'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getAllSubSkins'", nullptr); + return 0; + } + cocos2d::Vector ret = cobj->getAllSubSkins(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getAllSubSkins",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getAllSubSkins'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_displaySkin(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_displaySkin'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.BoneNode:displaySkin"); + + if (!ok) { break; } + bool arg1; + ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccs.BoneNode:displaySkin"); + + if (!ok) { break; } + cobj->displaySkin(arg0, arg1); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 2) { + cocos2d::Node* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "ccs.BoneNode:displaySkin"); + + if (!ok) { break; } + bool arg1; + ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccs.BoneNode:displaySkin"); + + if (!ok) { break; } + cobj->displaySkin(arg0, arg1); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:displaySkin",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_displaySkin'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_isDebugDrawEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_isDebugDrawEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_isDebugDrawEnabled'", nullptr); + return 0; + } + bool ret = cobj->isDebugDrawEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:isDebugDrawEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_isDebugDrawEnabled'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_addSkin(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_addSkin'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 3) { + cocos2d::Node* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "ccs.BoneNode:addSkin"); + + if (!ok) { break; } + bool arg1; + ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccs.BoneNode:addSkin"); + + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "ccs.BoneNode:addSkin"); + + if (!ok) { break; } + cobj->addSkin(arg0, arg1, arg2); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 2) { + cocos2d::Node* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "ccs.BoneNode:addSkin"); + + if (!ok) { break; } + bool arg1; + ok &= luaval_to_boolean(tolua_S, 3,&arg1, "ccs.BoneNode:addSkin"); + + if (!ok) { break; } + cobj->addSkin(arg0, arg1); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:addSkin",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_addSkin'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getRootSkeletonNode(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getRootSkeletonNode'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getRootSkeletonNode'", nullptr); + return 0; + } + cocostudio::timeline::SkeletonNode* ret = cobj->getRootSkeletonNode(); + object_to_luaval(tolua_S, "ccs.SkeletonNode",(cocostudio::timeline::SkeletonNode*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getRootSkeletonNode",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getRootSkeletonNode'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_setDebugDrawLength(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawLength'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0, "ccs.BoneNode:setDebugDrawLength"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawLength'", nullptr); + return 0; + } + cobj->setDebugDrawLength(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:setDebugDrawLength",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawLength'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getSkins(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getSkins'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 0) { + cocos2d::Vector& ret = cobj->getSkins(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 0) { + const cocos2d::Vector& ret = cobj->getSkins(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getSkins",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getSkins'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getVisibleSkins(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getVisibleSkins'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getVisibleSkins'", nullptr); + return 0; + } + cocos2d::Vector ret = cobj->getVisibleSkins(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getVisibleSkins",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getVisibleSkins'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_setDebugDrawWidth(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawWidth'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0, "ccs.BoneNode:setDebugDrawWidth"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawWidth'", nullptr); + return 0; + } + cobj->setDebugDrawWidth(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:setDebugDrawWidth",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawWidth'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getDebugDrawLength(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawLength'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawLength'", nullptr); + return 0; + } + double ret = cobj->getDebugDrawLength(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getDebugDrawLength",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawLength'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_setDebugDrawColor(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawColor'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Color4F arg0; + + ok &=luaval_to_color4f(tolua_S, 2, &arg0, "ccs.BoneNode:setDebugDrawColor"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawColor'", nullptr); + return 0; + } + cobj->setDebugDrawColor(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:setDebugDrawColor",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_setDebugDrawColor'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_getDebugDrawColor(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* 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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::BoneNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawColor'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawColor'", nullptr); + return 0; + } + cocos2d::Color4F ret = cobj->getDebugDrawColor(); + color4f_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:getDebugDrawColor",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_getDebugDrawColor'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_BoneNode_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.BoneNode",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S)-1; + + do + { + if (argc == 1) + { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccs.BoneNode:create"); + if (!ok) { break; } + cocostudio::timeline::BoneNode* ret = cocostudio::timeline::BoneNode::create(arg0); + object_to_luaval(tolua_S, "ccs.BoneNode",(cocostudio::timeline::BoneNode*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 0) + { + cocostudio::timeline::BoneNode* ret = cocostudio::timeline::BoneNode::create(); + object_to_luaval(tolua_S, "ccs.BoneNode",(cocostudio::timeline::BoneNode*)ret); + return 1; + } + } while (0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "ccs.BoneNode:create",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_create'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_studio_BoneNode_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::BoneNode* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_BoneNode_constructor'", nullptr); + return 0; + } + cobj = new cocostudio::timeline::BoneNode(); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"ccs.BoneNode"); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.BoneNode:BoneNode",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_BoneNode_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_studio_BoneNode_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (BoneNode)"); + return 0; +} + +int lua_register_cocos2dx_studio_BoneNode(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"ccs.BoneNode"); + tolua_cclass(tolua_S,"BoneNode","ccs.BoneNode","cc.Node",nullptr); + + tolua_beginmodule(tolua_S,"BoneNode"); + tolua_function(tolua_S,"new",lua_cocos2dx_studio_BoneNode_constructor); + tolua_function(tolua_S,"getDebugDrawWidth",lua_cocos2dx_studio_BoneNode_getDebugDrawWidth); + tolua_function(tolua_S,"getChildBones",lua_cocos2dx_studio_BoneNode_getChildBones); + tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_studio_BoneNode_getBlendFunc); + tolua_function(tolua_S,"getAllSubBones",lua_cocos2dx_studio_BoneNode_getAllSubBones); + tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_studio_BoneNode_setBlendFunc); + tolua_function(tolua_S,"setDebugDrawEnabled",lua_cocos2dx_studio_BoneNode_setDebugDrawEnabled); + tolua_function(tolua_S,"getVisibleSkinsRect",lua_cocos2dx_studio_BoneNode_getVisibleSkinsRect); + tolua_function(tolua_S,"getAllSubSkins",lua_cocos2dx_studio_BoneNode_getAllSubSkins); + tolua_function(tolua_S,"displaySkin",lua_cocos2dx_studio_BoneNode_displaySkin); + tolua_function(tolua_S,"isDebugDrawEnabled",lua_cocos2dx_studio_BoneNode_isDebugDrawEnabled); + tolua_function(tolua_S,"addSkin",lua_cocos2dx_studio_BoneNode_addSkin); + tolua_function(tolua_S,"getRootSkeletonNode",lua_cocos2dx_studio_BoneNode_getRootSkeletonNode); + tolua_function(tolua_S,"setDebugDrawLength",lua_cocos2dx_studio_BoneNode_setDebugDrawLength); + tolua_function(tolua_S,"getSkins",lua_cocos2dx_studio_BoneNode_getSkins); + tolua_function(tolua_S,"getVisibleSkins",lua_cocos2dx_studio_BoneNode_getVisibleSkins); + tolua_function(tolua_S,"setDebugDrawWidth",lua_cocos2dx_studio_BoneNode_setDebugDrawWidth); + tolua_function(tolua_S,"getDebugDrawLength",lua_cocos2dx_studio_BoneNode_getDebugDrawLength); + tolua_function(tolua_S,"setDebugDrawColor",lua_cocos2dx_studio_BoneNode_setDebugDrawColor); + tolua_function(tolua_S,"getDebugDrawColor",lua_cocos2dx_studio_BoneNode_getDebugDrawColor); + tolua_function(tolua_S,"create", lua_cocos2dx_studio_BoneNode_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocostudio::timeline::BoneNode).name(); + g_luaType[typeName] = "ccs.BoneNode"; + g_typeCast["BoneNode"] = "ccs.BoneNode"; + return 1; +} + +int lua_cocos2dx_studio_SkeletonNode_getBoneNode(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::SkeletonNode* 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.SkeletonNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::SkeletonNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_SkeletonNode_getBoneNode'", 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, "ccs.SkeletonNode:getBoneNode"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_SkeletonNode_getBoneNode'", nullptr); + return 0; + } + cocostudio::timeline::BoneNode* ret = cobj->getBoneNode(arg0); + object_to_luaval(tolua_S, "ccs.BoneNode",(cocostudio::timeline::BoneNode*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.SkeletonNode:getBoneNode",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_SkeletonNode_getBoneNode'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_SkeletonNode_changeSkins(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::SkeletonNode* 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.SkeletonNode",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocostudio::timeline::SkeletonNode*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_SkeletonNode_changeSkins'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 1) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.SkeletonNode:changeSkins"); + + if (!ok) { break; } + cobj->changeSkins(arg0); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 1) { + std::map arg0; + ok &= luaval_to_std_map_string_string(tolua_S, 2, &arg0, "ccs.SkeletonNode:changeSkins"); + + if (!ok) { break; } + cobj->changeSkins(arg0); + lua_settop(tolua_S, 1); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.SkeletonNode:changeSkins",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_SkeletonNode_changeSkins'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_SkeletonNode_addSkinGroup(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::SkeletonNode* 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.SkeletonNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::SkeletonNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_SkeletonNode_addSkinGroup'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + std::map arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "ccs.SkeletonNode:addSkinGroup"); + + ok &= luaval_to_std_map_string_string(tolua_S, 3, &arg1, "ccs.SkeletonNode:addSkinGroup"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_SkeletonNode_addSkinGroup'", nullptr); + return 0; + } + cobj->addSkinGroup(arg0, arg1); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.SkeletonNode:addSkinGroup",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_SkeletonNode_addSkinGroup'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_SkeletonNode_getAllSubBonesMap(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::SkeletonNode* 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.SkeletonNode",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::timeline::SkeletonNode*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_SkeletonNode_getAllSubBonesMap'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_SkeletonNode_getAllSubBonesMap'", nullptr); + return 0; + } + const cocos2d::Map& ret = cobj->getAllSubBonesMap(); + ccmap_string_key_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.SkeletonNode:getAllSubBonesMap",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_SkeletonNode_getAllSubBonesMap'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_SkeletonNode_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.SkeletonNode",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_SkeletonNode_create'", nullptr); + return 0; + } + cocostudio::timeline::SkeletonNode* ret = cocostudio::timeline::SkeletonNode::create(); + object_to_luaval(tolua_S, "ccs.SkeletonNode",(cocostudio::timeline::SkeletonNode*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccs.SkeletonNode:create",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_SkeletonNode_create'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_studio_SkeletonNode_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::timeline::SkeletonNode* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_SkeletonNode_constructor'", nullptr); + return 0; + } + cobj = new cocostudio::timeline::SkeletonNode(); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"ccs.SkeletonNode"); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.SkeletonNode:SkeletonNode",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_SkeletonNode_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_studio_SkeletonNode_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (SkeletonNode)"); + return 0; +} + +int lua_register_cocos2dx_studio_SkeletonNode(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"ccs.SkeletonNode"); + tolua_cclass(tolua_S,"SkeletonNode","ccs.SkeletonNode","ccs.BoneNode",nullptr); + + tolua_beginmodule(tolua_S,"SkeletonNode"); + tolua_function(tolua_S,"new",lua_cocos2dx_studio_SkeletonNode_constructor); + tolua_function(tolua_S,"getBoneNode",lua_cocos2dx_studio_SkeletonNode_getBoneNode); + tolua_function(tolua_S,"changeSkins",lua_cocos2dx_studio_SkeletonNode_changeSkins); + tolua_function(tolua_S,"addSkinGroup",lua_cocos2dx_studio_SkeletonNode_addSkinGroup); + tolua_function(tolua_S,"getAllSubBonesMap",lua_cocos2dx_studio_SkeletonNode_getAllSubBonesMap); + tolua_function(tolua_S,"create", lua_cocos2dx_studio_SkeletonNode_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocostudio::timeline::SkeletonNode).name(); + g_luaType[typeName] = "ccs.SkeletonNode"; + g_typeCast["SkeletonNode"] = "ccs.SkeletonNode"; + return 1; +} + +int lua_cocos2dx_studio_ComExtensionData_setActionTag(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::ComExtensionData* 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.ComExtensionData",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::ComExtensionData*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ComExtensionData_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, "ccs.ComExtensionData:setActionTag"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComExtensionData_setActionTag'", nullptr); + return 0; + } + cobj->setActionTag(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ComExtensionData:setActionTag",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComExtensionData_setActionTag'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_ComExtensionData_getCustomProperty(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::ComExtensionData* 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.ComExtensionData",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::ComExtensionData*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ComExtensionData_getCustomProperty'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComExtensionData_getCustomProperty'", nullptr); + return 0; + } + std::string ret = cobj->getCustomProperty(); + tolua_pushcppstring(tolua_S,ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ComExtensionData:getCustomProperty",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComExtensionData_getCustomProperty'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_ComExtensionData_getActionTag(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::ComExtensionData* 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.ComExtensionData",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::ComExtensionData*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ComExtensionData_getActionTag'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComExtensionData_getActionTag'", nullptr); + return 0; + } + const int ret = cobj->getActionTag(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ComExtensionData:getActionTag",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComExtensionData_getActionTag'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_ComExtensionData_setCustomProperty(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::ComExtensionData* 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.ComExtensionData",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocostudio::ComExtensionData*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ComExtensionData_setCustomProperty'", 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, "ccs.ComExtensionData:setCustomProperty"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComExtensionData_setCustomProperty'", nullptr); + return 0; + } + cobj->setCustomProperty(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ComExtensionData:setCustomProperty",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComExtensionData_setCustomProperty'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_studio_ComExtensionData_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.ComExtensionData",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComExtensionData_create'", nullptr); + return 0; + } + cocostudio::ComExtensionData* ret = cocostudio::ComExtensionData::create(); + object_to_luaval(tolua_S, "ccs.ComExtensionData",(cocostudio::ComExtensionData*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccs.ComExtensionData:create",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComExtensionData_create'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_studio_ComExtensionData_createInstance(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.ComExtensionData",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComExtensionData_createInstance'", nullptr); + return 0; + } + cocos2d::Ref* ret = cocostudio::ComExtensionData::createInstance(); + object_to_luaval(tolua_S, "cc.Ref",(cocos2d::Ref*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "ccs.ComExtensionData:createInstance",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComExtensionData_createInstance'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_studio_ComExtensionData_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocostudio::ComExtensionData* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_studio_ComExtensionData_constructor'", nullptr); + return 0; + } + cobj = new cocostudio::ComExtensionData(); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"ccs.ComExtensionData"); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccs.ComExtensionData:ComExtensionData",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ComExtensionData_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_studio_ComExtensionData_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (ComExtensionData)"); + return 0; +} + +int lua_register_cocos2dx_studio_ComExtensionData(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"ccs.ComExtensionData"); + tolua_cclass(tolua_S,"ComExtensionData","ccs.ComExtensionData","cc.Component",nullptr); + + tolua_beginmodule(tolua_S,"ComExtensionData"); + tolua_function(tolua_S,"new",lua_cocos2dx_studio_ComExtensionData_constructor); + tolua_function(tolua_S,"setActionTag",lua_cocos2dx_studio_ComExtensionData_setActionTag); + tolua_function(tolua_S,"getCustomProperty",lua_cocos2dx_studio_ComExtensionData_getCustomProperty); + tolua_function(tolua_S,"getActionTag",lua_cocos2dx_studio_ComExtensionData_getActionTag); + tolua_function(tolua_S,"setCustomProperty",lua_cocos2dx_studio_ComExtensionData_setCustomProperty); + tolua_function(tolua_S,"create", lua_cocos2dx_studio_ComExtensionData_create); + tolua_function(tolua_S,"createInstance", lua_cocos2dx_studio_ComExtensionData_createInstance); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocostudio::ComExtensionData).name(); + g_luaType[typeName] = "ccs.ComExtensionData"; + g_typeCast["ComExtensionData"] = "ccs.ComExtensionData"; + return 1; +} TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S) { tolua_open(tolua_S); @@ -22711,6 +24404,8 @@ TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S) lua_register_cocos2dx_studio_ActionRotationFrame(tolua_S); lua_register_cocos2dx_studio_Frame(tolua_S); lua_register_cocos2dx_studio_BlendFuncFrame(tolua_S); + lua_register_cocos2dx_studio_BoneNode(tolua_S); + lua_register_cocos2dx_studio_SkeletonNode(tolua_S); lua_register_cocos2dx_studio_ScaleFrame(tolua_S); lua_register_cocos2dx_studio_Tween(tolua_S); lua_register_cocos2dx_studio_ContourData(tolua_S); @@ -22756,6 +24451,7 @@ TOLUA_API int register_all_cocos2dx_studio(lua_State* tolua_S) lua_register_cocos2dx_studio_SceneReader(tolua_S); lua_register_cocos2dx_studio_ActionTimelineCache(tolua_S); lua_register_cocos2dx_studio_AlphaFrame(tolua_S); + lua_register_cocos2dx_studio_ComExtensionData(tolua_S); lua_register_cocos2dx_studio_AnimationData(tolua_S); lua_register_cocos2dx_studio_AnchorPointFrame(tolua_S); lua_register_cocos2dx_studio_ActionScaleFrame(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 60e3ce9e08cf..f5cba1f1d3d3 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_studio_auto.hpp @@ -496,6 +496,43 @@ int register_all_cocos2dx_studio(lua_State* tolua_S); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp index ba5f1c81d14a..c3b51ccaec9a 100644 --- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp +++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp @@ -3330,3 +3330,59 @@ void std_vector_vec3_to_luaval(lua_State* L, const std::vector& i ++index; } } + +void std_map_string_string_to_luaval(lua_State* L, const std::map& inValue) +{ + if (nullptr == L) + return; + + lua_newtable(L); + + for (auto iter = inValue.begin(); iter != inValue.end(); ++iter) + { + lua_pushstring(L, iter->first.c_str()); + lua_pushstring(L, iter->second.c_str()); + lua_rawset(L, -3); + } +} + +bool luaval_to_std_map_string_string(lua_State* L, int lo, std::map* ret, const char* funcName) +{ + if (nullptr == L || nullptr == ret || lua_gettop(L) < lo) + return false; + + tolua_Error tolua_err; + bool ok = true; + if (!tolua_istable(L, lo, 0, &tolua_err)) + { +#if COCOS2D_DEBUG >=1 + luaval_to_native_err(L,"#ferror:",&tolua_err,funcName); +#endif + ok = false; + } + + if (!ok) + return ok; + + lua_pushnil(L); + std::string key; + std::string value; + while (lua_next(L, lo) != 0) + { + if (lua_isstring(L, -2) && lua_isstring(L, -1)) + { + if (luaval_to_std_string(L, -2, &key) && luaval_to_std_string(L, -1, &value)) + { + (*ret)[key] = value; + } + } + else + { + CCASSERT(false, "string type is needed"); + } + + lua_pop(L, 1); + } + + return ok; +} diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h index ec2b0fbbb1fc..d5d73fc1de20 100644 --- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h +++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h @@ -829,6 +829,8 @@ extern bool luaval_to_std_vector_vec2(lua_State* L, int lo, std::vector* ret, const char* funcName = ""); +extern bool luaval_to_std_map_string_string(lua_State* L, int lo, std::map* ret, const char* funcName); + /**@}**/ // from native @@ -1282,6 +1284,15 @@ void texParams_to_luaval(lua_State* L, const cocos2d::Texture2D::TexParams& inVa * @param inValue a std::vector vaule. */ void std_vector_vec3_to_luaval(lua_State* L, const std::vector& inValue); + +/** + * Push a Lua dict table converted from a std::map into the Lua stack. + * + * @param L the current lua_State. + * @param inValue a std::map vaule. + */ +void std_map_string_string_to_luaval(lua_State* L, const std::map& inValue); + // end group /// @} #endif //__COCOS2DX_SCRIPTING_LUA_COCOS2DXSUPPORT_LUABAISCCONVERSIONS_H__ diff --git a/docs/doxygen.config b/docs/doxygen.config index 9ec98c87d17d..af7ce33c40b1 100644 --- a/docs/doxygen.config +++ b/docs/doxygen.config @@ -38,7 +38,7 @@ PROJECT_NAME = Cocos2d-x # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v3.7 +PROJECT_NUMBER = v3.7.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index b5533d268c8d..1d2b130d6cc0 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -529,8 +529,14 @@ "cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h", "cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineNode.cpp", "cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineNode.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp", + "cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.h", "cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp", "cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp", + "cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h", + "cocos/editor-support/cocostudio/ActionTimeline/CCSkinNode.cpp", + "cocos/editor-support/cocostudio/ActionTimeline/CCSkinNode.h", "cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp", "cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.h", "cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h", @@ -568,6 +574,8 @@ "cocos/editor-support/cocostudio/CCComBase.h", "cocos/editor-support/cocostudio/CCComController.cpp", "cocos/editor-support/cocostudio/CCComController.h", + "cocos/editor-support/cocostudio/CCComExtensionData.cpp", + "cocos/editor-support/cocostudio/CCComExtensionData.h", "cocos/editor-support/cocostudio/CCComRender.cpp", "cocos/editor-support/cocostudio/CCComRender.h", "cocos/editor-support/cocostudio/CCDataReaderHelper.cpp", @@ -582,8 +590,6 @@ "cocos/editor-support/cocostudio/CCDisplayManager.h", "cocos/editor-support/cocostudio/CCInputDelegate.cpp", "cocos/editor-support/cocostudio/CCInputDelegate.h", - "cocos/editor-support/cocostudio/CCObjectExtensionData.cpp", - "cocos/editor-support/cocostudio/CCObjectExtensionData.h", "cocos/editor-support/cocostudio/CCProcessBase.cpp", "cocos/editor-support/cocostudio/CCProcessBase.h", "cocos/editor-support/cocostudio/CCSGUIReader.cpp", @@ -631,6 +637,8 @@ "cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.h", "cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp", "cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.h", + "cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.cpp", + "cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.h", "cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp", "cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h", "cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp", @@ -659,6 +667,11 @@ "cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h", "cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp", "cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.h", + "cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.cpp", + "cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/BoneNodeReader.h", + "cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/CSBoneBinary_generated.h", + "cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.cpp", + "cocos/editor-support/cocostudio/WidgetReader/SkeletonReader/SkeletonNodeReader.h", "cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp", "cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h", "cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp", @@ -6515,6 +6528,7 @@ "cocos/scripting/lua-bindings/auto/api/Blink.lua", "cocos/scripting/lua-bindings/auto/api/Bone.lua", "cocos/scripting/lua-bindings/auto/api/BoneData.lua", + "cocos/scripting/lua-bindings/auto/api/BoneNode.lua", "cocos/scripting/lua-bindings/auto/api/Bundle3D.lua", "cocos/scripting/lua-bindings/auto/api/Button.lua", "cocos/scripting/lua-bindings/auto/api/CCBAnimationManager.lua", @@ -6533,6 +6547,7 @@ "cocos/scripting/lua-bindings/auto/api/ComAttribute.lua", "cocos/scripting/lua-bindings/auto/api/ComAudio.lua", "cocos/scripting/lua-bindings/auto/api/ComController.lua", + "cocos/scripting/lua-bindings/auto/api/ComExtensionData.lua", "cocos/scripting/lua-bindings/auto/api/ComRender.lua", "cocos/scripting/lua-bindings/auto/api/Component.lua", "cocos/scripting/lua-bindings/auto/api/Console.lua", @@ -6792,6 +6807,7 @@ "cocos/scripting/lua-bindings/auto/api/SimpleAudioEngine.lua", "cocos/scripting/lua-bindings/auto/api/Skeleton3D.lua", "cocos/scripting/lua-bindings/auto/api/SkeletonAnimation.lua", + "cocos/scripting/lua-bindings/auto/api/SkeletonNode.lua", "cocos/scripting/lua-bindings/auto/api/SkeletonRenderer.lua", "cocos/scripting/lua-bindings/auto/api/SkewBy.lua", "cocos/scripting/lua-bindings/auto/api/SkewFrame.lua", diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj b/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj index 0bc39b97e9a8..cdb0085d2a7c 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj +++ b/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj @@ -159,7 +159,6 @@ xcopy "$(ProjectDir)..\..\..\src" "$(LocalDebuggerWorkingDirectory)\src" /D /E / libcurl_imp.lib;websockets.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END) libcmt.lib true - $(ProjectDir)../../../simulator/win32/$(TargetName)$(TargetExt) 0x0409 diff --git a/tests/cpp-tests/Classes/AppDelegate.cpp b/tests/cpp-tests/Classes/AppDelegate.cpp index db9ef8c4a075..326e0aa80464 100644 --- a/tests/cpp-tests/Classes/AppDelegate.cpp +++ b/tests/cpp-tests/Classes/AppDelegate.cpp @@ -122,6 +122,8 @@ bool AppDelegate::applicationDidFinishLaunching() searchPaths.push_back("ccs-res/hd/cocosui/CustomTest/CustomWidgetCallbackBindTest"); searchPaths.push_back("hd/ActionTimeline"); searchPaths.push_back("ccs-res/hd/armature"); + + searchPaths.push_back("ccs-res/hd/scene3DTest"); } else { @@ -161,6 +163,8 @@ bool AppDelegate::applicationDidFinishLaunching() searchPaths.push_back("ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest"); searchPaths.push_back("ActionTimeline"); searchPaths.push_back("ccs-res/armature"); + + searchPaths.push_back("ccs-res/scene3DTest"); } fileUtils->setSearchPaths(searchPaths); diff --git a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.cpp b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.cpp index 36a0e4d042e6..c9e71cac1349 100644 --- a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.cpp +++ b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.cpp @@ -41,6 +41,7 @@ CocosStudio3DTests::CocosStudio3DTests() ADD_TEST_CASE(CSSprite3DTest); ADD_TEST_CASE(CSUserCameraTest); ADD_TEST_CASE(CSParticle3DTest); + ADD_TEST_CASE(CSSceneSkyBoxTest); } //------------------------------------------------------------------ @@ -75,7 +76,7 @@ void CocosStudio3DTestDemo::onExit() //------------------------------------------------------------------ CSNode3DTest::CSNode3DTest() { - auto node = CSLoader::createNode("ccs-res/CocosStudio3DTest/Node3D.csb"); + auto node = CSLoader::createNode("Node3D.csb"); auto size = Director::getInstance()->getWinSize(); auto label = Label::create(); @@ -99,7 +100,7 @@ std::string CSNode3DTest::title() const //------------------------------------------------------------------ CSSprite3DTest::CSSprite3DTest() { - auto node = CSLoader::createNode("ccs-res/CocosStudio3DTest/Sprite3D.csb"); + auto node = CSLoader::createNode("Sprite3D.csb"); auto size = Director::getInstance()->getWinSize(); auto sprite3D = node->getChildByTag(8); @@ -123,9 +124,9 @@ std::string CSSprite3DTest::title() const //------------------------------------------------------------------ CSUserCameraTest::CSUserCameraTest() { - auto node = CSLoader::createNode("ccs-res/CocosStudio3DTest/UserCamera.csb"); + auto node = CSLoader::createNode("UserCamera.csb"); - auto sprite3D = Sprite3D::create("ccs-res/CocosStudio3DTest/dragon/dragon.c3b"); + auto sprite3D = Sprite3D::create("dragon/dragon.c3b"); sprite3D->setPosition3D(Vec3(100, 95, 80)); sprite3D->setCameraMask((unsigned int)CameraFlag::USER1); @@ -145,7 +146,7 @@ std::string CSUserCameraTest::title() const //------------------------------------------------------------------ CSParticle3DTest::CSParticle3DTest() { - auto node = CSLoader::createNode("ccs-res/CocosStudio3DTest/Particle3D.csb"); + auto node = CSLoader::createNode("Particle3D.csb"); addChild(node); } @@ -154,3 +155,40 @@ std::string CSParticle3DTest::title() const { return "Particle3DReader Test"; } + +//------------------------------------------------------------------ +// +// CSSceneSkyBoxTest +// +//------------------------------------------------------------------ +CSSceneSkyBoxTest::CSSceneSkyBoxTest() +{ + auto node = CSLoader::createNode("SkyBox.csb"); + + addChild(node); + + _camera = static_cast(node->getChildByName("UserCamera_0")); + + auto listener = EventListenerTouchAllAtOnce::create(); + listener->onTouchesMoved = CC_CALLBACK_2(CSSceneSkyBoxTest::onTouchesMoved, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); +} + +std::string CSSceneSkyBoxTest::title() const +{ + return "CocosStudio SkyBox Test"; +} + +void CSSceneSkyBoxTest::onTouchesMoved(const std::vector& touches, cocos2d::Event *event) +{ + if (touches.size()) + { + auto touch = touches[0]; + auto delta = touch->getDelta(); + + static float _angle = 0.f; + _angle -= CC_DEGREES_TO_RADIANS(delta.x); + _camera->setPosition3D(Vec3(50.0f * sinf(_angle), 0.0f, 50.0f * cosf(_angle))); + _camera->lookAt(Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f)); + } +} \ No newline at end of file diff --git a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h index eb246abc1e1f..ca5b7dafc927 100644 --- a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h +++ b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h @@ -73,5 +73,16 @@ class CSParticle3DTest : public CocosStudio3DTestDemo virtual std::string title() const override; }; +class CSSceneSkyBoxTest : public CocosStudio3DTestDemo +{ +private: + cocos2d::Camera *_camera; +public: + CREATE_FUNC(CSSceneSkyBoxTest); + CSSceneSkyBoxTest(); + virtual std::string title() const override; + void onTouchesMoved(const std::vector& touches, cocos2d::Event *event); +}; + #endif diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp index 2fc773b5eba3..518b21acce7c 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp @@ -3,6 +3,7 @@ #include "renderer/CCRenderer.h" #include "renderer/CCCustomCommand.h" #include "VisibleRect.h" +#include "editor-support/cocostudio/CCComExtensionData.h" USING_NS_CC; @@ -20,6 +21,8 @@ CocoStudioActionTimelineTests::CocoStudioActionTimelineTests() ADD_TEST_CASE(TestProjectNodeForSimulator); ADD_TEST_CASE(TestTimelineNodeLoadedCallback); ADD_TEST_CASE(TestActionTimelineEase); + ADD_TEST_CASE(TestActionTimelineSkeleton); + ADD_TEST_CASE(TestTimelineExtensionData); } CocoStudioActionTimelineTests::~CocoStudioActionTimelineTests() @@ -315,3 +318,278 @@ std::string TestActionTimelineEase::title() const { return "Test ActionTimelineEase"; } + +//TestActionTimelineSkeleton +void TestActionTimelineSkeleton::onEnter() +{ + ActionTimelineBaseTest::onEnter(); + + _changedDisplays = _changedDisplay = false; + Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer_skeleton.csb"); + ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer_skeleton.csb"); + node->runAction(action); + node->setScale(0.2f); + node->setPosition(150, 150); + action->gotoFrameAndPlay(0); + addChild(node); + + auto skeletonNode = static_cast(node); + const std::string weapBoneName = "Layer20"; + auto weaponHandeBone = skeletonNode->getBoneNode(weapBoneName); + + /*********** debug draw bones *************/ + auto boneDrawsBtn = cocos2d::ui::Button::create(); + addChild(boneDrawsBtn); + boneDrawsBtn->setPosition(Vec2(VisibleRect::right().x - 30, VisibleRect::top().y - 30)); + boneDrawsBtn->setTitleText("Draw bone"); + + _isAllBonesDraw = true; + skeletonNode->setDebugDrawEnabled(_isAllBonesDraw); + setAllSubBonesDebugDraw(skeletonNode, _isAllBonesDraw); + boneDrawsBtn->addClickEventListener([skeletonNode, this](Ref* sender) + { + _isAllBonesDraw = !_isAllBonesDraw; + skeletonNode->setDebugDrawEnabled(_isAllBonesDraw); + setAllSubBonesDebugDraw(skeletonNode, _isAllBonesDraw); + }); + + + /***************** change bone display **************************/ + + // add display + auto weapSkinToAdd = Sprite::create("ActionTimeline/testAnimationResource/girl_arms.png"); + weapSkinToAdd->setName("Knife"); + weapSkinToAdd->setPosition(Vec2(135, 23)); + weapSkinToAdd->setScale(3.0f); + weapSkinToAdd->setRotation(86); + weaponHandeBone->addSkin(weapSkinToAdd, false); + + // change display + auto changeBoneDispBtn = cocos2d::ui::Button::create(); + addChild(changeBoneDispBtn); + changeBoneDispBtn->setPosition(Vec2(VisibleRect::right().x - 60, VisibleRect::top().y - 60)); + changeBoneDispBtn->setTitleText("change bone display"); + changeBoneDispBtn->addClickEventListener([weapSkinToAdd, weaponHandeBone](Ref* sender) + { + // or use skeletonNode->display(bone name, skin name, hide) + if (weapSkinToAdd->isVisible()) + weaponHandeBone->displaySkin("3", true); + else + { + weaponHandeBone->displaySkin(weapSkinToAdd, true); + } + }); + + + /*************** debug draw boundingbox and transforms ***************/ + auto debugDrawNode = DrawNode::create(); + addChild(debugDrawNode); + + auto drawBoxBtn = cocos2d::ui::Button::create(); + addChild(drawBoxBtn); + drawBoxBtn->setPosition(Vec2(VisibleRect::right().x - 30, VisibleRect::top().y - 45)); + drawBoxBtn->setTitleText("Draw Box"); + + + drawBoxBtn->addClickEventListener([debugDrawNode](Ref* sender) + { + debugDrawNode->setVisible(!debugDrawNode->isVisible()); + }); + skeletonNode->schedule([skeletonNode, weaponHandeBone, debugDrawNode](float interval) + { + if (debugDrawNode->isVisible()) + { + debugDrawNode->clear(); + // skeleton boundingbox + auto rect = skeletonNode->getBoundingBox(); + cocos2d::Vec2 leftbottom(rect.getMinX(), rect.getMinY()); + cocos2d::Vec2 righttop(rect.getMaxX(), rect.getMaxY()); + debugDrawNode->drawRect(leftbottom, righttop, cocos2d::Color4F::YELLOW); + + // bone boundingbox + rect = weaponHandeBone->getBoundingBox(); + leftbottom.x = rect.getMinX(); leftbottom.y = rect.getMinY(); + righttop.x = rect.getMaxX(); righttop.y = rect.getMaxY(); + cocos2d::Vec2 lefttop(rect.getMinX(), rect.getMaxY()); + cocos2d::Vec2 rightbottom(rect.getMaxX(), rect.getMinY()); + auto skeletonToP = skeletonNode->getNodeToParentAffineTransform(); + auto bonePtoSkeletonPTrans = AffineTransformConcat( + static_cast((weaponHandeBone->getParent()) + )->getNodeToParentAffineTransform(skeletonNode), + skeletonToP); + leftbottom = PointApplyAffineTransform(leftbottom, bonePtoSkeletonPTrans); + righttop = PointApplyAffineTransform(righttop, bonePtoSkeletonPTrans); + lefttop = PointApplyAffineTransform(lefttop, bonePtoSkeletonPTrans); + rightbottom = PointApplyAffineTransform(rightbottom, bonePtoSkeletonPTrans); + debugDrawNode->drawLine(leftbottom, rightbottom, Color4F::BLUE); + debugDrawNode->drawLine(rightbottom, righttop, Color4F::BLUE); + debugDrawNode->drawLine(righttop, lefttop, Color4F::BLUE); + debugDrawNode->drawLine(lefttop, leftbottom, Color4F::BLUE); + + // skin boundingbox + + // get displaying nodes + auto currentskin = weaponHandeBone->getVisibleSkins().front(); + rect = currentskin->getBoundingBox(); + leftbottom.x = rect.getMinX(); leftbottom.y = rect.getMinY(); + righttop.x = rect.getMaxX(); righttop.y = rect.getMaxY(); + lefttop.x = rect.getMinX(); lefttop.y = rect.getMaxY(); + rightbottom.x = rect.getMaxX(); rightbottom.y = rect.getMinY(); + auto boneToSkeletonParentTrans = AffineTransformConcat( + weaponHandeBone->getNodeToParentAffineTransform(skeletonNode), skeletonToP); + leftbottom = PointApplyAffineTransform(leftbottom, boneToSkeletonParentTrans); + righttop = PointApplyAffineTransform(righttop, boneToSkeletonParentTrans); + lefttop = PointApplyAffineTransform(lefttop, boneToSkeletonParentTrans); + rightbottom = PointApplyAffineTransform(rightbottom, boneToSkeletonParentTrans); + + debugDrawNode->drawLine(leftbottom, rightbottom, Color4F::GREEN); + debugDrawNode->drawLine(rightbottom, righttop, Color4F::GREEN); + debugDrawNode->drawLine(righttop, lefttop, Color4F::GREEN); + debugDrawNode->drawLine(lefttop, leftbottom, Color4F::GREEN); + } + }, 0, "update debug draw"); + + + // change displays , can be use for dress up a skeleton + auto changeBoneDispsBtn = cocos2d::ui::Button::create(); + addChild(changeBoneDispsBtn); + changeBoneDispsBtn->setPosition(Vec2(VisibleRect::right().x - 60, VisibleRect::top().y - 75)); + changeBoneDispsBtn->setTitleText("change bone displays"); + + std::map < std::string, std::string> boneSkinNames; + boneSkinNames.insert(std::make_pair("Layer20", "fire")); + boneSkinNames.insert(std::make_pair("Layer14", "fruit")); + skeletonNode->addSkinGroup("fruitKnife", boneSkinNames); + + std::map < std::string, std::string> boneSkinNames2; + boneSkinNames2.insert(std::make_pair("Layer20", "3")); + boneSkinNames2.insert(std::make_pair("Layer14", "hat")); + skeletonNode->addSkinGroup("cowboy", boneSkinNames2); + + changeBoneDispsBtn->addClickEventListener([skeletonNode, this](Ref* sender) + { + if (!_changedDisplays) + { + skeletonNode->changeSkins("fruitKnife"); + _changedDisplays = true; + } + else + { + skeletonNode->changeSkins("cowboy"); + _changedDisplays = false; + } + }); + + + /*********** test cases for bugs **********/ + // bug: #13060 https://github.com/cocos2d/cocos2d-x/issues/13060 + // bug: bone draw at the other edge when move to outside right edge. + BoneNode* bugtestBoneNode = BoneNode::create(500); + bugtestBoneNode->setRotation(-10); + bugtestBoneNode->retain(); + bugtestBoneNode->setDebugDrawEnabled(true); + bugtestBoneNode->setPosition(Vec2(1500, VisibleRect::top().y - 90)); + auto bug13060Btn = cocos2d::ui::Button::create(); + bug13060Btn->setPosition(Vec2(VisibleRect::right().x - 30, VisibleRect::top().y - 90)); + bug13060Btn->setTitleText("bug #13060"); + addChild(bug13060Btn); + bug13060Btn->addClickEventListener([bugtestBoneNode, skeletonNode](Ref* sender) + { + if (bugtestBoneNode->getParent() == nullptr) + skeletonNode->addChild(bugtestBoneNode); + else + bugtestBoneNode->removeFromParent(); + // bug fixed while bugtestBoneNode not be drawn at the bottom edge + }); + + // bug: #13005 https://github.com/cocos2d/cocos2d-x/issues/#13005 + // bug: BoneNode 's debugdraw can not be controlled by ancestor's visible + auto leftleg = skeletonNode->getBoneNode("Layer26"); + auto bug13005Btn = cocos2d::ui::Button::create(); + addChild(bug13005Btn); + bug13005Btn->setPosition(Vec2(VisibleRect::right().x - 30, VisibleRect::top().y - 105)); + bug13005Btn->setTitleText("bug #13005"); + bug13005Btn->addClickEventListener([leftleg](Ref* sender) + { + leftleg->setVisible(!leftleg->isVisible()); + // bug fixed while leftleg's child hide with leftleg's visible + }); + + + /************* Skeleton nest Skeleton test *************/ + auto nestSkeletonBtn = cocos2d::ui::Button::create(); + nestSkeletonBtn->setTitleText("Skeleton Nest"); + nestSkeletonBtn->setPosition(Vec2(VisibleRect::right().x - 40, VisibleRect::top().y - 120)); + addChild(nestSkeletonBtn); + auto nestSkeleton = static_cast(CSLoader::createNode("ActionTimeline/DemoPlayer_skeleton.csb")); + nestSkeleton->retain(); + ActionTimeline* nestSkeletonAction = action->clone(); + nestSkeletonAction->retain(); + nestSkeleton->runAction(nestSkeletonAction); + nestSkeleton->setScale(0.2f); + nestSkeleton->setPosition(150, 300); + nestSkeletonAction->gotoFrameAndPlay(0); + // show debug draws, or comment this for hide bones draws + for (auto& nestbonechild : nestSkeleton->getAllSubBonesMap()) + { + nestbonechild.second->setDebugDrawEnabled(true); + } + + nestSkeletonBtn->addClickEventListener([leftleg, nestSkeleton, nestSkeletonAction](Ref* sender) + { + if (nestSkeleton->getParent() == nullptr) + { + leftleg->addChild(nestSkeleton); + } + else + { + nestSkeleton->removeFromParentAndCleanup(false); + } + // bug fixed while leftleg's child hide with leftleg's visible + }); +} + +std::string TestActionTimelineSkeleton::title() const +{ + return "Test ActionTimeline Skeleton"; +} + +void TestActionTimelineSkeleton::setAllSubBonesDebugDraw(SkeletonNode* rootSkeleton, bool isShow) +{ + auto boneMap = rootSkeleton->getAllSubBonesMap(); + for (auto& bonePair : boneMap) + { + bonePair.second->setDebugDrawEnabled(isShow); + } +} + + +// TestTimelineExtensionData +void TestTimelineExtensionData::onEnter() +{ + ActionTimelineBaseTest::onEnter(); + + Node* node = CSLoader::createNode("ActionTimeline/TestAnimation.csb"); + ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/TestAnimation.csb"); + node->runAction(action); + action->gotoFrameAndPlay(0); + + auto projectNode = node->getChildByTag(29); + auto userdata = ((ComExtensionData*)(projectNode->getComponent("ComExtensionData")))->getCustomProperty(); + + auto size = Director::getInstance()->getWinSize(); + auto label = Label::create(); + label->setString(userdata); + label->setPosition(size.width / 2 + 300, size.height / 2 + 300); + label->setTextColor(Color4B::ORANGE); + node->addChild(label); + node->setPosition(-300, -300); + + addChild(node); + +} + +std::string TestTimelineExtensionData::title() const +{ + return "Test Timeline extension data"; +} \ No newline at end of file diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h index 270409db0d04..b045117b9c60 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h @@ -117,4 +117,29 @@ class TestActionTimelineEase : public ActionTimelineBaseTest virtual std::string title() const override; }; +class TestActionTimelineSkeleton : public ActionTimelineBaseTest +{ +public: + CREATE_FUNC(TestActionTimelineSkeleton); + + virtual void onEnter() override; + + virtual std::string title() const override; + +private: + void setAllSubBonesDebugDraw(cocostudio::timeline::SkeletonNode* rootSkeleton, bool isShow); + + bool _changedDisplay; + bool _changedDisplays; + bool _isAllBonesDraw; +}; + +class TestTimelineExtensionData : public ActionTimelineBaseTest +{ +public: + CREATE_FUNC(TestTimelineExtensionData); + virtual void onEnter() override; + virtual std::string title() const override; +}; + #endif // __ANIMATION_SCENE_H__ diff --git a/tests/cpp-tests/Resources/ActionTimeline/DemoPlayer_skeleton.csb b/tests/cpp-tests/Resources/ActionTimeline/DemoPlayer_skeleton.csb new file mode 100644 index 000000000000..4a5e95d4903d Binary files /dev/null and b/tests/cpp-tests/Resources/ActionTimeline/DemoPlayer_skeleton.csb differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/DemoPlayer_skeleton.json b/tests/cpp-tests/Resources/ActionTimeline/DemoPlayer_skeleton.json new file mode 100644 index 000000000000..8d9526358686 --- /dev/null +++ b/tests/cpp-tests/Resources/ActionTimeline/DemoPlayer_skeleton.json @@ -0,0 +1,3106 @@ +{ + "ID": "6471726c-399e-4bd5-99d3-8d9977d801d1", + "Version": "2.3.1.0", + "Name": "DemoPlayer_skeleton", + "Content": { + "Content": { + "Animation": { + "Duration": 81, + "Speed": 1.0, + "Timelines": [ + { + "ActionTag": 62746268, + "Property": "ZOrder", + "Frames": [ + { + "Value": 5, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 5, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 5, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 5, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 5, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 62746268, + "Property": "CColor", + "Frames": [ + { + "Alpha": 255, + "Color": {}, + "FrameIndex": -1, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 0, + "Tween": false, + "ctype": "ColorFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 62746268, + "Property": "Alpha", + "Frames": [ + { + "Value": 255, + "FrameIndex": -1, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 49282936, + "Property": "ZOrder", + "Frames": [ + { + "Value": 9, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 9, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 9, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 9, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 9, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 49282936, + "Property": "CColor", + "Frames": [ + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 40, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 49282936, + "Property": "Alpha", + "Frames": [ + { + "Value": 255, + "FrameIndex": 40, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 27845503, + "Property": "Position", + "Frames": [ + { + "X": 123.0, + "Y": -112.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 123.0, + "Y": -112.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 123.0, + "Y": -112.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 123.0, + "Y": -112.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 123.0, + "Y": -112.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 27845503, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 27845503, + "Property": "RotationSkew", + "Frames": [ + { + "X": 150.2165, + "Y": 150.2165, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 150.2165, + "Y": 150.2165, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 150.2165, + "Y": 150.2165, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 174.829, + "Y": 174.829, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 222.6168, + "Y": 222.6168, + "FrameIndex": 51, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 174.829, + "Y": 174.829, + "FrameIndex": 61, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 142.2484, + "Y": 142.2484, + "FrameIndex": 71, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 174.829, + "Y": 174.829, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 24018105, + "Property": "ZOrder", + "Frames": [ + { + "Value": 8, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 8, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 8, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 8, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 8, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 32494840, + "Property": "Position", + "Frames": [ + { + "X": 257.0, + "Y": 29.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 257.0, + "Y": 29.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 257.0, + "Y": 29.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 257.0, + "Y": 29.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 257.0, + "Y": 29.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 32494840, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 32494840, + "Property": "RotationSkew", + "Frames": [ + { + "X": -25.8124, + "Y": -25.8124, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": -22.6878, + "Y": -22.6878, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": -25.8124, + "Y": -25.8124, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": -12.0765, + "Y": -12.0765, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": -6.0765, + "Y": -6.0765, + "FrameIndex": 61, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": -12.0765, + "Y": -12.0765, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 66418347, + "Property": "ZOrder", + "Frames": [ + { + "Value": 6, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 6, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 6, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 6, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 6, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 66418347, + "Property": "CColor", + "Frames": [ + { + "Alpha": 255, + "Color": {}, + "FrameIndex": -1, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 40, + "Tween": false, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 66418347, + "Property": "Alpha", + "Frames": [ + { + "Value": 255, + "FrameIndex": -1, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 11177013, + "Property": "ZOrder", + "Frames": [ + { + "Value": 7, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 7, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 7, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 7, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 7, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 11177013, + "Property": "CColor", + "Frames": [ + { + "Alpha": 255, + "Color": {}, + "FrameIndex": -1, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 40, + "Tween": false, + "ctype": "ColorFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 11177013, + "Property": "Alpha", + "Frames": [ + { + "Value": 255, + "FrameIndex": -1, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 60894213, + "Property": "Position", + "Frames": [ + { + "X": 200.0, + "Y": 55.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 200.0, + "Y": 55.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 200.0, + "Y": 55.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 200.0, + "Y": 55.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 200.0, + "Y": 55.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 60894213, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 60894213, + "Property": "RotationSkew", + "Frames": [ + { + "X": 24.8229, + "Y": 24.8229, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 24.8229, + "Y": 24.8229, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 24.8229, + "Y": 24.8229, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": -14.3235, + "Y": -14.3235, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": -14.3235, + "Y": -14.3235, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 14836356, + "Property": "Position", + "Frames": [ + { + "X": 20.0, + "Y": -33.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 20.0, + "Y": -33.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 20.0, + "Y": -33.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 8.1953, + "Y": 8.323, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 8.1953, + "Y": 8.323, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 14836356, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 14836356, + "Property": "RotationSkew", + "Frames": [ + { + "X": 171.6916, + "Y": 171.6916, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 171.6916, + "Y": 171.6916, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 171.6916, + "Y": 171.6916, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 193.6945, + "Y": 193.6945, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 142.0587, + "Y": 142.0587, + "FrameIndex": 51, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 193.6945, + "Y": 193.6945, + "FrameIndex": 61, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 224.7012, + "Y": 224.7012, + "FrameIndex": 71, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 193.6945, + "Y": 193.6945, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 32922880, + "Property": "ZOrder", + "Frames": [ + { + "Value": 3, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 3, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 3, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 3, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 3, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 49507636, + "Property": "ZOrder", + "Frames": [ + { + "Value": 4, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 4, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 4, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 4, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 4, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 49507636, + "Property": "CColor", + "Frames": [ + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 40, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 49507636, + "Property": "Alpha", + "Frames": [ + { + "Value": 255, + "FrameIndex": 40, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 27870469, + "Property": "Position", + "Frames": [ + { + "X": 197.0, + "Y": 28.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 197.0, + "Y": 28.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 197.0, + "Y": 28.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 197.0, + "Y": 28.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 197.0, + "Y": 28.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 27870469, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 27870469, + "Property": "RotationSkew", + "Frames": [ + { + "X": 12.3178, + "Y": 12.3178, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.7777, + "Y": 1.7777, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 12.3178, + "Y": 12.3178, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 7.7836, + "Y": 7.7836, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 7.7836, + "Y": 7.7836, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 33484259, + "Property": "Position", + "Frames": [ + { + "X": 16.0, + "Y": 20.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 16.0, + "Y": 20.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 16.0, + "Y": 20.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 15.974, + "Y": -3.3345, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 15.974, + "Y": -3.3345, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 33484259, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 33484259, + "Property": "RotationSkew", + "Frames": [ + { + "X": 205.4041, + "Y": 205.4041, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 210.0319, + "Y": 210.0319, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 205.4041, + "Y": 205.4041, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 178.0176, + "Y": 178.0176, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 221.9677, + "Y": 221.9677, + "FrameIndex": 51, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 178.0176, + "Y": 178.0176, + "FrameIndex": 61, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 145.4575, + "Y": 145.4575, + "FrameIndex": 71, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 178.0176, + "Y": 178.0176, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 50695543, + "Property": "ZOrder", + "Frames": [ + { + "Value": 1, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 1, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 1, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 1, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 50695543, + "Property": "CColor", + "Frames": [ + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 40, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + }, + { + "Alpha": 255, + "Color": {}, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ColorFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 50695543, + "Property": "Alpha", + "Frames": [ + { + "Value": 255, + "FrameIndex": 40, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 255, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 12698356, + "Property": "ZOrder", + "Frames": [ + { + "Value": 2, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 2, + "FrameIndex": 40, + "Tween": false, + "ctype": "IntFrameData" + }, + { + "Value": 2, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + }, + { + "Value": 2, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "IntFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 53606711, + "Property": "Position", + "Frames": [ + { + "X": 106.0, + "Y": 0.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 106.0, + "Y": 0.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 106.0, + "Y": 0.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 106.0, + "Y": 0.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 53606711, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 53606711, + "Property": "RotationSkew", + "Frames": [ + { + "X": 29.8583, + "Y": 29.8583, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 29.8583, + "Y": 29.8583, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 760.8395, + "Y": 760.8395, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 857.8506, + "Y": 857.8506, + "FrameIndex": 51, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 760.8395, + "Y": 760.8395, + "FrameIndex": 61, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 749.0339, + "Y": 749.0339, + "FrameIndex": 71, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 760.8395, + "Y": 760.8395, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 42915540, + "Property": "Position", + "Frames": [ + { + "X": 116.0, + "Y": 73.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 116.0, + "Y": 73.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 116.0, + "Y": 73.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 116.0, + "Y": 73.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 42915540, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 42915540, + "Property": "RotationSkew", + "Frames": [ + { + "X": 223.4995, + "Y": 223.4995, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 223.4995, + "Y": 223.4995, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 187.1004, + "Y": 187.1004, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 96.1635, + "Y": 96.1635, + "FrameIndex": 51, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 187.1004, + "Y": 187.1004, + "FrameIndex": 61, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 225.1743, + "Y": 225.1743, + "FrameIndex": 71, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 187.1004, + "Y": 187.1004, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 59167590, + "Property": "Position", + "Frames": [ + { + "X": 54.0, + "Y": -25.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 54.0, + "Y": -25.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 54.0, + "Y": -25.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "PointFrameData" + }, + { + "X": 54.0, + "Y": -25.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 54.0, + "Y": -35.0, + "FrameIndex": 51, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 54.0, + "Y": -25.0, + "FrameIndex": 61, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 54.0, + "Y": -35.0, + "FrameIndex": 71, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + }, + { + "X": 54.0, + "Y": -25.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "PointFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 59167590, + "Property": "Scale", + "Frames": [ + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": 1.0, + "Y": 1.0, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + }, + { + "ActionTag": 59167590, + "Property": "RotationSkew", + "Frames": [ + { + "X": -89.4791, + "Y": -89.4791, + "FrameIndex": 0, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": -89.4791, + "Y": -89.4791, + "FrameIndex": 20, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": -89.4791, + "Y": -89.4791, + "FrameIndex": 40, + "Tween": false, + "ctype": "ScaleValueFrameData" + }, + { + "X": -89.4791, + "Y": -89.4791, + "FrameIndex": 41, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + }, + { + "X": -89.4791, + "Y": -89.4791, + "FrameIndex": 81, + "EasingData": { + "Type": 0 + }, + "ctype": "ScaleValueFrameData" + } + ], + "ctype": "TimelineData" + } + ], + "ctype": "TimelineActionData" + }, + "AnimationList": [ + { + "StartIndex": 0, + "EndIndex": 40, + "Name": "stand", + "ctype": "AnimationInfoData" + }, + { + "StartIndex": 41, + "EndIndex": 81, + "Name": "walk", + "ctype": "AnimationInfoData" + } + ], + "ObjectData": { + "Length": 30.0, + "Position": { + "X": 0.0, + "Y": 0.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 0.0, + "RotationSkewX": 0.0, + "RotationSkewY": 0.0, + "CColor": {}, + "Children": [ + { + "Length": 220.0091, + "Position": { + "X": 54.0, + "Y": -25.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": -89.4791, + "RotationSkewX": -89.4791, + "RotationSkewY": -89.4791, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/6.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.327, + "ScaleY": 0.3831 + }, + "Position": { + "X": 132.2975, + "Y": 4.5362 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 89.4791, + "RotationSkewX": 89.4791, + "RotationSkewY": 89.4791, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": 0.6013, + "Y": 0.2268 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -22.7005, + "RightMargin": -231.2904, + "TopMargin": -232.53, + "BottomMargin": -149.47, + "ActionTag": 62746268, + "ZOrder": 5, + "Size": { + "X": 474.0, + "Y": 402.0 + }, + "Name": "6", + "ctype": "SpriteObjectData" + }, + { + "Length": 275.0363, + "Position": { + "X": 123.0, + "Y": -112.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 150.2165, + "RotationSkewX": 150.2165, + "RotationSkewY": 150.2165, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/1.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.1493, + "ScaleY": 0.9219 + }, + "Position": { + "X": -20.1246, + "Y": 0.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": -63.4349, + "RotationSkewX": -63.4349, + "RotationSkewY": -63.4349, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": -0.0732, + "Y": 0.0 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -50.1339, + "RightMargin": 124.1702, + "TopMargin": -4.992, + "BottomMargin": -295.008, + "ActionTag": 49282936, + "ZOrder": 9, + "Size": { + "X": 201.0, + "Y": 320.0 + }, + "Name": "1", + "ctype": "SpriteObjectData" + }, + { + "FileData": { + "Type": "Default", + "Path": "Default/Sprite.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "VisibleForFrame": false, + "AnchorPoint": { + "ScaleX": 0.5, + "ScaleY": 0.5 + }, + "Position": { + "X": 0.0, + "Y": 0.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": 0.0, + "Y": 0.0 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -23.0, + "RightMargin": 252.0363, + "TopMargin": -3.0, + "BottomMargin": -23.0, + "ActionTag": 40893240, + "Size": { + "X": 46.0, + "Y": 46.0 + }, + "Name": "25", + "ctype": "SpriteObjectData" + } + ], + "ActionTag": 27845503, + "ZOrder": 9, + "Size": { + "X": 275.0363, + "Y": 20.0 + }, + "Name": "Layer19", + "ctype": "BoneNodeObjectData" + }, + { + "Length": 301.9437, + "Position": { + "X": 257.0, + "Y": 29.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": -25.8124, + "RotationSkewX": -25.8124, + "RotationSkewY": -25.8124, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/hat.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.6681, + "ScaleY": 0.0437 + }, + "Position": { + "X": -49.9427, + "Y": 66.7343 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 115.2921, + "RotationSkewX": 115.2921, + "RotationSkewY": 115.2921, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": -0.1654, + "Y": 3.3367 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -351.9239, + "RightMargin": 201.8676, + "TopMargin": -484.7197, + "BottomMargin": 46.7197, + "ActionTag": 24018105, + "ZOrder": 8, + "Size": { + "X": 452.0, + "Y": 458.0 + }, + "Name": "hat", + "ctype": "SpriteObjectData" + }, + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/01.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "VisibleForFrame": false, + "AnchorPoint": { + "ScaleX": 0.5, + "ScaleY": 0.5 + }, + "Position": { + "X": 117.2713, + "Y": 21.1942 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": -277.9178, + "RotationSkewX": -277.9178, + "RotationSkewY": 82.0813, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": 0.3884, + "Y": 1.0597 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": 14.2713, + "RightMargin": 81.6724, + "TopMargin": -126.6942, + "BottomMargin": -104.3058, + "Tag": 93, + "ActionTag": -1841975498, + "Size": { + "X": 206.0, + "Y": 251.0 + }, + "Name": "fruit", + "ctype": "SpriteObjectData" + } + ], + "ActionTag": 32494840, + "ZOrder": 8, + "Size": { + "X": 301.9437, + "Y": 20.0 + }, + "Name": "Layer14", + "ctype": "BoneNodeObjectData" + }, + { + "Length": 168.6985, + "Position": { + "X": 20.0, + "Y": -33.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 171.6916, + "RotationSkewX": 171.6916, + "RotationSkewY": 171.6916, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/2.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.3387, + "ScaleY": 0.8135 + }, + "Position": { + "X": -3.9449, + "Y": -2.4885 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": -82.213, + "RotationSkewX": -82.213, + "RotationSkewY": -82.213, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": -0.0234, + "Y": -0.1244 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -66.9431, + "RightMargin": 49.6416, + "TopMargin": -24.5095, + "BottomMargin": -207.4905, + "ActionTag": 66418347, + "ZOrder": 6, + "Size": { + "X": 186.0, + "Y": 252.0 + }, + "Name": "2", + "ctype": "SpriteObjectData" + }, + { + "Length": 122.8903, + "Position": { + "X": 200.0, + "Y": 55.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 24.8229, + "RotationSkewX": 24.8229, + "RotationSkewY": 24.8229, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/7.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.4521, + "ScaleY": 0.9286 + }, + "Position": { + "X": -17.3824, + "Y": -14.789 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 252.9638, + "RotationSkewX": 252.9638, + "RotationSkewY": 252.9638, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": -0.1414, + "Y": -0.7394 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -83.389, + "RightMargin": 60.2793, + "TopMargin": 26.7922, + "BottomMargin": -118.7922, + "ActionTag": 11177013, + "ZOrder": 7, + "Size": { + "X": 146.0, + "Y": 112.0 + }, + "Name": "7", + "ctype": "SpriteObjectData" + } + ], + "ActionTag": 60894213, + "ZOrder": 7, + "Size": { + "X": 122.8903, + "Y": 20.0 + }, + "Name": "Layer27", + "ctype": "BoneNodeObjectData" + } + ], + "ActionTag": 14836356, + "ZOrder": 6, + "Size": { + "X": 168.6985, + "Y": 20.0 + }, + "Name": "Layer26", + "ctype": "BoneNodeObjectData" + }, + { + "Length": 160.1125, + "Position": { + "X": 16.0, + "Y": 20.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 205.4041, + "RotationSkewX": 205.4041, + "RotationSkewY": 205.4041, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/5.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.7579, + "ScaleY": 0.8305 + }, + "Position": { + "X": -16.5717, + "Y": 11.2171 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 244.0751, + "RotationSkewX": 244.0751, + "RotationSkewY": 244.0751, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": -0.1035, + "Y": 0.5609 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -160.5727, + "RightMargin": 130.6852, + "TopMargin": -31.2191, + "BottomMargin": -184.7809, + "ActionTag": 32922880, + "ZOrder": 3, + "Size": { + "X": 190.0, + "Y": 236.0 + }, + "Name": "5", + "ctype": "SpriteObjectData" + }, + { + "Length": 150.2431, + "Position": { + "X": 197.0, + "Y": 28.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 12.3178, + "RotationSkewX": 12.3178, + "RotationSkewY": 12.3178, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/4.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.7376, + "ScaleY": 0.8818 + }, + "Position": { + "X": -16.0185, + "Y": -4.9853 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 231.757, + "RotationSkewX": 231.757, + "RotationSkewY": 231.757, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": -0.1066, + "Y": -0.2493 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -120.0201, + "RightMargin": 129.2632, + "TopMargin": 11.9833, + "BottomMargin": -101.9833, + "ActionTag": 49507636, + "ZOrder": 4, + "Size": { + "X": 141.0, + "Y": 110.0 + }, + "Name": "4", + "ctype": "SpriteObjectData" + } + ], + "ActionTag": 27870469, + "ZOrder": 4, + "Size": { + "X": 150.2431, + "Y": 20.0 + }, + "Name": "Layer17", + "ctype": "BoneNodeObjectData" + } + ], + "ActionTag": 33484259, + "ZOrder": 3, + "Size": { + "X": 160.1125, + "Y": 20.0 + }, + "Name": "Layer16", + "ctype": "BoneNodeObjectData" + }, + { + "Length": 165.4871, + "Position": { + "X": 116.0, + "Y": 73.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 223.4995, + "RotationSkewX": 223.4995, + "RotationSkewY": 223.4995, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/8.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.8519, + "ScaleY": 0.9167 + }, + "Position": { + "X": -28.4311, + "Y": -8.3541 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 232.7294, + "RotationSkewX": 232.7294, + "RotationSkewY": 232.7294, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": -0.1718, + "Y": -0.4177 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -143.4376, + "RightMargin": 173.9247, + "TopMargin": 13.3601, + "BottomMargin": -173.3601, + "ActionTag": 50695543, + "ZOrder": 1, + "Size": { + "X": 135.0, + "Y": 180.0 + }, + "Name": "8", + "ctype": "SpriteObjectData" + }, + { + "Length": 313.3209, + "Position": { + "X": 106.0, + "Y": 0.0 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 29.8583, + "RotationSkewX": 29.8583, + "RotationSkewY": 29.8583, + "CColor": {}, + "Children": [ + { + "FileData": { + "Type": "Normal", + "Path": "testAnimationResource/3.png", + "Plist": "" + }, + "BlendFunc": { + "Src": 1, + "Dst": 771 + }, + "AnchorPoint": { + "ScaleX": 0.5951, + "ScaleY": 0.0877 + }, + "Position": { + "X": -1.5777, + "Y": -36.6707 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": 84.0616, + "RotationSkewX": 84.0616, + "RotationSkewY": 84.0616, + "CColor": {}, + "IconVisible": false, + "PrePosition": { + "X": -0.005, + "Y": -1.8335 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": -148.5674, + "RightMargin": 214.8883, + "TopMargin": -380.321, + "BottomMargin": -78.679, + "ActionTag": 12698356, + "ZOrder": 2, + "Size": { + "X": 247.0, + "Y": 479.0 + }, + "Name": "3", + "ctype": "SpriteObjectData" + }, + { + "FileData": { + "Type": "Normal", + "Path": "Particles/Comet.plist", + "Plist": "" + }, + "BlendFunc": { + "Src": 770, + "Dst": 1 + }, + "VisibleForFrame": false, + "AnchorPoint": {}, + "Position": { + "X": 45.1564, + "Y": 28.7503 + }, + "Scale": { + "ScaleX": 1.0, + "ScaleY": 1.0 + }, + "Rotation": -226.837, + "RotationSkewX": -226.837, + "RotationSkewY": -226.837, + "CColor": {}, + "IconVisible": true, + "PrePosition": { + "X": 0.1441, + "Y": 1.4375 + }, + "PreSize": { + "X": 0.0, + "Y": 0.0 + }, + "LeftMargin": 45.1564, + "RightMargin": 268.1645, + "TopMargin": -8.7503, + "BottomMargin": 28.7503, + "Tag": 92, + "ActionTag": 1464410937, + "Size": { + "X": 0.0, + "Y": 0.0 + }, + "Name": "fire", + "ctype": "ParticleObjectData" + } + ], + "ActionTag": 53606711, + "ZOrder": 2, + "Size": { + "X": 313.3209, + "Y": 20.0 + }, + "Name": "Layer20", + "ctype": "BoneNodeObjectData" + } + ], + "ActionTag": 42915540, + "ZOrder": 1, + "Size": { + "X": 165.4871, + "Y": 20.0 + }, + "Name": "Layer21", + "ctype": "BoneNodeObjectData" + } + ], + "ActionTag": 59167590, + "ZOrder": 5, + "Size": { + "X": 220.0091, + "Y": 20.0 + }, + "Name": "Layer15", + "ctype": "BoneNodeObjectData" + } + ], + "Size": { + "X": 30.0, + "Y": 30.0 + }, + "Name": "DemoPlayer", + "ctype": "SkeletonNodeObjectData" + }, + "UsedResources": [ + "testAnimationResource/4.png", + "testAnimationResource/5.png", + "testAnimationResource/2.png", + "testAnimationResource/hat.png", + "Default/Sprite.png", + "Particles/Comet.plist", + "testAnimationResource/8.png", + "testAnimationResource/01.png", + "testAnimationResource/1.png", + "testAnimationResource/3.png", + "testAnimationResource/7.png", + "testAnimationResource/6.png" + ], + "ctype": "GameProjectData" + } + }, + "Type": "Skeleton" +} \ No newline at end of file diff --git a/tests/cpp-tests/Resources/ActionTimeline/Particles/Comet.plist b/tests/cpp-tests/Resources/ActionTimeline/Particles/Comet.plist new file mode 100644 index 000000000000..a38247277f0f --- /dev/null +++ b/tests/cpp-tests/Resources/ActionTimeline/Particles/Comet.plist @@ -0,0 +1,102 @@ + + + + + angle + 46.849998474121094 + angleVariance + 0.0 + blendFuncDestination + 1 + blendFuncSource + 770 + duration + -1 + emitterType + 0.0 + finishColorAlpha + 1 + finishColorBlue + 0.0 + finishColorGreen + 0.0 + finishColorRed + 0.15999999642372131 + finishColorVarianceAlpha + 1 + finishColorVarianceBlue + 0.0 + finishColorVarianceGreen + 0.0 + finishColorVarianceRed + 0.0 + finishParticleSize + 64 + finishParticleSizeVariance + 0.0 + gravityx + -276.32000732421875 + gravityy + 355.260009765625 + maxParticles + 1000 + maxRadius + 100 + maxRadiusVariance + 0.0 + minRadius + 0.0 + particleLifespan + 0.19740000367164612 + particleLifespanVariance + 2.1710999011993408 + radialAccelVariance + 0.0 + radialAcceleration + 0.0 + rotatePerSecond + 0.0 + rotatePerSecondVariance + 0.0 + sourcePositionVariancex + -4.5 + sourcePositionVariancey + 0.0 + sourcePositionx + 226.5 + sourcePositiony + 156.39999389648438 + speed + 0.0 + speedVariance + 203.94999694824219 + startColorAlpha + 1 + startColorBlue + 0.14000000059604645 + startColorGreen + 0.43999999761581421 + startColorRed + 0.79000002145767212 + startColorVarianceAlpha + 0.5 + startColorVarianceBlue + 0.20000000298023224 + startColorVarianceGreen + 0.20000000298023224 + startColorVarianceRed + 0.0 + startParticleSize + 41.680000305175781 + startParticleSizeVariance + 0.0 + tangentialAccelVariance + 0.0 + tangentialAcceleration + 0.0 + textureFileName + Comet.png + textureImageData + H4sIAAAAAAAAA+1bB1RURxd+byu9g1RZpINUpVtoKoiKIqJYorisdESqLRINkihGjSHEFo0EC/ZoRCRWLMRoFHuPEIMlNizY4/5z3fvic7MrmJic84vr+Tjj7My997tt5i1L796UE0UFqlD/wUsqldJvgv/CJrTr35KrjBunGfyn/nib/FvIldsMmvXJWzOYejv8X8OZzYsnB74c5N9X5pO36od/wl8Jb3m+DD8BQtgMmHXyfpH3xVvxw9/h3wLe8nxVCFQRaiyoI9hzzDoVBf546354U/4t5M3mzPDUINAk0CLQVgItXKPB8ou8L17rh3+TvxLu8rwZzgxf4KVDoEugR6BPYEBgKAcDfE8P1+rgXsYfjC8U+eFv+6Al/BXkOzvminhrof16yMuIwJjAhMCUwIzAnMACYY5zprjGGPcYoAwdlKnID/K58Eb10Bz/FsRcRY63LsaR4WyGHC0JrAisCWwIbOVgg+9Z4VoL3Mv4Qh9ls/2g8k9zoYX8FXFnYq6OOarD4m2CMbVETsDPgcCJoD2BK4EbgTvCDefa4xoH3GONMsxRJuMHHdSpzsoFhT74J/ylf815ee4QB23MUUMWbxHG0wE5AT9PAi8CXwJ/ggA5+ON7XrjWDfc6oCwRyw+GqFMbbVDmg2ZzQBn/Zrgz+a7NirkZxgpsdSRwQR7eyK0LQRBBKEF3gjCCcEQYzoXimi64xxtluKBMG9RhxsoFxgdqf8cHivi3kDuT78YYF6hbe4wZ2OxD0JkgmKAHQQRBJEEUQTRBDMFARAzOReGaCNwTjDJ8UGZ71GGFOo2lL+vhb/ngNfzZNS+f82zu0KesMT5uGLNOBCEY20jkFkswjCCOQEwgIRiFkOBcHK6JxT2RKCMEZXqjDkfUaaHAB+xaaLYXyPNXEnuB9NV6Z7i3lcpyEnqWh1RWv4EYuz4EAwiGEowkSCBIJcggyCLIIchF5OBcBq5JwD1DUUYflBmIOjxQpw3awPiA3Q/YZ6PSHFDCX547nDPqctwtUL+zVJabUK+Qr5C7/QmGYEyTCcYgzwkE+QQfE0wlKERMxbl8XJOLe5JRxhCUGYE6/FGnM9rAzgNttJU5G1/xwev4K4g9u+bhvIGeC30Has8aYwB2QP+G3tVbKqvl4QSJGM+xyAs4FhHMIphDUExQgijGuVm4ZiruGYsyElFmDOoIRZ2eaIM12mSENmpKX+0FSnNAAX9leQ/1BecO9F7oP1CDHhgLsAdydJBUlrcpUllOT8L4zkSO8wkWEZQSlBEsRZTh3CJcU4x7ClFGDsociTr6oE5/tMERbTJDG9m94LU5wPBvJvZw54LcgrPXUirrwdCHoBaDMSZgF+RqOsZtCsYSuCxEfisIVhOsJ9hAsBGxAedW45pS3FOMMqagzHTUMQh1BqMNbmiTJdqojzY3mwNy/JXFHu6dTN5DvcE5BL0Y+hHUZAzGBuwbR1CA8ZtLsISgHPltIqgi2Eawg2AnYgfOVeGa9bhnCcqYiTLHoY6RqDMCbfBGm2ykL+tAtyU5oIS/stjDHQxyDeoOziPoydCXhktl+TkW7ZwtleUx5PUa5LSVYBfBPoL9BAcIDiIO4Nw+XLMV96xBGfNRZgHqSEGd/dGGTmiTI9rYbA6w+UtfzX12z2fqnh17uIvBfQTOZKhD6M3Qn6BGp2CswF6o63UElRjjGuRaS3CM4CTBKcRJnKvFNTW4pxJlLEWZM1FHDuocgjaEoE0ucjnA9AH2WfBKDbD4K8p9pufD2WIpld3Fwc9wJ4N7CZzNUI/Qo6FPQa3OxZiB3VsIqgl+Qm4nCM4QnCe4SFCHuIhzZ3BNLe6pRhnrUOZc1DEJdYrRhnC0yRNttESbmbNAaQ0o4M/OfThL4Rkc+iqcMUzdQ9+BuxncT+CMhpyEXg39Cmp2DcYO7IfcPkpwmuACQT3BbwSXCa4gLuNcPa45jXsOoIxKlLkEdRSizmS0IRJtYvqANdpsgByU1oAS/sx9h8l9uF/A8yj0WThzoObgfgp9CO4p+VJZbkLPhr4FtbsTYwg8zmKMgeNVgt8JbhDcRNzAuau45iLuOYoydqLMctQxE3WOQRui0SZ/tNEWbWZqgLkPNcdfUd+Xz314NoO+C3d0uKfCXW0qxgXOLejd0L+ghmsxlsCnATkC39sEdwjuIu7g3E1c04B7TqOMGpS5HnUUo85ctCEWbeoi/WsNKDoH2J8TKePP1D70UrhbwD0Lns3h+RTyDZ5T4K4O91WoSehPKzBO0MOhj0EtX8CYAq9byPUeQZMc7uF7t3Dtb7j3BMrahbJXoK4i1J2KtkSibV5oqxXarqgHyPNn9z75cw8+k2NqH+4acO+C51R4VoMelC+V3Vvh7gb3FzjD92HcoJ9BTV/F2AK/+wQPCB4SPEI8xLn7uOYm7qlHGbUoswp1LEKd+WhDHNoUijYyPcBU+tdzUP6ZSBl/du+DMwU+n4L6gs8poN6g98IzGzy3wN2dyX24x8BZDufZeenL2N/GGD9Azo8JniAe49wDXHNb+jIHzqOs/SibqYE5qDsLbYlG2/zRVhup4h74Ov7yvR/u0nCWMr0Pnjngsxq4e8EzO5zDTO3D+QT32B1SWd+GM/2iVNbbb2BcmzDWDPenCMYHD3HNHdxzGWWcRJk7UEeZ9GUPyEFbYtC2AOnLHmiOHJSeAUr4M8+6sJfp/e4oG85a+MwGPreA/gNnETzDwR0F7vLQq6Fe4V4DZzucb5DPd5HbIznubB88wjV3cc8VlHEKZe5EHUtRZyHaMAptCkcb3aUvzwCGv/p7/i3m31rzv7X3v9Z6/rX2+8/7++/755/3z7+t+/OPVvv5V2v//PP959/vf//R2n//9f73n6/NgVbx+28lOdCqvv8glwPydfDOf//lNTnQar7/9AY+eCe//9ZCH7zT33+U8wG7F8j74J39/quCHJD3wTv//Wc5H7BrgX02vrPff1fiB2W58E7+/UMLfKDID+/c378o8EFzfnjn/v7pDf3A+ELeH//Xf//WQj+wfcH2h7xf5HnK8+XKyXwrvFm2vw0xjCz6Nb5Q5BNFULSHftu8WTa/TXFsufK+eJ1PlHL9NzjL2flviZbXo8wf/ylfBXZRlBZRxyX/oalA8oNmjTkvxjyKCqyguThPFtMCHHPID114H2YpFVqPtcYQx+Rd2oglsw2zPpCizVnro1gy+/+pd/snWZSQojTCyHjfC5NV8B+N/8h7vZLSR3N0KCotPTszqkewaFDsYJHwEJGkSgkoD4qKE2dl9O7fPRq2h3cLEWWRRYwHZK5+cFI2OOYS1lckekMn6oozMrOJpL5k3CFekiUm4wIyTs3LzoD5RjI2GJkCYw5wN8gkBpKxMYwTZOP2L9bIxoEwjk9LjydjsDkjPi0exnvI+NPcHAkZc3uRcWFukiSPjI+TsU1qTloSGT+CvWmSuCziPg2Yz5aIE8nYnYw1MqOjQsi4E3GiRgJrPJI1zpaMzQZSIaMzxmUmJSRmixzEjiIPPz9fUZgkL1WSne3SN06cEpcZLwoZnZYRlz6OomScX7z0wLci4mRvDz9vbxdPVw+Wo177ZgtfEFvZ6F6/FzGjjQ6+nFO0bnQpRfk2Ed/Mfjk3ch5FbZ5KUcZnX87ZfENR2iRuFYdZfIwgXxKzszP83dzy8vJckyRiV3Don69mF7TgxdLnCuL+dI8oVDIqLic1WwR+E49OHZ2TKcrKiBNLRC6vJPE/2ajYjvZRklGSTEk62RFDsiwpPYGEOz0+KTtpdLooKV1ZEP/mNrmXLK/JS7/sOWUw3JXSOWxAcW8epHj66hR36CLyDv1n3HqpxlBQeQMtr8jy/sVLQQflzIIfWUkJL/aFREWLxDmZubL3oCwpPqVGaVMGlAnVlrKmHCgXypPyoQJIo+pG9aQiqWgqlvqAElOJVBqVSeVRE6nJVCFVRM2mvqTmU4upMqqcWkttoDZTW6ld1D7qAFVLnaDOUXVUA3WdaqQeUE9pmhbSmrQ+bUJb0ra0M+1J+9Jd6G50LzqKjqVH0Al0Op1DT6Q/povoOfR8egldTn9Hb6F30fvpI/QZup6+Rt+ln3C4HA2OAceCY8dx4/hygjgRnGjOME4CZwxnPKeAM5Mzl1PKWc2p4OziHOCc4NRxrnOaSANX5xpxrbguXF9uCDeSO5g7ipvJncSdzi3hlnLXcqu4Ndxj3DruDe5jnoCnzxPxXHgBvDDeAJ6YN4Y3iTeDN5+3glfB28M7xqvnNfKe8zX55nxnvj8/nD+In8DP4xfyS/jL+Jv4e/kn+A38BwKBwEhgL/ARhAliBcmCCYIZgq8F6wQ7BUcElwRNQqHQROgs7CyMFMYJs4WFwnnC1cIdwqPCBuEjFXUVSxVPle4qg1XSVaaolKisVNmuclTlispTVR1VW1V/1UjVeNVxqrNUy1SrVA+rNqg+VdNVs1frrBatlqw2WW2u2lq1vWrn1e6pq6u3U/dT76eepP6R+lz19eo/qterP9bQ03DSCNEYqpGjMVNjucZOjTMa9zQ1Ne00AzUHa2ZrztQs19yt+YvmIy19LVetcK14rXytBVoVWke1bmmrattqB2l/oD1eu0R7o/Zh7Rs6qjp2OiE6cTqTdBbobNE5pdOkq6/roRupm6Y7Q3el7n7dq3pCPTu9bnrxegV63+rt1rukz9W31g/RF+t/rF+mv1e/wUBgYG8QbpBsUGSwxuCQQaOhnmFHwxjDsYYLDLcZ1hlxjeyMwo1SjWYZbTA6afSkjUWboDaSNtParG1ztM1DYzPjQGOJ8XTjdcYnjJ+YiEy6maSYfG6y2eSCKc/UybSfaZ7pItO9pjfMDMwCzMRm0802mJ0155g7mUeZTzD/1vygeZNFW4seFhkW8yx2W9xoa9Q2sG1y2+K229tes9S37GKZZFlsucPyd5GhKEiUKpor2iNqtDK3CrPKsVpidcjqaTv7dgPaTWm3rt0FazVrX+tR1sXW1daNNpY2vW0m2qyyOWurautrm2j7lW2N7UM7e7uBdp/Ybba7am9sH24/3n6V/XkHTYeuDmMcSh2OOwocfR1THL92rHXiOHk5JTotcDrszHH2dk5y/tr5SHt+e7/26e1L259y0XAJcsl1WeVS72rk2st1iutm11tuNm6D3T53q3F77u7lnupe5n7OQ8+jp8cUjyqPu55OnmLPBZ7HO2h26N4hv0NlhzsdnTtKOi7qeNpL36u31yde1V5/ePt4Z3qv9b7mY+MzwmehzylfA9++vjN8f/Tj+wX75ftt9Xvs7+2f7b/B/3aAS0BKwMqAq53sO0k6lXW61Lld57jOSzrXdRF1GdHlmy51Xa26xnUt7fproHVgfOCywCtBjkHJQauDbgW7B2cGbwp+GOIf8mHIzlBuaI/Q6aGHuul1G9BtfrdfurfrntB9VffGHl49JvTYGcYPiwj7POxUuEW4OLw8vLGnT88Pe+6J0IjoHzE/4tdeTr0ye1X15vTu2fuL3uf72PZJ77M5kooMj/wi8kJf+75j+v7QT9Cvb78F/S5HeURNjKrpr99/eP+V/R9EB0fPij43wGFAzoDqGO2YoTHlMQ8Hhg6cM7BukNugDwcdiDWNTYqtHCwcHDN42eCmId2GfDmkYajX0MKhJ4fZDxs7bP8Hph+kfrBtuPbwuOEbR/BHDByxcsSzuMi40rimkeEjF45sFIeIvxJfjw+ML46/JuksmSO5MqrzqDmjriZ0Tvgi4Vpi18SSxBtJIUnzk+4khyUvTn6YEpmyPEWaOjB1XZpK2oi0Lel66Snpe0a3HT129JEM54zCjLox/mO+HNOYGZG5LIvOGpZVmW1ALlMHcxxypubU53bJXZD7KC8mb+NY3bHpYw+Ocxo3bdyV8d3HL53AmyCeUD3RauLkifUfBn24ZBI9aeSk6nzr/IL8ho96fLRistrklMk/T3GfMmfK/Y8HflxVYFHwUcGlqT2mrirUKswsPPVJwCeLP+V9mvTpoWkdps2b9nx6/PSfityLSoqezRDP+Okzj8/mfiadOWrmoVnesxbNFsxOn33y866fr5ijO2f8nEtf9P6iolhUPL34/pfDv9xf0rFk8VdqX+V8VTe319zKeTbzZs97Nj9x/okFwQvWLTRfOG3hw6/jvz66KHDR2sUWi4sWP/km6ZvTS3osqSi1Ky35VvBt7reXy2LKapb6Li1fZrqsaNkfy9OX162IWrGn3Ke8fKX5ylmrOKtyVl1bPXR17ZrQNZVrXdYuWWe0rmg9tT5n/e/fjfju5IaIDdUbfTeu/d72+4Wb9DdNr6ArxlU0bk7cXFcZW3lkS88t1VUBVZt+cP1h+VarrQu2GW6btV1te8F26Y7xO5p2Zuy8sSth16Xq4dXndg/afXxPvz2H9kbs/XFf9327a4JqdvzY+cet+/33b/nJ96fNB7wPVBz0OrjpZ6+fNx3yPlRx2OdwZa1fbdWRTke2H+16dNex0GP7jocfP3Ciz4kjJwecPH1q6Km60/Gnr55JPXPnbO7Zp+c+Os8/P/2CzoWSX8x/Kb3oeHFdnXfdtvrQ+oO/9v/13CXxpeu/Zf32rKHgsublkiuWV8qvel7deq37tdrfh/zecD3j+tMbhTd1by685XDr+9uBtw82DmpsuJN5R3p3xj2Te8vvd7xf3dS36ZcHaQ+ePpz+yOTRise+j2ueDHxy5WneM+GzuX84/lH1POL5eWmaVPo/LX7Mrg5NAAA= + + diff --git a/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csb b/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csb index ac49f55af724..4f0a138e0961 100644 Binary files a/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csb and b/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csb differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/01.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/01.png new file mode 100644 index 000000000000..9dd0f7a3f7de Binary files /dev/null and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/01.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/girl_arms.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/girl_arms.png new file mode 100644 index 000000000000..b4e473296826 Binary files /dev/null and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/girl_arms.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/01.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/01.png new file mode 100644 index 000000000000..9dd0f7a3f7de Binary files /dev/null and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/01.png differ diff --git a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj b/tests/cpp-tests/proj.win10/cpp-tests.vcxproj index 7610aab848f6..b3e847b122a1 100644 --- a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win10/cpp-tests.vcxproj @@ -759,4 +759,4 @@ - \ No newline at end of file + diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj index 26bbc1a209d6..68472a1ad4e0 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj @@ -626,4 +626,4 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - \ No newline at end of file + diff --git a/tests/js-tests/project.json b/tests/js-tests/project.json index 7b4a39043270..b085e88a3733 100644 --- a/tests/js-tests/project.json +++ b/tests/js-tests/project.json @@ -150,6 +150,7 @@ "src/CocoStudioTest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.js", "src/CocoStudioTest/CustomTest/CustomImageScene/CustomImageScene.js", "src/CocoStudioTest/CustomTest/CustomGUIScene.js", + "src/CocoStudioTest/ActionTimelineTest/ActionTimelineTest.js", "src/GUITest/UIScene.js", "src/GUITest/UIButtonTest/UIButtonTest.js", "src/GUITest/UICheckBoxTest/UICheckBoxTest.js", diff --git a/tests/js-tests/src/CocoStudioTest/ActionTimelineTest/ActionTimelineTest.js b/tests/js-tests/src/CocoStudioTest/ActionTimelineTest/ActionTimelineTest.js new file mode 100644 index 000000000000..7ea941e859ab --- /dev/null +++ b/tests/js-tests/src/CocoStudioTest/ActionTimelineTest/ActionTimelineTest.js @@ -0,0 +1,121 @@ +/**************************************************************************** + Copyright (c) 2013-2016 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. + ****************************************************************************/ + +var runActionTimeLineTest; + +(function(){ + + runActionTimeLineTest = function(){ + var scene = new cc.Scene(); + scene.addChild(new layer); + cc.director.runScene(scene); + }; + + var layer = cc.Layer.extend({ + + ctor: function(){ + cc.Layer.prototype.ctor.call(this); + + var json = ccs.load("ActionTimeline/DemoPlayer_skeleton.json"); + + var node = json.node, action = json.action; + + node.x = 200; + node.y = 160; + node.setScale(0.2); + this.addChild(node); + node.setDebugDrawEnabled(true); + if (action) { + node.runAction(action); + action.gotoFrameAndPlay(0, 40, true); + } + + this.createMenu(node, action); + }, + + createMenu: function(node, action){ + var menus = []; + + action.addAnimationInfo(new ccs.AnimationInfo("stand", 0, 40)); + action.addAnimationInfo(new ccs.AnimationInfo("walk", 41, 81)); + + var items = [ + { + title: "debug", + callback: function(){ + node.setDebugDrawEnabled(!node.isDebugDrawEnabled()); + } + },{ + title: "change animation", + callback: function(){ + if(action.getStartFrame() == 0) + action.gotoFrameAndPlay(41, 81, true); + else + action.gotoFrameAndPlay(0, 40, true); + } + },/*{ + title: "set Frame callback", + callback: function(evnt){ + action.setFrameEventCallFunc(function(){ + if("" == "changeColor"){ + evnt.getNode().setColor(cc.color(0,0,0)); + }else{ + evnt.getNode().setColor(cc.color(255,255,255)); + } + }, this); + } + },*/{ + title: "AnimationList: walk", + callback: function(){ + action.play("walk", true); + } + },{ + title: "AnimationList: stand", + callback: function(){ + action.play("stand", true); + } + } + + ]; + + items.forEach(function(item, index){ + var menuItem = new cc.MenuItemFont(item.title, item.callback, this); + menuItem.setPosition((index / 7 | 0) * 100, 120 - index % 7 * 30); + menus.push(menuItem); + }); + var menuItem = new cc.MenuItemFont("Back", function(){ + var scene = new CocoStudioTestScene(); + scene.runThisTest(); + }, this); + menuItem.setPosition(325, -175); + menus.push(menuItem); + + var menu = new cc.Menu(menus); + this.addChild(menu); + } + + + }); + +})(); \ No newline at end of file diff --git a/tests/js-tests/src/CocoStudioTest/CocoStudioTest.js b/tests/js-tests/src/CocoStudioTest/CocoStudioTest.js index b8e18bba3ef5..74d8ccfda203 100644 --- a/tests/js-tests/src/CocoStudioTest/CocoStudioTest.js +++ b/tests/js-tests/src/CocoStudioTest/CocoStudioTest.js @@ -51,6 +51,12 @@ var cocoStudioTestItemNames = [ testScene:function(){ runParserTest(); } + }, + { + itemTitle:"ActionTimeLineTest", + testScene:function () { + runActionTimeLineTest(); + } } ]; diff --git a/tests/js-tests/src/tests_resources.js b/tests/js-tests/src/tests_resources.js index 3afaf7da350d..c4c9319704ef 100644 --- a/tests/js-tests/src/tests_resources.js +++ b/tests/js-tests/src/tests_resources.js @@ -906,7 +906,9 @@ var g_cocoStudio = [ "Particles/BoilingFoam.plist", "ccs-res/cocosui/CustomImageViewTest/NewProject_2_1.ExportJson", "ccs-res/cocosui/CustomImageViewTest/NewProject_20.plist", - "ccs-res/cocosui/CustomImageViewTest/NewProject_20.png" + "ccs-res/cocosui/CustomImageViewTest/NewProject_20.png", + + "ActionTimeline/DemoPlayer_skeleton.json" ]; var g_ui = [ diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest2/CocoStudioActionTimelineTest2.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest2/CocoStudioActionTimelineTest2.lua new file mode 100644 index 000000000000..58a69c0eb6ef --- /dev/null +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioActionTimelineTest2/CocoStudioActionTimelineTest2.lua @@ -0,0 +1,726 @@ + +local itemTagBasic = 1000 +local timelineSceneIdx = 1 + +local winSize = cc.Director:getInstance():getWinSize() +local scheduler = cc.Director:getInstance():getScheduler() + +local TimelineTest2Scene = class("TimelineTest2Scene") +TimelineTest2Scene.__index = TimelineTest2Scene + +function TimelineTest2Scene.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TimelineTest2Scene) + return target +end + +function TimelineTest2Scene:runThisTest() + timelineSceneIdx = 1 + self:addChild(restartTimelineTest2()) +end + +function TimelineTest2Scene.create() + local scene = TimelineTest2Scene.extend(cc.Scene:create()) + local bg = cc.Sprite:create("armature/bg.jpg") + bg:setPosition(VisibleRect:center()) + + local scaleX = VisibleRect:getVisibleRect().width / bg:getContentSize().width + local scaleY = VisibleRect:getVisibleRect().height / bg:getContentSize().height + + bg:setScaleX(scaleX) + bg:setScaleY(scaleY) + + scene:addChild(bg) + return scene +end + +function TimelineTest2Scene.toMainMenuCallback() + +end + +local TimelineTest2Layer = class("TimelineTest2Layer") +TimelineTest2Layer.__index = TimelineTest2Layer +TimelineTest2Layer._backItem = nil +TimelineTest2Layer._restarItem = nil +TimelineTest2Layer._nextItem = nil + +function TimelineTest2Layer:onEnter() + +end + +local _titles = { + "debug", + "change animation", + "AnimationList: walk", + "AnimationList: stand", +} + +function TimelineTest2Layer.title(idx) + return _titles[idx] or ""; +end + +function TimelineTest2Layer.subTitle(idx) + return "" +end + +function TimelineTest2Layer.create() + local layer = TimelineTest2Layer.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +function TimelineTest2Layer.backCallback() + local newScene = TimelineTest2Scene.create() + newScene:addChild(backTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TimelineTest2Layer.restartCallback() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TimelineTest2Layer.nextCallback() + local newScene = TimelineTest2Scene.create() + newScene:addChild(nextTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TimelineTest2Layer:createMenu() + local menu = cc.Menu:create() + + self._backItem = cc.MenuItemImage:create(s_pPathB1, s_pPathB2) + self._backItem:registerScriptTapHandler(self.backCallback) + menu:addChild(self._backItem,itemTagBasic) + self._restarItem = cc.MenuItemImage:create(s_pPathR1, s_pPathR2) + self._restarItem:registerScriptTapHandler(self.restartCallback) + menu:addChild(self._restarItem,itemTagBasic) + self._nextItem = cc.MenuItemImage:create(s_pPathF1, s_pPathF2) + menu:addChild(self._nextItem,itemTagBasic) + self._nextItem:registerScriptTapHandler(self.nextCallback) + + local size = cc.Director:getInstance():getWinSize() + self._backItem:setPosition(cc.p(size.width / 2 - self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2)) + self._restarItem:setPosition(cc.p(size.width / 2, self._restarItem:getContentSize().height / 2)) + self._nextItem:setPosition(cc.p(size.width / 2 + self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2)) + + menu:setPosition(cc.p(0, 0)) + + self:addChild(menu) +end + +function TimelineTest2Layer.toExtensionMenu() + ccs.ArmatureDataManager:destroyInstance() + local scene = CocoStudioTestMain() + if scene ~= nil then + cc.Director:getInstance():replaceScene(scene) + end +end + +function TimelineTest2Layer:createToExtensionMenu() + cc.MenuItemFont:setFontName("Arial") + cc.MenuItemFont:setFontSize(24) + local menuItemFont = cc.MenuItemFont:create("Back") + menuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25)) + menuItemFont:registerScriptTapHandler(TimelineTest2Layer.toExtensionMenu) + + local backMenu = cc.Menu:create() + backMenu:addChild(menuItemFont) + backMenu:setPosition(cc.p(0, 0)) + self:addChild(backMenu,10) +end + +function TimelineTest2Layer:creatTitleAndSubTitle(idx) + print("set title") + local title = cc.Label:createWithTTF(TimelineTest2Layer.title(idx), "fonts/Thonburi.ttf", 18) + title:setColor(cc.c3b(255,0,0)) + self:addChild(title, 1, 10000) + title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30)) + local subTitle = nil + if "" ~= TimelineTest2Layer.subTitle(idx) then + local subTitle = cc.Label:createWithTTF(TimelineTest2Layer.subTitle(idx), "fonts/Thonburi.ttf", 18) + subTitle:setColor(cc.c3b(0,0,0)) + self:addChild(subTitle, 1, 10001) + subTitle:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 60) ) + end +end + +local TestActionTimeline = class("TestActionTimeline",TimelineTest2Layer) +TestActionTimeline.__index = TestActionTimeline + +function TestActionTimeline.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestActionTimeline) + return target +end + +function TestActionTimeline:onEnter() + + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb") + node:runAction(action) + action:gotoFrameAndPlay(0) + + node:setScale(0.2) + node:setPosition(VisibleRect:center()) + + self:addChild(node) +end + +function TestActionTimeline.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestActionTimeline.create() + local layer = TestActionTimeline.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +local TestChangePlaySection = class("TestChangePlaySection",TimelineTest2Layer) +TestChangePlaySection.__index = TestChangePlaySection + +function TestChangePlaySection.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestChangePlaySection) + return target +end + +function TestChangePlaySection:onEnter() + + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb") + node:runAction(action) + action:gotoFrameAndPlay(41) + + + node:setScale(0.2) + node:setPosition(VisibleRect:center()) + + action:addAnimationInfo(ccs.AnimationInfo("stand", 0 , 40)) + action:addAnimationInfo(ccs.AnimationInfo("walk", 41 , 81)) + action:addAnimationInfo(ccs.AnimationInfo("killall", 174, 249)) + + assert(action:IsAnimationInfoExists("stand") == true, "stand animation didn't exist") + action:play("stand", true) + assert(action:getAnimationInfo("stand").endIndex == 40, "endIndex of animationInfo is not 40") + action:removeAnimationInfo("stand") + assert(action:IsAnimationInfoExists("stand") == false, "stand animation has already existed") + + local function onTouchesEnded(touches, event) + if action:getStartFrame() == 0 then + action:gotoFrameAndPlay(41, 81, true) + else + action:gotoFrameAndPlay(0, 40, true) + end + end + + local listener = cc.EventListenerTouchAllAtOnce:create() + listener:registerScriptHandler(onTouchesEnded,cc.Handler.EVENT_TOUCHES_ENDED ) + + local eventDispatcher = self:getEventDispatcher() + eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self) + + self:addChild(node) +end + +function TestChangePlaySection.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestChangePlaySection.create() + local layer = TestChangePlaySection.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +local TestTimelineFrameEvent = class("TestTimelineFrameEvent",TimelineTest2Layer) +TestTimelineFrameEvent.__index = TestTimelineFrameEvent + +function TestTimelineFrameEvent.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestTimelineFrameEvent) + return target +end + +function TestTimelineFrameEvent:onEnter() + + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb") + node:runAction(action) + action:gotoFrameAndPlay(0) + + node:setScale(0.2) + node:setPosition(VisibleRect:center()) + self:addChild(node) + + local function onFrameEvent(frame) + if nil == frame then + return + end + + local str = frame:getEvent() + + if str == "changeColor" then + frame:getNode():setColor(cc.c3b(0, 0, 0)) + elseif(str == "endChangeColor") then + frame:getNode():setColor(cc.c3b(255,255,255)) + end + end + + action:setFrameEventCallFunc(onFrameEvent) +end + +function TestTimelineFrameEvent.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestTimelineFrameEvent.create() + local layer = TestTimelineFrameEvent.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +local TestTimelinePerformance = class("TestTimelinePerformance",TimelineTest2Layer) +TestTimelinePerformance.__index = TestTimelinePerformance + +function TestTimelinePerformance.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestTimelinePerformance) + return target +end + +function TestTimelinePerformance:onEnter() + + for i = 1,100 do + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb") + node:runAction(action) + action:gotoFrameAndPlay(41) + + node:setScale(0.1) + node:setPosition((i - 1) * 2, 100) + self:addChild(node) + end +end + +function TestTimelinePerformance.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestTimelinePerformance.create() + local layer = TestTimelinePerformance.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +------------------------------------------- +---TestTimelineAnimationList +------------------------------------------- +local TestTimelineAnimationList = class("TestTimelineAnimationList",TimelineTest2Layer) +TestTimelineAnimationList.__index = TestTimelineAnimationList + +function TestTimelineAnimationList.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestTimelineAnimationList) + return target +end + +function TestTimelineAnimationList:onEnter() + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb") + local standInfo = ccs.AnimationInfo("stand", 0, 40) + local walkInfo = ccs.AnimationInfo("walk", 41, 81) + action:addAnimationInfo(standInfo) + action:addAnimationInfo(walkInfo) + node:runAction(action) + action:play("walk", true) + + node:setScale(0.2) + node:setPosition(150,100) + self:addChild(node) +end + +function TestTimelineAnimationList.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestTimelineAnimationList.create() + local layer = TestTimelineAnimationList.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + + +------------------------------------------- +---TestTimelineProjectNode +------------------------------------------- +local TestTimelineProjectNode = class("TestTimelineProjectNode",TimelineTest2Layer) +TestTimelineProjectNode.__index = TestTimelineProjectNode + +function TestTimelineProjectNode.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestTimelineProjectNode) + return target +end + +function TestTimelineProjectNode:onEnter() + local node = cc.CSLoader:createNode("ActionTimeline/TestAnimation.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/TestAnimation.csb") + + node:runAction(action) + action:gotoFrameAndPlay(0, true) + + node:setPosition(-300, -300) + self:addChild(node) +end + +function TestTimelineProjectNode.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestTimelineProjectNode.create() + local layer = TestTimelineProjectNode.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + + +------------------------------------------- +---TestProjectNodeForSimulator +------------------------------------------- +local TestProjectNodeForSimulator = class("TestProjectNodeForSimulator",TimelineTest2Layer) +TestProjectNodeForSimulator.__index = TestProjectNodeForSimulator + +function TestProjectNodeForSimulator.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestProjectNodeForSimulator) + return target +end + +function TestProjectNodeForSimulator:onEnter() + local node = cc.CSLoader:getInstance():createNodeWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd") + local action = ccs.ActionTimelineCache:getInstance():createActionWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd") + + node:runAction(action) + action:gotoFrameAndPlay(0, true) + + node:setPosition(-300, -300) + self:addChild(node) + + --test for when ProjectNode file lost + local lackProjectNodefileNode = cc.CSLoader:getInstance():createNodeWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd") + local lackProjectNodefileAction = ccs.ActionTimelineCache:getInstance():createActionWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd") + lackProjectNodefileNode:runAction(lackProjectNodefileAction) + lackProjectNodefileAction:gotoFrameAndPlay(0) + self:addChild(lackProjectNodefileNode) +end + +function TestProjectNodeForSimulator.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestProjectNodeForSimulator.create() + local layer = TestProjectNodeForSimulator.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +------------------------------------------- +---TestTimelineNodeLoadedCallback +------------------------------------------- +local TestTimelineNodeLoadedCallback = class("TestTimelineNodeLoadedCallback",TimelineTest2Layer) +TestTimelineNodeLoadedCallback.__index = TestTimelineNodeLoadedCallback + +function TestTimelineNodeLoadedCallback.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestTimelineNodeLoadedCallback) + return target +end + +function TestTimelineNodeLoadedCallback:onEnter() + local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer_skeleton.csb", function(object) + if nil ~= object then + print("object type is ", tolua.type(object)) + print("node name = ",object:getName()) + print("node parent name = ", object:getParent():getName()) + end + end) + local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer_skeleton.csb") + node:runAction(action) + action:gotoFrameAndPlay(0) + + node:setScale(0.2) + node:setPosition(VisibleRect:center()) + + self:addChild(node) +end + +function TestTimelineNodeLoadedCallback.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestTimelineNodeLoadedCallback.create() + local layer = TestTimelineNodeLoadedCallback.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +------------------------------------------- +---TestActionTimelineEase +------------------------------------------- +local TestActionTimelineEase = class("TestActionTimelineEase",TimelineTest2Layer) +TestActionTimelineEase.__index = TestActionTimelineEase + +function TestActionTimelineEase.extend(target) + local t = tolua.getpeer(target) + if not t then + t = {} + tolua.setpeer(target, t) + end + setmetatable(t, TestActionTimelineEase) + return target +end + +function TestActionTimelineEase:onEnter() + local node = cc.CSLoader:createNode("ActionTimeline/ActionTimelineEase.csb") + local action = cc.CSLoader:createTimeline("ActionTimeline/ActionTimelineEase.csb") + node:runAction(action) + action:gotoFrameAndPlay(0) + self:addChild(node) +end + +function TestActionTimelineEase.restartCallback() + ccs.ArmatureDataManager:destroyInstance() + local newScene = TimelineTest2Scene.create() + newScene:addChild(restartTimelineTest2()) + cc.Director:getInstance():replaceScene(newScene) +end + +function TestActionTimelineEase.create() + local layer = TestActionTimelineEase.extend(cc.Layer:create()) + + if nil ~= layer then + layer:createMenu() + layer:createToExtensionMenu() + layer:creatTitleAndSubTitle(timelineSceneIdx) + local function onNodeEvent(event) + if "enter" == event then + layer:onEnter() + end + end + layer:registerScriptHandler(onNodeEvent) + end + + return layer +end + +local actionlineSceneArr = +{ + TestActionTimeline.create, + TestChangePlaySection.create, + TestTimelineFrameEvent.create, + TestTimelinePerformance.create, + TestTimelineAnimationList.create, + TestTimelineProjectNode.create, + TestProjectNodeForSimulator.create, + TestTimelineNodeLoadedCallback.create, + TestActionTimelineEase.create, +} + +function nextTimelineTest2() + timelineSceneIdx = timelineSceneIdx + 1 + timelineSceneIdx = timelineSceneIdx % table.getn(actionlineSceneArr) + if 0 == timelineSceneIdx then + timelineSceneIdx = table.getn(actionlineSceneArr) + end + return actionlineSceneArr[timelineSceneIdx]() +end + +function backTimelineTest2() + timelineSceneIdx = timelineSceneIdx - 1 + if timelineSceneIdx <= 0 then + timelineSceneIdx = timelineSceneIdx + table.getn(actionlineSceneArr) + end + + return actionlineSceneArr[timelineSceneIdx]() +end + +function restartTimelineTest2() + return actionlineSceneArr[timelineSceneIdx]() +end + +function runCocoStudioActionTimelineTest2Scene() + local scene = TimelineTest2Scene.create() + scene:runThisTest() + cc.Director:getInstance():replaceScene(scene) +end diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioTest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioTest.lua index 3776489105f3..c0b90397b8c8 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioTest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioTest.lua @@ -3,29 +3,30 @@ require "CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest" require "CocoStudioTest/CocoStudioArmatureTest/CocoStudioArmatureTest" require "CocoStudioTest/CocoStudioUIEditorTest/CocoStudioUIEditorTest" require "CocoStudioTest/CocoStudioActionTimelineTest/CocoStudioActionTimelineTest" +require "CocoStudioTest/CocoStudioActionTimelineTest2/CocoStudioActionTimelineTest2" local LINE_SPACE = 40 local ITEM_TAG_BASIC = 1000 -local cocoStudioTestItemNames = +local cocoStudioTestItemNames = { { itemTitle = "CocoStudioArmatureTest", - testScene = function () + testScene = function () runArmatureTestScene() end }, { itemTitle = "CocoStudioGUITest", - testScene = function () + testScene = function () runCocosGUITestScene() end }, { itemTitle = "CocoStudioSceneTest", - testScene = function () + testScene = function () runCocosSceneTestScene() end }, @@ -43,7 +44,14 @@ local cocoStudioTestItemNames = runCocoStudioActionTimelineTestScene() end }, -} + + { + itemTitle = "CocoStudioActionTimelineTest2", + testScene = function() + runCocoStudioActionTimelineTest2Scene() + end + }, +} local CocoStudioTestScene = class("CocoStudioTestScene") CocoStudioTestScene.__index = CocoStudioTestScene @@ -66,7 +74,7 @@ end function CocoStudioTestScene.create() local scene = CocoStudioTestScene.extend(cc.Scene:create()) - return scene + return scene end local CocoStudioTestLayer = class("CocoStudioTestLayer") @@ -111,7 +119,7 @@ function CocoStudioTestLayer.create() if nil ~= layer then layer:createMenu() - end + end return layer end diff --git a/tools/bindings-generator b/tools/bindings-generator index 0d1ba26b40f0..24b94fbac664 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 0d1ba26b40f0825bafcb935640d2366e65df4ed9 +Subproject commit 24b94fbac6642fc5b46deb4b03a508319e202195 diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist index b4d91ddeaab7..676632476908 100644 --- a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist +++ b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist @@ -41,7 +41,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.7 + 3.7.1 CFBundleSignature ???? CFBundleVersion diff --git a/tools/tojs/cocos2dx_studio.ini b/tools/tojs/cocos2dx_studio.ini index 720a5b11c0b2..57f9fa4cf04d 100644 --- a/tools/tojs/cocos2dx_studio.ini +++ b/tools/tojs/cocos2dx_studio.ini @@ -23,11 +23,11 @@ cxxgenerator_headers = extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s # what headers to parse -headers = %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h %(cocosdir)s/cocos/editor-support/cocostudio/CCObjectExtensionData.h %(jsbdir)s/manual/cocostudio/jsb_cocos2dx_studio_conversions.h +headers = %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h %(cocosdir)s/cocos/editor-support/cocostudio/CCComExtensionData.h %(jsbdir)s/manual/cocostudio/jsb_cocos2dx_studio_conversions.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = Armature ArmatureAnimation Skin Bone ColliderDetector ColliderBody ArmatureDataManager InputDelegate ComController ComAudio ComAttribute ComRender ActionManagerEx SceneReader GUIReader BatchNode ActionObject BaseData Tween ColliderFilter DisplayManager DecorativeDisplay ProcessBase AnimationData MovementData ContourData TextureData ActionTimelineData ActionTimeline ActionTimelineCache Frame TextureFrame RotationFrame SkewFrame VisibleFrame RotationSkewFrame PositionFrame ScaleFrame AnchorPointFrame InnerActionFrame ColorFrame AlphaFrame EventFrame ZOrderFrame NodeReader Timeline CSLoader ObjectExtensionData +classes = Armature ArmatureAnimation Skin Bone ColliderDetector ColliderBody ArmatureDataManager InputDelegate ComController ComAudio ComAttribute ComRender ActionManagerEx SceneReader GUIReader BatchNode ActionObject BaseData Tween ColliderFilter DisplayManager DecorativeDisplay ProcessBase AnimationData MovementData ContourData TextureData ActionTimelineData ActionTimeline ActionTimelineCache Frame TextureFrame RotationFrame SkewFrame VisibleFrame RotationSkewFrame PositionFrame ScaleFrame AnchorPointFrame InnerActionFrame ColorFrame AlphaFrame EventFrame ZOrderFrame NodeReader Timeline CSLoader ComExtensionData BoneNode SkeletonNode # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -80,4 +80,4 @@ abstract_classes = ColliderDetector ColliderBody ArmatureDataManager InputDelega # Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'. script_control_cpp = no -classes_need_extend = Armature ComController +classes_need_extend = Armature ComController BoneNode SkinNode SkeletonNode diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index 3bf6bb9d1c26..9ff7d738263d 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h % # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$ AsyncTaskPool RenderState Material Properties Technique Pass PolygonInfo AutoPolygon +classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$ AsyncTaskPool RenderState Material Properties Technique Pass PolygonInfo AutoPolygon BoneNode SkeletonNode # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also diff --git a/tools/tolua/cocos2dx_studio.ini b/tools/tolua/cocos2dx_studio.ini index 9ba18554114a..6857ea2751e3 100644 --- a/tools/tolua/cocos2dx_studio.ini +++ b/tools/tolua/cocos2dx_studio.ini @@ -26,11 +26,11 @@ cxxgenerator_headers = extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s # what headers to parse -headers = %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h %(cocosdir)s/cocos/scripting/lua-bindings/manual/cocostudio/lua-cocos-studio-conversions.h +headers = %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h %(cocosdir)s/cocos/editor-support/cocostudio/CCComExtensionData.h %(cocosdir)s/cocos/scripting/lua-bindings/manual/cocostudio/lua-cocos-studio-conversions.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ ActionManagerEx ComAudio ComController ComAttribute ComRender BatchNode SceneReader GUIReader ActionObject Tween DisplayManager NodeReader ActionTimeline.* .*Frame$ Timeline ActionTimelineNode +classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ ActionManagerEx ComAudio ComController ComAttribute ComRender BatchNode SceneReader GUIReader ActionObject Tween DisplayManager NodeReader ActionTimeline.* .*Frame$ Timeline ActionTimelineNode ComExtensionData BoneNode SkeletonNode # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also diff --git a/tools/travis-scripts/travis_mac.yml b/tools/travis-scripts/travis_mac.yml index 0d672ed1b4b7..d5ea1235f92b 100644 --- a/tools/travis-scripts/travis_mac.yml +++ b/tools/travis-scripts/travis_mac.yml @@ -16,5 +16,4 @@ notifications: # whitelist branches: only: - - v3.7-release - v3