diff --git a/game/characters/CharacterFrontModel.tscn b/game/characters/CharacterFrontModel.tscn index 8544bee..750f395 100644 --- a/game/characters/CharacterFrontModel.tscn +++ b/game/characters/CharacterFrontModel.tscn @@ -2191,7 +2191,7 @@ region_enabled = true region_rect = Rect2( 27, 57, 14, 6 ) [node name="Torso" type="Sprite" parent="Hip"] -position = Vector2( 0, -2.16791 ) +position = Vector2( 0, -2.24034 ) texture = ExtResource( 1 ) offset = Vector2( 0, -5 ) region_enabled = true @@ -2201,7 +2201,7 @@ __meta__ = { } [node name="leg_r" type="Sprite" parent="Hip/Torso"] -position = Vector2( -2, 0.999999 ) +position = Vector2( -2, 1 ) rotation = -0.0158546 texture = ExtResource( 1 ) offset = Vector2( 0, 3 ) @@ -2260,7 +2260,6 @@ __meta__ = { [node name="remote_arm_r" type="Sprite" parent="Hip/Torso"] position = Vector2( -5.01738, -8.74725 ) -rotation = -1.47386e-06 texture = ExtResource( 1 ) offset = Vector2( 0, 3 ) region_enabled = true diff --git a/game/spritesheet_generator/SSGen.tscn b/game/spritesheet_generator/SSGen.tscn index e75c54b..6341041 100644 --- a/game/spritesheet_generator/SSGen.tscn +++ b/game/spritesheet_generator/SSGen.tscn @@ -16,10 +16,11 @@ environment = SubResource( 1 ) [node name="TextureAtlasGenerator" type="Node2D"] script = ExtResource( 3 ) -_sprite_size = 40 +_sprite_size = 38 _sprite_num = 16 _show_atlas = true save_texture = true +modulate_color = Color( 0.705882, 0.705882, 0.705882, 1 ) animations = [ "run", "idle", "casting", "rest" ] z_index_paths = [ NodePath("Viewport/Node2D/CharacterFrontModel/Hip/Torso/remote_arm_r/remote_hand_r"), NodePath("Viewport/Node2D/CharacterFrontModel/Hip/Torso/arm_l/hand_l") ] instant_preview_path = NodePath("InstantPreview") diff --git a/game/spritesheet_generator/SheetGen.gd b/game/spritesheet_generator/SheetGen.gd index ebb8322..c03d007 100644 --- a/game/spritesheet_generator/SheetGen.gd +++ b/game/spritesheet_generator/SheetGen.gd @@ -12,6 +12,12 @@ export (bool) var generate : bool = false setget set_generate, get_generate export (String) var output_file_name : String = "res://testsave.png" +export(bool) var outline_image : bool = true +export(Color) var outline_color : Color = Color(0, 0, 0, 1) + +export(bool) var modulate_image_color : bool = true +export(Color) var modulate_color : Color = Color(1, 1, 1, 1) + export (Array, String) var animations : Array export (Array, NodePath) var z_index_paths : Array @@ -116,6 +122,13 @@ func _process(delta): var frame = _viewport.get_texture().get_data() + if modulate_image_color: + apply_modulate(frame) + + if outline_image: + generate_outline(frame) + + _sprite_preview.get_texture().set_data(frame) if not _running: @@ -232,6 +245,49 @@ func setup_direction(): a.z_index = -1 +func generate_outline(img : Image): + img.lock() + + for x in range(1, img.get_size().x - 1): + for y in range(1, img.get_size().y - 1): + var c : Color = img.get_pixel(x, y) + + if is_zero_approx(c.a): + var cxn : Color = img.get_pixel(x - 1, y) + var cxp : Color = img.get_pixel(x + 1, y) + var cyn : Color = img.get_pixel(x, y - 1) + var cyp : Color = img.get_pixel(x, y + 1) + + if cxn.is_equal_approx(outline_color): + cxn.a = 0 + + if cxp.is_equal_approx(outline_color): + cxp.a = 0 + + if cyn.is_equal_approx(outline_color): + cyn.a = 0 + + if cyp.is_equal_approx(outline_color): + cyp.a = 0 + + if !is_zero_approx(cxn.a) || !is_zero_approx(cxp.a) || !is_zero_approx(cyn.a) || !is_zero_approx(cyp.a): + img.set_pixel(x, y, outline_color) + + img.unlock() + +func apply_modulate(img : Image): + img.lock() + + for x in range(1, img.get_width()): + for y in range(1, img.get_height()): + var c : Color = img.get_pixel(x, y) + + c *= modulate_color + + img.set_pixel(x, y, c) + + img.unlock() + func create_atlas(): _image_texture = ImageTexture.new() _image_texture.create_from_image(_texture, 0) diff --git a/game/testsave.png b/game/testsave.png index a1def38..82a89d4 100644 Binary files a/game/testsave.png and b/game/testsave.png differ