mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Implemented texture layering for character clothing.
This commit is contained in:
parent
8ce19070ae
commit
3368ab132b
@ -2,18 +2,18 @@
|
||||
|
||||
[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]
|
||||
override_layer = 5
|
||||
entity_type = 1
|
||||
bone = 4
|
||||
entry_0/texture = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="ModelVisualEntry" id=2]
|
||||
override_layer = 5
|
||||
entity_type = 1
|
||||
bone = 3
|
||||
entry_0/texture = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="ModelVisualEntry" id=3]
|
||||
override_layer = 5
|
||||
entity_type = 1
|
||||
bone = 4
|
||||
entry_0/texture = ExtResource( 1 )
|
||||
|
||||
[resource]
|
||||
layer = 5
|
||||
get_visual_entries = [ SubResource( 1 ), SubResource( 2 ) ]
|
||||
get_visual_entries = [ SubResource( 2 ), SubResource( 3 ) ]
|
||||
|
@ -168,9 +168,27 @@ func build():
|
||||
|
||||
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)
|
||||
|
||||
var texture_layer_array : Array = Array()
|
||||
texture_layer_array.resize(ESS.texture_layers.count(",") + 1)
|
||||
var texture_used : bool = false
|
||||
|
||||
for j in range(get_model_entry_count(skele_point)):
|
||||
var entry : SkeletonModelEntry = get_model_entry(skele_point, j)
|
||||
|
||||
var layer : int = entry.entry.override_layer
|
||||
|
||||
if texture_layer_array.size() <= layer || texture_layer_array[layer]:
|
||||
continue
|
||||
|
||||
for k in range(entry.entry.size):
|
||||
if entry.entry.get_texture(k):
|
||||
texture_layer_array[layer] = entry.entry.get_texture(k)
|
||||
texture_used = true
|
||||
break
|
||||
|
||||
if texture_used:
|
||||
ddict["textures"] = texture_layer_array
|
||||
|
||||
if !ddict.empty():
|
||||
data.append(ddict)
|
||||
|
@ -116,10 +116,35 @@ func _execute():
|
||||
func prepare_textures() -> void:
|
||||
_texture_packer.clear()
|
||||
|
||||
var lmerger : TextureLayerMerger = TextureLayerMerger.new()
|
||||
|
||||
for i in range(data.size()):
|
||||
var ddict : Dictionary = data[i]
|
||||
var texture : Texture = ddict["texture"]
|
||||
var textures : Array = ddict["textures"]
|
||||
|
||||
var texture : Texture = null
|
||||
var tcount : int = 0
|
||||
for j in range(textures.size()):
|
||||
if textures[j]:
|
||||
tcount += 1
|
||||
|
||||
if tcount > 1:
|
||||
for j in range(textures.size() - 1, -1, -1):
|
||||
if textures[j]:
|
||||
lmerger.add_texture(textures[j])
|
||||
break
|
||||
|
||||
lmerger.merge()
|
||||
texture = lmerger.get_result_as_texture()
|
||||
lmerger.clear()
|
||||
else:
|
||||
for j in range(textures.size() - 1, -1, -1):
|
||||
if textures[j]:
|
||||
texture = textures[j]
|
||||
break
|
||||
|
||||
ddict["texture"] = texture
|
||||
|
||||
if texture != null:
|
||||
ddict["atlas_texture"] = _texture_packer.add_texture(texture)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user