diff --git a/SCsub b/SCsub index 18b7441..e9ce2eb 100644 --- a/SCsub +++ b/SCsub @@ -46,8 +46,7 @@ module_env.add_source_files(env.modules_sources,"inventory/bag.cpp") module_env.add_source_files(env.modules_sources,"spells/aura_infos.cpp") module_env.add_source_files(env.modules_sources,"spells/spell_cast_info.cpp") -module_env.add_source_files(env.modules_sources,"data/aura_visual_effect.cpp") -module_env.add_source_files(env.modules_sources,"data/spell_visual_effect.cpp") +module_env.add_source_files(env.modules_sources,"data/visual_bone_attachment.cpp") module_env.add_source_files(env.modules_sources,"pipelines/spell_damage_info.cpp") module_env.add_source_files(env.modules_sources,"pipelines/spell_heal_info.cpp") diff --git a/config.pyc b/config.pyc index 91e5667..abb9385 100644 Binary files a/config.pyc and b/config.pyc differ diff --git a/data/aura_visual_effect.cpp b/data/aura_visual_effect.cpp deleted file mode 100644 index ced6744..0000000 --- a/data/aura_visual_effect.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "aura_visual_effect.h" diff --git a/data/aura_visual_effect.h b/data/aura_visual_effect.h deleted file mode 100644 index 89cbd5e..0000000 --- a/data/aura_visual_effect.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef AURA_VISUAL_EFFECT_H -#define AURA_VISUAL_EFFECT_H - -#include "core/reference.h" - - -class AuraVisualEffect : public Reference { - GDCLASS(AuraVisualEffect, Reference); - -public: - void set_id(){} - -protected: - static void _bind_methods() { - } - -private: - int id; -}; - - -#endif diff --git a/data/spell.cpp b/data/spell.cpp index bd5fdbd..390b227 100644 --- a/data/spell.cpp +++ b/data/spell.cpp @@ -562,7 +562,16 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("get_damage_scale_for_level"), &Spell::get_damage_scale_for_level); ClassDB::bind_method(D_METHOD("get_heal_scale_for_level"), &Spell::get_heal_scale_for_level); ClassDB::bind_method(D_METHOD("get_absorb_scale_for_level"), &Spell::get_absorb_scale_for_level); + + ClassDB::bind_method(D_METHOD("get_needs_target"), &Spell::get_needs_target); + ClassDB::bind_method(D_METHOD("set_needs_target", "value"), &Spell::set_needs_target); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "needs_target"), "set_needs_target", "get_needs_target"); + ClassDB::bind_method(D_METHOD("get_can_move_while_casting"), &Spell::get_can_move_while_casting); + ClassDB::bind_method(D_METHOD("set_can_move_while_casting", "value"), &Spell::set_can_move_while_casting); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "can_move_while_casting"), "set_can_move_while_casting", "get_can_move_while_casting"); + + ADD_GROUP("Range", "range"); ClassDB::bind_method(D_METHOD("get_has_range"), &Spell::get_has_range); ClassDB::bind_method(D_METHOD("set_has_range", "value"), &Spell::set_has_range); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "has_range"), "set_has_range", "get_has_range"); @@ -571,6 +580,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_range", "value"), &Spell::set_range); ADD_PROPERTY(PropertyInfo(Variant::REAL, "range"), "set_range", "get_range"); + ADD_GROUP("Cast Time", "cast_time"); ClassDB::bind_method(D_METHOD("get_has_cast_time"), &Spell::get_has_cast_time); ClassDB::bind_method(D_METHOD("set_has_cast_time", "value"), &Spell::set_has_cast_time); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "has_cast_time"), "set_has_cast_time", "get_has_cast_time"); @@ -579,6 +589,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_cast_time", "value"), &Spell::set_cast_time); ADD_PROPERTY(PropertyInfo(Variant::REAL, "cast_time"), "set_cast_time", "get_cast_time"); + ADD_GROUP("Damage", "damage"); ClassDB::bind_method(D_METHOD("get_has_damage"), &Spell::get_has_damage); ClassDB::bind_method(D_METHOD("set_has_damage", "value"), &Spell::set_has_damage); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "has_damage"), "set_has_damage", "get_has_damage"); @@ -599,6 +610,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_damage_scaling_curve", "curve"), &Spell::set_damage_scaling_curve); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "damage_scaling_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_damage_scaling_curve", "get_damage_scaling_curve"); + ADD_GROUP("Heal", "heal"); ClassDB::bind_method(D_METHOD("get_has_heal"), &Spell::get_has_heal); ClassDB::bind_method(D_METHOD("set_has_heal", "value"), &Spell::set_has_heal); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "has_heal"), "set_has_heal", "get_has_heal"); @@ -615,14 +627,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_heal_scaling_curve", "curve"), &Spell::set_heal_scaling_curve); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "heal_scaling_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_heal_scaling_curve", "get_heal_scaling_curve"); - ClassDB::bind_method(D_METHOD("get_needs_target"), &Spell::get_needs_target); - ClassDB::bind_method(D_METHOD("set_needs_target", "value"), &Spell::set_needs_target); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "needs_target"), "set_needs_target", "get_needs_target"); - - ClassDB::bind_method(D_METHOD("get_can_move_while_casting"), &Spell::get_can_move_while_casting); - ClassDB::bind_method(D_METHOD("set_can_move_while_casting", "value"), &Spell::set_can_move_while_casting); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "can_move_while_casting"), "set_can_move_while_casting", "get_can_move_while_casting"); - + ADD_GROUP("Interrupt", "interrupt"); ClassDB::bind_method(D_METHOD("get_is_interrupt"), &Spell::get_is_interrupt); ClassDB::bind_method(D_METHOD("set_is_interrupt", "value"), &Spell::set_is_interrupt); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "get_is_interrupt"), "set_is_interrupt", "get_is_interrupt"); @@ -631,6 +636,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_interrupt_time", "value"), &Spell::set_interrupt_time); ADD_PROPERTY(PropertyInfo(Variant::REAL, "interrupt_time"), "set_interrupt_time", "get_interrupt_time"); + ADD_GROUP("AOE", "aoe"); ClassDB::bind_method(D_METHOD("get_is_aoe"), &Spell::get_is_aoe); ClassDB::bind_method(D_METHOD("set_is_aoe", "value"), &Spell::set_is_aoe); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_aoe"), "set_is_aoe", "get_is_aoe"); @@ -651,6 +657,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_aoe_half_extents", "value"), &Spell::set_aoe_half_extents); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "aoe_halfExtents"), "set_aoe_half_extents", "get_aoe_half_extents"); + ADD_GROUP("Effects", "effect"); ClassDB::bind_method(D_METHOD("get_has_effect"), &Spell::get_has_effect); ClassDB::bind_method(D_METHOD("set_has_effect", "value"), &Spell::set_has_effect); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "has_effect"), "set_has_effect", "get_has_effect"); @@ -675,6 +682,7 @@ void Spell::_bind_methods() { ClassDB::bind_method(D_METHOD("set_spell_cast_effect_id", "value"), &Spell::set_spell_cast_effect_id); ADD_PROPERTY(PropertyInfo(Variant::INT, "spell_cast_effect_id"), "set_spell_cast_effect_id", "get_spell_cast_effect_id"); + ADD_GROUP("Projectile", "projectile"); ClassDB::bind_method(D_METHOD("get_projectile_id"), &Spell::get_projectile_id); ClassDB::bind_method(D_METHOD("set_projectile_id", "value"), &Spell::set_projectile_id); ADD_PROPERTY(PropertyInfo(Variant::INT, "projectile_id"), "set_projectile_id", "get_projectile_id"); diff --git a/data/spell_visual_effect.cpp b/data/spell_visual_effect.cpp deleted file mode 100644 index be36635..0000000 --- a/data/spell_visual_effect.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "spell_visual_effect.h" diff --git a/data/spell_visual_effect.h b/data/spell_visual_effect.h deleted file mode 100644 index 9b4fe4c..0000000 --- a/data/spell_visual_effect.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SPELL_VISUAL_EFFECT_H -#define SPELL_VISUAL_EFFECT_H - -#include "core/reference.h" - -class SpellVisualEffect : public Reference { - GDCLASS(SpellVisualEffect, Reference); - -public: - void set_id() {} - -protected: - static void _bind_methods() { - } - -private: - int id; -}; - -#endif diff --git a/data/visual_bone_attachment.cpp b/data/visual_bone_attachment.cpp new file mode 100644 index 0000000..3e3e4c6 --- /dev/null +++ b/data/visual_bone_attachment.cpp @@ -0,0 +1,65 @@ +#include "visual_bone_attachment.h" + +const String VisualBoneAttachment::BINDING_STRING_BONE_ATTACHMENT_TYPES = "None, Bodypart, Effect, Equipment, Override"; + +int VisualBoneAttachment::get_id() { + return _id; +} + +void VisualBoneAttachment::set_id(int id) { + _id = id; +} + +VisualBoneAttachment::VisualBoneAttachmentType VisualBoneAttachment::get_attachment_type() { + return _attachment_type; +} + +void VisualBoneAttachment::set_attachment_type(VisualBoneAttachment::VisualBoneAttachmentType attachment_type) { + _attachment_type = attachment_type; +} + +EntityEnums::CharacterSkeletonBoneId VisualBoneAttachment::get_target_bone() { + return _target_bone; +} + +void VisualBoneAttachment::set_target_bone(EntityEnums::CharacterSkeletonBoneId target_bone) { + _target_bone = target_bone; +} + +Ref VisualBoneAttachment::get_effect() { + return _effect; +} + +void VisualBoneAttachment::set_effect(Ref effect) { + _effect = effect; +} + +VisualBoneAttachment::VisualBoneAttachment() { + _id = 0; + _target_bone = EntityEnums::BONE_ID_HIP; +} + +void VisualBoneAttachment::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_id"), &VisualBoneAttachment::get_id); + ClassDB::bind_method(D_METHOD("set_id", "path"), &VisualBoneAttachment::set_id); + ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id"); + + ClassDB::bind_method(D_METHOD("get_attachment_type"), &VisualBoneAttachment::get_attachment_type); + ClassDB::bind_method(D_METHOD("set_attachment_type", "target_bone"), &VisualBoneAttachment::set_attachment_type); + ADD_PROPERTY(PropertyInfo(Variant::INT, "attachment_type", PROPERTY_HINT_ENUM, VisualBoneAttachment::BINDING_STRING_BONE_ATTACHMENT_TYPES), "set_attachment_type", "get_attachment_type"); + + ClassDB::bind_method(D_METHOD("get_target_bone"), &VisualBoneAttachment::get_target_bone); + ClassDB::bind_method(D_METHOD("set_target_bone", "target_bone"), &VisualBoneAttachment::set_target_bone); + ADD_PROPERTY(PropertyInfo(Variant::INT, "target_bone", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_CHARCATER_SKELETON_BONE_ID), "set_target_bone", "get_target_bone"); + + ClassDB::bind_method(D_METHOD("get_effect"), &VisualBoneAttachment::get_effect); + ClassDB::bind_method(D_METHOD("set_effect", "path"), &VisualBoneAttachment::set_effect); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_effect", "get_effect"); + + BIND_ENUM_CONSTANT(BONE_ATTACHMENT_TYPE_NONE); + BIND_ENUM_CONSTANT(BONE_ATTACHMENT_TYPE_BODYPART); + BIND_ENUM_CONSTANT(BONE_ATTACHMENT_TYPE_EFFECT); + BIND_ENUM_CONSTANT(BONE_ATTACHMENT_TYPE_EQUIPMENT); + BIND_ENUM_CONSTANT(BONE_ATTACHMENT_TYPE_OVERRIDE); +} + diff --git a/data/visual_bone_attachment.h b/data/visual_bone_attachment.h new file mode 100644 index 0000000..4431436 --- /dev/null +++ b/data/visual_bone_attachment.h @@ -0,0 +1,50 @@ +#ifndef VISUAL_BONE_ATTACHMENT_H +#define VISUAL_BONE_ATTACHMENT_H + +#include "core/ustring.h" +#include "core/resource.h" +#include "scene/resources/packed_scene.h" + +#include "../entity_enums.h" + +class VisualBoneAttachment : public Resource { + GDCLASS(VisualBoneAttachment, Resource); + +public: + static const String BINDING_STRING_BONE_ATTACHMENT_TYPES; + + enum VisualBoneAttachmentType { + BONE_ATTACHMENT_TYPE_NONE = 0, + BONE_ATTACHMENT_TYPE_BODYPART = 1, + BONE_ATTACHMENT_TYPE_EFFECT = 2, + BONE_ATTACHMENT_TYPE_EQUIPMENT = 3, + BONE_ATTACHMENT_TYPE_OVERRIDE = 4 + }; + + int get_id(); + void set_id(int id); + + VisualBoneAttachmentType get_attachment_type(); + void set_attachment_type(VisualBoneAttachmentType attachment_type); + + EntityEnums::CharacterSkeletonBoneId get_target_bone(); + void set_target_bone(EntityEnums::CharacterSkeletonBoneId bone); + + Ref get_effect(); + void set_effect(Ref effect); + + VisualBoneAttachment(); + +protected: + static void _bind_methods(); + +private: + int _id; + VisualBoneAttachmentType _attachment_type; + EntityEnums::CharacterSkeletonBoneId _target_bone; + Ref _effect; +}; + +VARIANT_ENUM_CAST(VisualBoneAttachment::VisualBoneAttachmentType); + +#endif diff --git a/entity_enums.cpp b/entity_enums.cpp index 47359bc..bcb21ef 100644 --- a/entity_enums.cpp +++ b/entity_enums.cpp @@ -3,3 +3,4 @@ const String EntityEnums::BINDING_STRING_PLAYER_RESOURCE_TYPES = "None, Rage, Mana, Energy, Time Anomaly"; const String EntityEnums::BINDING_STRING_ENTITY_TYPES = "None, Player, AI, Mob"; const String EntityEnums::BINDING_STRING_ENTITY_STATE_TYPES = "None, Stun, Root, Frozen, Silenced, Disoriented, Feared, Burning, Cold, Cursed, Pacified"; +const String EntityEnums::BINDING_STRING_CHARCATER_SKELETON_BONE_ID = "Hip, Left Hand, Right Hand"; diff --git a/entity_enums.h b/entity_enums.h index bc2f55c..ab697da 100644 --- a/entity_enums.h +++ b/entity_enums.h @@ -11,6 +11,7 @@ public: static const String BINDING_STRING_PLAYER_RESOURCE_TYPES; static const String BINDING_STRING_ENTITY_TYPES; static const String BINDING_STRING_ENTITY_STATE_TYPES; + static const String BINDING_STRING_CHARCATER_SKELETON_BONE_ID; enum PlayerResourceTypes { PLAYER_RESOURCE_TYPES_NONE, @@ -40,6 +41,13 @@ public: ENTITY_STATE_TYPE_CURSED = 1 << 8, ENTITY_STATE_TYPE_PACIFIED = 1 << 9, }; + + enum CharacterSkeletonBoneId { + BONE_ID_HIP = 0, + BONE_ID_LEFT_HAND = 1, + BONE_ID_RIGHT_HAND = 2, + MAX_BONE_ID = 3, + }; EntityEnums() {} @@ -67,11 +75,17 @@ protected: BIND_ENUM_CONSTANT(ENTITY_STATE_TYPE_COLD); BIND_ENUM_CONSTANT(ENTITY_STATE_TYPE_CURSED); BIND_ENUM_CONSTANT(ENTITY_STATE_TYPE_PACIFIED); + + BIND_ENUM_CONSTANT(BONE_ID_HIP); + BIND_ENUM_CONSTANT(BONE_ID_LEFT_HAND); + BIND_ENUM_CONSTANT(BONE_ID_RIGHT_HAND); + BIND_ENUM_CONSTANT(MAX_BONE_ID); } }; VARIANT_ENUM_CAST(EntityEnums::EntityType); VARIANT_ENUM_CAST(EntityEnums::PlayerResourceTypes); VARIANT_ENUM_CAST(EntityEnums::EntityStateTypes); +VARIANT_ENUM_CAST(EntityEnums::CharacterSkeletonBoneId); #endif diff --git a/register_types.cpp b/register_types.cpp index ed41271..57929aa 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -32,8 +32,7 @@ #include "spells/spell_cast_info.h" #include "spells/aura_infos.h" -#include "data/aura_visual_effect.h" -#include "data/spell_visual_effect.h" +#include "data/visual_bone_attachment.h" #include "pipelines/spell_damage_info.h" #include "pipelines/spell_heal_info.h" @@ -77,8 +76,7 @@ void register_entity_spell_system_types() { ClassDB::register_class(); ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); diff --git a/skeleton/character_skeleton.cpp b/skeleton/character_skeleton.cpp index 6155140..0b26461 100644 --- a/skeleton/character_skeleton.cpp +++ b/skeleton/character_skeleton.cpp @@ -1,40 +1,22 @@ #include "character_skeleton.h" -const String CharacterSkeleton::BINDING_STRING_CHARCATER_SKELETON_BONE_ID = "Hip, Left Hand, Right Hand"; - -NodePath CharacterSkeleton::get_hip_path() { - return _hip_path; +NodePath CharacterSkeleton::get_bone_path(int index) { + ERR_FAIL_INDEX_V(index, EntityEnums::MAX_BONE_ID, NodePath()); + + return _bone_paths[index]; } -void CharacterSkeleton::set_hip_path(NodePath path) { - _hip_path = path; +void CharacterSkeleton::set_bone_path(int index, NodePath path) { + ERR_FAIL_INDEX(index, EntityEnums::MAX_BONE_ID); + + _bone_paths[index] = path; - _nodes[BONE_ID_HIP] = get_node_or_null(_hip_path); + _bone_nodes[index] = get_node_or_null(path); } -NodePath CharacterSkeleton::get_left_hand_path() { - return _left_hand_path; -} - -void CharacterSkeleton::set_left_hand_path(NodePath path) { - _left_hand_path = path; - - _nodes[BONE_ID_LEFT_HAND] = get_node_or_null(_left_hand_path); -} - -NodePath CharacterSkeleton::get_right_hand_path() { - return _right_hand_path; -} - -void CharacterSkeleton::set_right_hand_path(NodePath path) { - _right_hand_path = path; - - _nodes[BONE_ID_RIGHT_HAND] = get_node_or_null(_right_hand_path); -} - -Node *CharacterSkeleton::get_bone_node(CharacterSkeletonBoneId node_id) { - return _nodes[node_id]; +Node *CharacterSkeleton::get_bone_node(EntityEnums::CharacterSkeletonBoneId node_id) { + return _bone_nodes[node_id]; } NodePath CharacterSkeleton::get_animation_player_path() { @@ -78,17 +60,17 @@ AnimationTree *CharacterSkeleton::get_animation_tree() { } void CharacterSkeleton::update_nodes() { - _nodes[BONE_ID_HIP] = get_node_or_null(_hip_path); - _nodes[BONE_ID_LEFT_HAND] = get_node_or_null(_left_hand_path); - _nodes[BONE_ID_RIGHT_HAND] = get_node_or_null(_right_hand_path); + for (int i = 0; i < EntityEnums::MAX_BONE_ID; ++i) { + _bone_nodes[i] = get_node_or_null(_bone_paths[i]); + } set_animation_player_path(_animation_player_path); set_animation_tree_path(_animation_tree_path); } CharacterSkeleton::CharacterSkeleton() { - for (int i = 0; i < MAX_BONE_ID; ++i) { - _nodes[i] = NULL; + for (int i = 0; i < EntityEnums::MAX_BONE_ID; ++i) { + _bone_nodes[i] = NULL; } _animation_player = NULL; @@ -108,17 +90,13 @@ void CharacterSkeleton::_notification(int p_what) { } void CharacterSkeleton::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_hip_path"), &CharacterSkeleton::get_hip_path); - ClassDB::bind_method(D_METHOD("set_hip_path", "path"), &CharacterSkeleton::set_hip_path); - ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "hip_path"), "set_hip_path", "get_hip_path"); + ClassDB::bind_method(D_METHOD("get_bone_path", "index"), &CharacterSkeleton::get_bone_path); + ClassDB::bind_method(D_METHOD("set_bone_path", "index", "path"), &CharacterSkeleton::set_bone_path); - ClassDB::bind_method(D_METHOD("get_left_hand_path"), &CharacterSkeleton::get_left_hand_path); - ClassDB::bind_method(D_METHOD("set_left_hand_path", "path"), &CharacterSkeleton::set_left_hand_path); - ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "left_hand_path"), "set_left_hand_path", "get_left_hand_path"); - - ClassDB::bind_method(D_METHOD("get_right_hand_path"), &CharacterSkeleton::get_right_hand_path); - ClassDB::bind_method(D_METHOD("set_right_hand_path", "path"), &CharacterSkeleton::set_right_hand_path); - ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "right_hand_path"), "set_right_hand_path", "get_right_hand_path"); + ADD_GROUP("Bone Paths", "bone_path_"); + ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_hip"), "set_bone_path", "get_bone_path", EntityEnums::BONE_ID_HIP); + ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_left_hand"), "set_bone_path", "get_bone_path", EntityEnums::BONE_ID_LEFT_HAND); + ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "bone_path_right_hand"), "set_bone_path", "get_bone_path", EntityEnums::BONE_ID_RIGHT_HAND); ClassDB::bind_method(D_METHOD("get_bone_node", "bone_idx"), &CharacterSkeleton::get_bone_node); @@ -134,9 +112,4 @@ void CharacterSkeleton::_bind_methods() { ClassDB::bind_method(D_METHOD("get_animation_tree"), &CharacterSkeleton::get_animation_tree); ClassDB::bind_method(D_METHOD("update_nodes"), &CharacterSkeleton::update_nodes); - - BIND_ENUM_CONSTANT(BONE_ID_HIP); - BIND_ENUM_CONSTANT(BONE_ID_LEFT_HAND); - BIND_ENUM_CONSTANT(BONE_ID_RIGHT_HAND); - BIND_ENUM_CONSTANT(MAX_BONE_ID); } diff --git a/skeleton/character_skeleton.h b/skeleton/character_skeleton.h index a8845b9..cb8177c 100644 --- a/skeleton/character_skeleton.h +++ b/skeleton/character_skeleton.h @@ -12,6 +12,8 @@ #include "scene/animation/animation_player.h" #include "scene/animation/animation_tree.h" +#include "../entity_enums.h" + #ifdef ENTITIES_2D class CharacterSkeleton : public Node2D { @@ -25,25 +27,10 @@ class CharacterSkeleton : public Spatial { #endif public: - static const String BINDING_STRING_CHARCATER_SKELETON_BONE_ID; + NodePath get_bone_path(int index); + void set_bone_path(int index, NodePath path); - enum CharacterSkeletonBoneId { - BONE_ID_HIP = 0, - BONE_ID_LEFT_HAND = 1, - BONE_ID_RIGHT_HAND = 2, - MAX_BONE_ID = 3, - }; - - NodePath get_hip_path(); - void set_hip_path(NodePath path); - - NodePath get_left_hand_path(); - void set_left_hand_path(NodePath path); - - NodePath get_right_hand_path(); - void set_right_hand_path(NodePath path); - - Node *get_bone_node(CharacterSkeletonBoneId node_id); + Node *get_bone_node(EntityEnums::CharacterSkeletonBoneId node_id); NodePath get_animation_player_path(); void set_animation_player_path(NodePath path); @@ -64,19 +51,16 @@ protected: virtual void _notification(int p_notification); private: - NodePath _hip_path; - NodePath _left_hand_path; - NodePath _right_hand_path; - NodePath _animation_player_path; NodePath _animation_tree_path; + NodePath _bone_paths[EntityEnums::MAX_BONE_ID]; + AnimationPlayer *_animation_player; AnimationTree *_animation_tree; - Node *_nodes[MAX_BONE_ID]; + Node *_bone_nodes[EntityEnums::MAX_BONE_ID]; }; -VARIANT_ENUM_CAST(CharacterSkeleton::CharacterSkeletonBoneId); #endif