A GDExtension plugin to add DragonBones for Godot.
- Godot: https://godotengine.org
- DragonBones: http://dragonbones.com
- A simple demo from @blurymind: https://github.com/blurymind/godot4-dragonbones-demo-animations-and-slots/tree/main.
- Godot 4.2 +
- DragonBones Pro 5.6
- Download from release page.
- Download from Assets Library.
- Clone this repo and compile by youself.
-
Clone this repo with submodules.
-
Ensure you have "python", "Scons", and a appropriate c++ compiler.
-
Navigate to the root of local repo, run compile command, for example: For debug:
scons target=template_debug debug_symbols=yes
For release:
scons target=template_release
Please refer the build system system of godot-cpp for more compile options.
-
If compileing is successully, you can get the compiled plugin in
demo/addons/gddragonbones
.
The "master" branch has not contains compiled libraries, "demo" project can't be run correctly if you clone this branch or download it as zip archive and run it directly!
To run "demo" project, here have 3 way:
- Compile this plugin by following the previous part that "How to compile".
- Download appropriate archive from release page, and plug it into "demo" project.
- Open "demo" project directly, ignore errors and warnings, goto "Asset Library", use "Godot-DragonBones" as keyword to search this plugin and install it, than reboot the editor.
- Web: "Extensions Support" is required; "Thread Support" is requred if you use the precompiled plugin.
This repository is improved from gddragonbones.
- Change to GDExtension for Godot 4.x.
- Implement a import plugin to import DragonBones files automatically.
- Imported Resource is
DragonBonesFoctory
:- One factory can contain multi DragonBones data and Atlas data files.
- Can select DragonBones data and skin which are in factory to instantiate in
DragonBones
node. - If detect DragonBones assets (for example, xxx_ske.json/dbbin and xxx_tex.json) in editor, it will generate a factory resource(xxx_ske.dbfactory) at the same folder.
DragonBones
node:- Remove mostly methods, all operations are work with
DragonBonesArmature
.
- Remove mostly methods, all operations are work with
DragonBonesArmature
node:- Instantiated by
DragonBones
node which accroding toDragonBonesFoctory
, don't instantiate it by youself. - Don't free by youself, it will lead to crash!!
- In editor, a proxy property in
DragonBones
node, which it's type isDragonBonesArmatureProxy
, name is "main_armature", will be indicated as the mainDragonBonesArmature
node. If main armature have child armatures, it will have a "sub_armatures" property inDragonBonesArmatureProxy
.
- Instantiated by
DragonBonesArmatureProxy
is editor use only!! Don't instantiate by youself, and don't access relevant objects/properties, They are unavaunavailable in release build.- Can access
DragonBonesSlot
andDragonBonesBone
to do some advance operations throughDragonBonesArmature
(but this is lack of test.). - I have not time to write a further description, please refer source code in "src/" for more details.
If this plugin can help you, please consider to buy me a coffee.
I'm not familiar with DragonBones, so there maybe have some wrong concepts in my code. This repo is create for my personal project, and it is useful enough, so I think I will not do more optimize anymore. Of cource, if I encounter bug, I will try to fix it. If you have any improvement/repair, welcome to commit your pull request.