From 3f132e482864eccac89ade280212a012c229f102 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 16 Jun 2020 13:40:16 +0200 Subject: [PATCH] Update ESS to the latest to get CharacterSkeleton3D's attach point rework. --- HEADS | 2 +- .../species/Human/models/armature_huf.tscn | 29 +++++++++------- game/player/CharacterSkeletonGD.gd | 34 ++++++++++--------- game/project.godot | 1 + game/scripts/spells/gd_spell_script.gd | 14 ++++---- 5 files changed, 43 insertions(+), 37 deletions(-) diff --git a/HEADS b/HEADS index acdcd2ac..bc19eddf 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "2e8480d56afcd7ddbcb38b225158f25102a46832", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "97f10512f8832394389e1109154b8af34a2ef2c6"}, "entity_spell_system": {"master": "022775d9166936fa2468a6d0c90052373c76e236"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "cdc918a5b89a226bad0510f270ddc0d06097f07e"}, "texture_packer": {"master": "e3047f7dfab861767c5295ea93d2f1404e8de66e"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "3cc9f15f05be53380e20763efc0be753b621b8a2"}, "procedural_animations": {"master": "fb01ca303dd733217fa59cbee391cbde439db35b"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}, "mesh_utils": {"master": "e540e84f9b9505cbba14d1abcd7777ea0b9963e6"}, "broken_seals_module": {"master": "14c239fd8716988b837c2fcfe20fe7d9f11dd515"}, "thread_pool": {"master": "c2aa3018961655165d31aa4586bf1c2a76ed57c1"}} \ No newline at end of file +{"engine": {"3.2": "893cf84278b0354af44849aae58e06c576ed36ab", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "97f10512f8832394389e1109154b8af34a2ef2c6"}, "entity_spell_system": {"master": "68a674da8c6f512b05bc8e0f620e28a3ac5ed504"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "cdc918a5b89a226bad0510f270ddc0d06097f07e"}, "texture_packer": {"master": "e3047f7dfab861767c5295ea93d2f1404e8de66e"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "3cc9f15f05be53380e20763efc0be753b621b8a2"}, "procedural_animations": {"master": "fb01ca303dd733217fa59cbee391cbde439db35b"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}, "mesh_utils": {"master": "e540e84f9b9505cbba14d1abcd7777ea0b9963e6"}, "broken_seals_module": {"master": "14c239fd8716988b837c2fcfe20fe7d9f11dd515"}, "thread_pool": {"master": "c2aa3018961655165d31aa4586bf1c2a76ed57c1"}} \ No newline at end of file diff --git a/game/modules/species/Human/models/armature_huf.tscn b/game/modules/species/Human/models/armature_huf.tscn index 92475ae4..0aad18a6 100644 --- a/game/modules/species/Human/models/armature_huf.tscn +++ b/game/modules/species/Human/models/armature_huf.tscn @@ -123,25 +123,28 @@ graph_offset = Vector2( -567.129, -394.651 ) [sub_resource type="AnimationNodeStateMachinePlayback" id=28] [node name="character" type="CharacterSkeleton3D"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00126277, 0, -0.000325084 ) +entity_type = 1 model_dirty = true animation_player_path = NodePath("armature/AnimationPlayer") animation_tree_path = NodePath("AnimationTree") +attach_point_paths/0_left_hand = NodePath("armature/Armature/Skeleton/LeftHandAttachment/LeftHandAP") +attach_point_paths/1_right_hand = NodePath("armature/Armature/Skeleton/RightHandAttachment/RightHandAP") +attach_point_paths/2_torso = NodePath("armature/Armature/Skeleton/NeckAttachment/TorsoAP") +attach_point_paths/3_root = NodePath("armature/Armature/Skeleton/RootAttachment/RootAP") +attach_point_paths/4_right_hip = NodePath("armature/Armature/Skeleton/RightHipAttachment/Spatial") +attach_point_paths/5_left_hip = NodePath("") +attach_point_paths/6_spine_2 = NodePath("armature/Armature/Skeleton/BoneAttachment/Spine2AP") script = ExtResource( 8 ) automatic_build = true mesh_instance_path = NodePath("armature/Armature/Skeleton/MeshInstance") skeleton_path = NodePath("armature/Armature/Skeleton") materials = [ ExtResource( 3 ), ExtResource( 3 ), ExtResource( 7 ) ] -left_hand_attach_point_path = NodePath("armature/Armature/Skeleton/LeftHandAttachment/LeftHandAP") -right_hand_attach_point_path = NodePath("armature/Armature/Skeleton/RightHandAttachment/RightHandAP") -torso_attach_point_path = NodePath("armature/Armature/Skeleton/NeckAttachment/TorsoAP") -root_attach_point_path = NodePath("armature/Armature/Skeleton/RootAttachment/RootAP") viss = [ ExtResource( 1 ) ] [node name="armature" parent="." instance=ExtResource( 6 )] [node name="Skeleton" parent="armature/Armature" index="0"] -transform = Transform( 1, -3.11065e-18, 4.60995e-26, 3.11065e-18, 1, 5.33895e-43, -4.60995e-26, -3.90962e-43, 1, 0, -6.02229e-16, 0 ) +transform = Transform( 1, -2.45436e-18, 2.70992e-26, 2.45436e-18, 1, 4.87652e-43, -2.70992e-26, -4.2039e-43, 1, 0, -7.08191e-16, 0 ) bones/0/bound_children = [ NodePath("RootAttachment") ] bones/1/bound_children = [ NodePath("RightHipAttachment") ] bones/10/bound_children = [ NodePath("BoneAttachment") ] @@ -152,7 +155,7 @@ bones/24/bound_children = [ NodePath("RightHandAttachment") ] [node name="MeshInstance" type="MeshInstance" parent="armature/Armature/Skeleton" index="0"] [node name="LeftHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="1"] -transform = Transform( 0.102987, 0.118427, -0.987588, 0.0569165, -0.991907, -0.11299, -0.993048, -0.0445756, -0.108898, 0.229464, 0.769383, -0.00984082 ) +transform = Transform( 0.10303, 0.117911, -0.987644, 0.0568446, -0.991968, -0.112476, -0.993047, -0.0445561, -0.108909, 0.22966, 0.76902, -0.00977726 ) bone_name = "left_hand" [node name="LeftHandAP" type="Spatial" parent="armature/Armature/Skeleton/LeftHandAttachment"] @@ -160,7 +163,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.04, -0.09 ) script = ExtResource( 2 ) [node name="RightHandAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="2"] -transform = Transform( -0.0407421, -0.029358, -0.998714, -0.127057, -0.991235, 0.0343064, -0.991072, 0.128297, 0.0366658, -0.229627, 0.768894, -0.00684395 ) +transform = Transform( -0.040853, -0.030264, -0.998682, -0.126988, -0.991209, 0.0352172, -0.991076, 0.128265, 0.0366622, -0.230199, 0.768953, -0.00691995 ) bone_name = "right_hand" [node name="RightHandAP" type="Spatial" parent="armature/Armature/Skeleton/RightHandAttachment"] @@ -176,7 +179,7 @@ transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0 script = ExtResource( 2 ) [node name="NeckAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="4"] -transform = Transform( 0.999969, -0.0078202, -0.000732227, 0.00785113, 0.997217, 0.0731269, 0.000158323, -0.0731357, 0.997322, 0.0010987, 1.31599, 7.29295e-05 ) +transform = Transform( 0.999967, -0.00808941, -0.000806057, 0.00812439, 0.997212, 0.073122, 0.000212305, -0.0731316, 0.997322, 0.00110909, 1.3156, 7.62992e-05 ) bone_name = "neck" [node name="TorsoAP" type="Spatial" parent="armature/Armature/Skeleton/NeckAttachment"] @@ -184,7 +187,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.04, -0.09 ) script = ExtResource( 2 ) [node name="RightHipAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="5"] -transform = Transform( 0.99969, 0.0248843, 1.18032e-08, -0.0248843, 0.99969, 4.71708e-07, -6.14104e-11, -4.71855e-07, 1, 0.00261466, 0.774483, 0 ) +transform = Transform( 0.999719, 0.0237236, 1.12527e-08, -0.0237236, 0.999719, 4.71721e-07, -5.85487e-11, -4.71855e-07, 1, 0.00307471, 0.774089, 0 ) bone_name = "pelvis" [node name="Spatial" type="Spatial" parent="armature/Armature/Skeleton/RightHipAttachment"] @@ -197,13 +200,13 @@ material/0 = null material/1 = null [node name="BoneAttachment" type="BoneAttachment" parent="armature/Armature/Skeleton" index="6"] -transform = Transform( 0.999967, -0.00812464, -3.21407e-05, 0.00812291, 0.999892, -0.00106342, 4.07692e-05, 0.00106339, 0.999999, 0.00262286, 1.12841, -0.000126548 ) +transform = Transform( 0.999964, -0.00839859, -8.57934e-05, 0.00839617, 0.999886, -0.0010678, 9.47524e-05, 0.00106741, 0.999999, 0.00268464, 1.12802, -0.000123932 ) bone_name = "spine_2" -[node name="Spatial" type="Spatial" parent="armature/Armature/Skeleton/BoneAttachment"] +[node name="Spine2AP" type="Spatial" parent="armature/Armature/Skeleton/BoneAttachment"] transform = Transform( -0.430811, -0.000122875, 0.129993, 8.54071e-05, -0.45, -0.000142502, 0.130026, -0.000112184, 0.430809, 0.000957399, -0.0715881, -0.0057677 ) -[node name="MeshInstance" type="MeshInstance" parent="armature/Armature/Skeleton/BoneAttachment/Spatial"] +[node name="MeshInstance" type="MeshInstance" parent="armature/Armature/Skeleton/BoneAttachment/Spine2AP"] transform = Transform( 0.914344, -0.295324, -0.277032, 0.283891, -0.0205529, 0.958773, -0.288935, -0.954992, 0.065061, -0.0775848, 0.00327253, -0.254833 ) mesh = ExtResource( 4 ) material/0 = null diff --git a/game/player/CharacterSkeletonGD.gd b/game/player/CharacterSkeletonGD.gd index bf76b704..6b2ad9b1 100644 --- a/game/player/CharacterSkeletonGD.gd +++ b/game/player/CharacterSkeletonGD.gd @@ -39,15 +39,6 @@ var skeleton : Skeleton export(Array, Material) var materials : Array var _materials : Array = Array() -export (NodePath) var left_hand_attach_point_path : NodePath -var left_hand_attach_point : CharacterSkeketonAttachPoint -export (NodePath) var right_hand_attach_point_path : NodePath -var right_hand_attach_point : CharacterSkeketonAttachPoint -export (NodePath) var torso_attach_point_path : NodePath -var torso_attach_point : CharacterSkeketonAttachPoint -export (NodePath) var root_attach_point_path : NodePath -var root_attach_point : CharacterSkeketonAttachPoint - export(Array, ModelVisual) var viss : Array var meshes : Array @@ -110,11 +101,6 @@ func _enter_tree(): skeleton = get_node(skeleton_path) as Skeleton mesh_instance = get_node(mesh_instance_path) as MeshInstance - left_hand_attach_point = get_node(left_hand_attach_point_path) as CharacterSkeketonAttachPoint - right_hand_attach_point = get_node(right_hand_attach_point_path) as CharacterSkeketonAttachPoint - torso_attach_point = get_node(torso_attach_point_path) as CharacterSkeketonAttachPoint - root_attach_point = get_node(root_attach_point_path) as CharacterSkeketonAttachPoint - if _materials.size() != materials.size(): for m in materials: _materials.append(m.duplicate()) @@ -158,9 +144,9 @@ func build(): var data : Array = Array() - for skele_point in range(EntityEnums.SKELETON_POINTS_MAX): + for skele_point in range(ESS.skeletons_bones_index_get(entity_type).count(',') + 1): var bone_name : String = get_bone_name(skele_point) - + if bone_name == "": print("Bone name error") continue @@ -245,6 +231,22 @@ func get_bone_name(skele_point : int) -> String: return "" +func _common_attach_point_index_get(point): + if point == EntityEnums.COMMON_SKELETON_POINT_LEFT_HAND: + return 0 + elif point == EntityEnums.COMMON_SKELETON_POINT_ROOT: + return 3 + elif point == EntityEnums.COMMON_SKELETON_POINT_SPINE_2: + return 6 + elif point == EntityEnums.COMMON_SKELETON_POINT_RIGHT_HAND: + return 1 + elif point == EntityEnums.COMMON_SKELETON_POINT_BACK: + return 6 + elif point == EntityEnums.COMMON_SKELETON_POINT_RIGHT_HIP: + return 4 + + return 3 + func set_lod_level(level : int) -> void: if _current_lod_level == level: return diff --git a/game/project.godot b/game/project.godot index 6254c6c5..0b269372 100644 --- a/game/project.godot +++ b/game/project.godot @@ -378,6 +378,7 @@ data/ess_resource_db_path="res://data/resource_db.tres" data/ess_entity_spawner_path="res://player/bs_entity_spawner.tres" enums/stats="Agility,Strength,Stamina,Intellect,Spirit,Health,Mana,Speed,Global Cooldown,Haste,Haste Rating,Resilience,Armor,Attack Power,Spell Power,Melee Crit,Melee Crit bonus,Spell Crit,Spell Crit Bonus,Block,Parry,Damage Reduction,Melee Damage Reduction,Spell Damage Reduction,Damage Taken,Heal Taken,Melee Damage,Spell Damage,Holy Resist,Shadow Resist,Nature Resist,Fire Resist,Frost Resist,Lightning Resist,Chaos Resist,Silence Resist,Fear Resist,Stun Resist,Energy,Rage,XP Rate" enums/skeletons_bones=PoolStringArray( "", "root,pelvis,spine,spine_1,spine_2,neck,head,left_clavicle,left_upper_arm,left_forearm,left_hand,left_thumb_base,left_thumb_end,left_fingers_base,left_fingers_end,right_clavicle,right_upper_arm,right_forearm,right_hand,right_thumb_base,right_thumb_end,right_fingers_base,right_fingers_end,left_thigh,left_calf,left_foot,right_thigh,right_calf,right_foot" ) +enums/skeletons_bone_attachment_points=PoolStringArray( "", "left_hand,right_hand,torso,root,right_hip,left_hip,spine_2" ) profiles/automatic_save=true [importer_defaults] diff --git a/game/scripts/spells/gd_spell_script.gd b/game/scripts/spells/gd_spell_script.gd index 31080359..8c9f36a9 100644 --- a/game/scripts/spells/gd_spell_script.gd +++ b/game/scripts/spells/gd_spell_script.gd @@ -215,20 +215,20 @@ func add_spell_cast_effect(info : SpellCastInfo) -> void: if basic_spell_effect != null: if basic_spell_effect.spell_cast_effect_left_hand != null: - info.caster.get_character_skeleton().left_hand_attach_point.add_effect(basic_spell_effect.spell_cast_effect_left_hand) + info.caster.get_character_skeleton().common_attach_point_add_effect(EntityEnums.COMMON_SKELETON_POINT_LEFT_HAND, basic_spell_effect.spell_cast_effect_left_hand) if basic_spell_effect.spell_cast_effect_right_hand != null: - info.caster.get_character_skeleton().right_hand_attach_point.add_effect(basic_spell_effect.spell_cast_effect_right_hand) + info.caster.get_character_skeleton().common_attach_point_add_effect(EntityEnums.COMMON_SKELETON_POINT_RIGHT_HAND, basic_spell_effect.spell_cast_effect_right_hand) func remove_spell_cast_effect(info : SpellCastInfo) -> void: var basic_spell_effect : SpellEffectVisualBasic = visual_spell_effects as SpellEffectVisualBasic if basic_spell_effect != null: if basic_spell_effect.spell_cast_effect_left_hand != null: - info.caster.get_character_skeleton().left_hand_attach_point.remove_effect(basic_spell_effect.spell_cast_effect_left_hand) + info.caster.get_character_skeleton().common_attach_point_remove_effect(EntityEnums.COMMON_SKELETON_POINT_LEFT_HAND, basic_spell_effect.spell_cast_effect_left_hand) if basic_spell_effect.spell_cast_effect_right_hand != null: - info.caster.get_character_skeleton().right_hand_attach_point.remove_effect(basic_spell_effect.spell_cast_effect_right_hand) + info.caster.get_character_skeleton().common_attach_point_remove_effect(EntityEnums.COMMON_SKELETON_POINT_RIGHT_HAND, basic_spell_effect.spell_cast_effect_right_hand) func _notification_ccast(what, info): if what == SpellEnums.NOTIFICATION_CAST_STARTED: @@ -249,10 +249,10 @@ func _notification_ccast(what, info): if bse != null: if bse.torso_spell_cast_finish_effect != null: - info.target.get_character_skeleton().torso_attach_point.add_effect_timed(bse.torso_spell_cast_finish_effect, bse.torso_spell_cast_finish_effect_time) - + info.target.get_character_skeleton().common_attach_point_add_effect_timed(EntityEnums.COMMON_SKELETON_POINT_TORSO, bse.torso_spell_cast_finish_effect_time) + if bse.root_spell_cast_finish_effect != null: - info.target.get_character_skeleton().root_attach_point.add_effect_timed(bse.root_spell_cast_finish_effect, bse.root_spell_cast_finish_effect_time) + info.target.get_character_skeleton().common_attach_point_add_effect_timed(EntityEnums.COMMON_SKELETON_POINT_ROOT, bse.root_spell_cast_finish_effect_time) func _son_spell_hit(info):