Fix items overriding textures for characters.

This commit is contained in:
Relintai 2020-09-15 10:54:50 +02:00
parent e092ba9792
commit 8ce19070ae
4 changed files with 25 additions and 22 deletions

View File

@ -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 ) ]

View File

@ -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 )

View File

@ -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 )

View File

@ -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