dragonbones / dragonbonescpp Goto Github PK
View Code? Open in Web Editor NEWDragonBones C++ Runtime
License: MIT License
DragonBones C++ Runtime
License: MIT License
不是帧事件回调,是没知道添加龙骨动画帧事件的地方
实在flash里边,还是在哪里加入呢?
static const auto DEFAULT_NAME = ""; creates a char* not a std::string. As result the address of a stack variable is returned. Simple fix, force the static instance to be a std::string - see diff below.
--- a/DragonBones/src/dragonBones/animation/Animation.cpp
+++ b/DragonBones/src/dragonBones/animation/Animation.cpp
@@ -447,7 +447,7 @@ bool Animation::getIsCompleted() const
const std::string& Animation::getLastAnimationName() const
{
- static const auto DEFAULT_NAME = "";
+ static const std::string DEFAULT_NAME = "";
return _lastAnimationState ? _lastAnimationState->getName() : DEFAULT_NAME;
}
done.
The main file : https://github.com/Relvin/dragonbones/blob/master/dragonbones/parsers/BinaryParser.h
it would be great if dragonbones support flatbuffers for small file size.
为什么是先remove,然后再add到最顶层,而不是直接slot->addDisplayToContainer(_display, i);
如题
DBCPP 现在lua事件回调直接将参数列表作为回调函数的参数列表,这样的缺点是想要增加参数就需要再向参数列表末尾添加,会打乱参数的优先级,比如后面要添加Armature的参数就要放到最后,但是这是一个重要参数。
-- @param db.DBCCArmatureNode armatureNode
-- @param int movementType
-- @param string movementId
-- @param bool isLastMovementId
local function onMovementEvent( armatureNode, movementType, movementID, isLastMovementId)
end
-- @param db.DBCCArmatureNode armatureNode
-- @param int movementType
-- @param string movementId
-- @param string frameLabel
local function onFrameEvent( armatureNode, movementType, movementID, frameLabel )
end
armatureNode:registerMovementEventHandler(onMovementEvent)
armatureNode:registerFrameEventHandler(onFrameEvent)
修改参数形式,将所有参数封装到一个table中,那么后续添加参数会很方便,也不影响现有的代码。
-- @param table event
-- db.DBCCArmature armature
-- db.DBCCArmatureNode armatureNode
-- int type
-- string boneName
-- string movementId
-- string frameLabel
-- bool isLastMovementId
local function onEvent( event )
end
armatureNode:registerMovementEventHandler(onEvent)
armatureNode:registerFrameEventHandler(onEvent)
大家看这个table 中属性名是否需要修改,如果不修改过段时间我会提交上去。
添加自动测试,以保证pr的代码不会有问题,至少是编译时错误。
When I run demo project with cocos2d-x 2.2.3, I got crash at CCTextureAtlas.cpp line 619:
glBufferData(GL_ARRAY_BUFFER, sizeof(m_pQuads[0]) * (n-start), NULL, GL_DYNAMIC_DRAW);
void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
memcpy(buf, m_pQuads, sizeof(m_pQuads[0])* (n-start));
glUnmapBuffer(GL_ARRAY_BUFFER);
It's called by m_pTextureAtlas->drawNumberOfQuads(1, m_nQuadIndex);
Is this the bug of DragonBoneCpp or cocos2d-x?
看了下代码,似乎还不支持变色的所有参数 alphaOffset redMultiplier 等等,只是从xml中读出来了。需要添加shader处理吗?
如题
是DBCCSlot::updateDisplayBlendMode函数里的 if (_childArmature) 条件放在 if (spriteDisplay) 条件里的原因吧?
我们自己的程序,把判断移出来之后blendfunc变为正常,但是我现在无法确定这个是bug还是因为特殊的设定。
Hi!, I'm trying to compile the Cocos2dx 3.0 demo that comes with this library to make it work in Android (DragonBonesCPP-dev\demos\cocos2d-x-3.x\DragonBonesCppDemos)
But I'm getting trouble making it work. Specially because there are not android-mk files in the renderer/cocos2dx3.0 folder. I tried to make it myself but I can't get the include files right.
Is there any working test sample for using Cocos2dx 3.0 with DragonBones?
Im using Eclipse and windows 7.
Thanks in Advance, Really great library!!
在optimization临时分支中,初步做了修改:
DragonBonesCPP seems to have cloned code from SkeletonAnimationLibraryCPP. Is it intended to replace SkeletonAnimationLibraryCPP? Thanks.
调用代码
local bone=self.body:getCCSlot("Layer_11")
self.gy=db.buildArmatureNode("zf")
self:add(self.gy)
bone:setChildArmature(self.gy:getArmature())
self.gy:pos(100,100)
self.gy:getAnimation():gotoAndPlay("stand", -1, -1, 0)
出错位置
DBCCArmatureNode::~DBCCArmatureNode()
{
unregisterFrameEventHandler();
unregisterMovementEventHandler();
if (_clock)
{
_clock->remove(this);
_clock = nullptr;
}
if (_armature)
{
delete _armature;//《-----------------------崩溃后调试armature已经被释放掉了
_armature = nullptr;
}
}
是我的用法有问题么?
Previous version breaks on Visual Studio while firing up in debug mode.
But latest version crashes anyway.
Please solve the bug! It's fatal!
好像龙骨动画的性能并不高,我们测试官方的小绿龙,在iPad3上同时跑100个,帧数掉到了25帧左右,这是完全无法接受的。
不知道是动画本身复杂度的问题,还是播放框架的问题?动画制作的过程中,有没有什么需要注意的地方,可以提高性能的?代码上有没有什么缓存或者其他方式可以提高性能?
Hi.
I am using cocos2d-x 3.2 and DragonBonesCPP dev branch.
The DragonBonesHeaders.h includes CCDragonBones.h This file only exist in renderer\cocos2d-x-2.x and not in renderer\cocos2d-x-3.x.
Error : Expression: vector subscript out of range
On : BaseTimelineState.h line 277
const auto currentFrame = _timeline->frames[currentFrameIndex];
_timeline->bone is NULL ? and _timeline->frames have zero frame inside ?
at passed time == 0.0f it still working but when passed time insert from 0.0f to 0.xxxf ( on the first time ) it cause that error.
my implement :
dragonBones::CCFactory _factory;
_factory.loadDragonBonesData(_refInfo->armaturePath);
_factory.loadTextureAtlasData(_refInfo->armatureTexture);
_armature = _factory.buildArmatureDisplay(_refInfo->armatureName, _refInfo->armatureDataName);
_armature->getAnimation().fadeIn(_refInfo->armatureAnimationIdie);
i ran on cocos2d-x 3.8
happen with any dragonbones file at Demo folder.
I would like to point out that identifiers like "__ARMATURE_H__
" and "__BONE_H__
" do not fit to the expected naming convention of the C++ language standard.
Would you like to adjust your selection for unique names?
TimelineState::update裡面
if(progress == 1)
{
progress = 0.99999999f;
}
0.99999999f 趨近於 1
0.99999997f 趨近於 0.99999994f
cocos2dx 中 getBoundingBox
返回flash中 getBounds(parent)
的值
现在DBCCArmatureNode::getBoundingBox
返回flash中 getBounds(null)
的值
使用 getInnerBoundingBox
来返回 flash中 getBounds(null)
getBoundingBox
还是按照cocos2dx中的规则来返回flash中 getBounds(parent)
问题:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := dragonbones_static
LOCAL_MODULE_FILENAME := libdragonbones
LOCAL_SRC_FILES := ../../../animation/Animation.cpp
../../../animation/AnimationState.cpp
../../../animation/TimelineState.cpp
../../../animation/WorldClock.cpp
../../../core/Armature.cpp
../../../core/Bone.cpp
../../../core/Object.cpp
../../../core/Slot.cpp
../../../events/EventData.cpp
../../../factories/BaseFactory.cpp
../../../parsers/BaseDataparser.cpp
../../../parsers/ConstValues.cpp
../../../parsers/XMLDataParser.cpp
../../../parsers/dbtinyxml2.cpp
../DBCCArmature.cpp
../DBCCArmatureNode.cpp
../DBCCFactory.cpp
../DBCCSlot.cpp
LOCAL_C_INCLUDES :=
$(LOCAL_PATH)/..
$(LOCAL_PATH)/../../..
$(LOCAL_PATH)/../../../../../../cocos/2d
$(LOCAL_PATH)/../../../../../../external/lua/tolua
$(LOCAL_PATH)/../../../../../../external/lua/luajit/include
$(LOCAL_PATH)/../../../../../../cocos/scripting/lua-bindings/manual
LOCAL_EXPORT_C_INCLUDES :=
$(LOCAL_PATH)/..
$(LOCAL_PATH)/../../..
LOCAL_CFLAGS += -fexceptions
LOCAL_STATIC_LIBRARIES := cocos2dx_internal_static
include $(BUILD_STATIC_LIBRARY)
gotoAndPlay中 沒有更新Bone 跟 Slot設置
在CCDragonBones::update之前
Cocos2dxDisplayBridge被更新導致閃爍
使用最新的3.9framework生成的lua_dragonbones_auto.cpp中的getDragonBonesDataMap()方法报错。看本官方DragonbonesCPPForLua中没这个方法,该怎么处理?dragonbones.ini中删了这方法?
The main file : BinaryParser
it would be great if dragonbones support flatbuffers for small file size.
I suggest to change name of the directory /library
to /dragon-bones
.
The most straightforward motivation is for Android's Makefile, which needs to import the library by the name of directory which contains the library's Android.mk
. So, currently the line in Android.mk
to import the DragonBones library will look like this:
$(call import-module, library)
which is very confusing. Moreover, if more than one project follow such naming convention, there will be name conflicts when an application needs to import libraries from all of them. Although we can "solve" the problem by adding the parent directory of DragonBonesCPP to NDK_MODULE_PATH
and use DragonBonesCPP/library
for import-module
, but that will restrict the user renaming the top level directory DragonBonesCPP
, which makes no sense.
Such renaming is also consistent with other projects. For example, in cocos2d-x the main source code directory is /cocos2dx
. To import cocos2dx library in Android.mk
, the line will look like this:
$(call import-module, cocos2dx)
Thanks!
是否能够提供一个结构可以跳转到某动画的指定帧播放?
Hi there!
Excuse me! Can you show me how to detect collision by Box2D physics or how to use function boundingbox() to detect collision.
i saw that coordinate of the Armature and the ArmatureNode are not same. So, we need to convert it to same coordinate, is it right?
Why don't we intergration the Box2D lib into Armature to use it?
Sorry. I'm not good at English
dear.
我加了12个角色(总共5个不同的角色),魅族mx3上的帧数只有10帧左右,touch4是40帧左右,用的版本是quick2.2.5
has someone can merge this? #110
需要改的地方非常多,官方有升级计划吗?
DragonBonesCpp现在有支持4.0以上版本制作的龙骨文件解析吗
动画师那里用flash 做完,用一个插件导出 http://dragonbones.effecthub.com/
导出之后发现blendMode这个字段就没有了。是因为这个插件的问题嘛?
请问,你们有推荐的插件嘛?
Env: Windoows 10 Insider Preview 14371 64bit
Visual Studio 2013
This exception won't be raised without IDE.
当前的例子是把图片打包到texture.png里面。这样换装不符合项目实际需要。
比如一个换装游戏,几百上千的衣服,裤子。这种情况肯定衣服都是一张一张的外部图片。
我想請教一下 我們在使用flash編輯動畫時 發生了同一個動作 在第二次播放後 元件沒有改回原本顏色狀態
我的推測是 當我在 TimelineState::updateToNextFrame 這個函式下
由於第二次播放元件時 該bone的_isColorChanged == false 所以沒有還原上次造成的效果
我們設計的案例是這樣的 有一個timeline 內有3條補間動畫影格 其中第1條是一個image 第二第三條是另一個image
不過在第三條 我們改變了color transform
我有想出一個方法解決 就是無視上述 _isColorChanged 的判斷 只要一切換就將bone的顏色還原
但不知道這樣做會不會影響舊有系統?
感謝
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.