From 8ce19070aed71579c8cdf88d5143a446ec756df7 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 15 Sep 2020 10:54:50 +0200 Subject: [PATCH] Fix items overriding textures for characters. --- .../1_chest_of_the_infinite_wisdom.tres | 18 +++++++------ .../core/model_visuals/test_base_v2.tres | 1 - .../modules/core/model_visuals/test_vis1.tres | 1 - game/player/CharacterSkeletonGD.gd | 27 ++++++++++--------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/game/modules/core/model_visuals/1_chest_of_the_infinite_wisdom.tres b/game/modules/core/model_visuals/1_chest_of_the_infinite_wisdom.tres index aaffc666..5c844164 100644 --- a/game/modules/core/model_visuals/1_chest_of_the_infinite_wisdom.tres +++ b/game/modules/core/model_visuals/1_chest_of_the_infinite_wisdom.tres @@ -1,17 +1,19 @@ [gd_resource type="ModelVisual" load_steps=4 format=2] -[ext_resource path="res://modules/species/Human/Female/character_textures/100_seamless/armor_green_scarf.png" type="Texture" id=1] - +[ext_resource path="res://modules/species/Human/Female/character_textures/100_seamless/armor_green_scarf_v3.png" type="Texture" id=1] [sub_resource type="ModelVisualEntry" id=1] -texture = ExtResource( 1 ) -texture_female = ExtResource( 1 ) +override_layer = 5 +entity_type = 1 +bone = 4 +entry_0/texture = ExtResource( 1 ) [sub_resource type="ModelVisualEntry" id=2] -texture = ExtResource( 1 ) -texture_female = ExtResource( 1 ) +override_layer = 5 +entity_type = 1 +bone = 3 +entry_0/texture = ExtResource( 1 ) [resource] layer = 5 -visual_spine_1 = SubResource( 1 ) -visual_spine_2 = SubResource( 2 ) +get_visual_entries = [ SubResource( 1 ), SubResource( 2 ) ] diff --git a/game/modules/core/model_visuals/test_base_v2.tres b/game/modules/core/model_visuals/test_base_v2.tres index ae1c922a..e315c7f6 100644 --- a/game/modules/core/model_visuals/test_base_v2.tres +++ b/game/modules/core/model_visuals/test_base_v2.tres @@ -21,7 +21,6 @@ [ext_resource path="res://modules/species/Human/Female/character_textures/100_seamless/armor_simple_v2.png" type="Texture" id=19] [ext_resource path="res://modules/species/Human/Female/character_textures/100_seamless/armor_green_scarfv2.png" type="Texture" id=20] - [sub_resource type="ModelVisualEntry" id=1] entry_0/mesh = ExtResource( 4 ) entry_0/texture = ExtResource( 20 ) diff --git a/game/modules/core/model_visuals/test_vis1.tres b/game/modules/core/model_visuals/test_vis1.tres index 29a22e29..69816c48 100644 --- a/game/modules/core/model_visuals/test_vis1.tres +++ b/game/modules/core/model_visuals/test_vis1.tres @@ -20,7 +20,6 @@ [ext_resource path="res://modules/species/Human/Female/character_textures/100_seamless/armor_green_scarf.png" type="Texture" id=18] [ext_resource path="res://modules/species/Human/Female/character_textures/100_seamless/armor_red_scarf.png" type="Texture" id=19] - [sub_resource type="ModelVisualEntry" id=1] entry_0/mesh = ExtResource( 1 ) entry_0/texture = ExtResource( 16 ) diff --git a/game/player/CharacterSkeletonGD.gd b/game/player/CharacterSkeletonGD.gd index ab0e199c..9761d908 100644 --- a/game/player/CharacterSkeletonGD.gd +++ b/game/player/CharacterSkeletonGD.gd @@ -144,6 +144,8 @@ func _build_model(): func build(): setup_build_mesh() + sort_layers() + var data : Array = Array() for skele_point in range(ESS.skeletons_bones_index_get(entity_type).count(',') + 1): @@ -155,22 +157,23 @@ func build(): var bone_idx : int = skeleton.find_bone(bone_name) + var ddict : Dictionary = Dictionary() for j in range(get_model_entry_count(skele_point)): var entry : SkeletonModelEntry = get_model_entry(skele_point, j) - if entry.entry.get_mesh(model_index) != null: - var ddict : Dictionary = Dictionary() - - ddict["bone_name"] = bone_name - ddict["bone_idx"] = bone_idx - - if entry.entry.get_texture(model_index) != null: - ddict["texture"] = entry.entry.get_texture(model_index) + for k in range(entry.entry.size): + if entry.entry.get_mesh(k): + ddict["bone_name"] = bone_name + ddict["bone_idx"] = bone_idx + + ddict["transform"] = skeleton.get_bone_global_pose(bone_idx) + ddict["mesh"] = entry.entry.get_mesh(k) + + if !ddict.has("texture") && entry.entry.get_texture(k): + ddict["texture"] = entry.entry.get_texture(k) - ddict["transform"] = skeleton.get_bone_global_pose(bone_idx) - ddict["mesh"] = entry.entry.get_mesh(model_index) - - data.append(ddict) + if !ddict.empty(): + data.append(ddict) _mesh_job.data = data