mirror of
https://github.com/Relintai/broken_seals_2ds.git
synced 2024-11-18 12:57:21 +01:00
Rrmoved the character spritesheet generation related scripts/assets.
This commit is contained in:
parent
cde1af1fe6
commit
fc74451f29
@ -1,74 +0,0 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://player/CharacterSkeleton2DGD.gd" type="Script" id=1]
|
||||
[ext_resource path="res://characters/CharacterSideModel.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://characters/CharacterFrontModel.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://scripts/item_visuals/CharacterAtlas2D.gd" type="Script" id=4]
|
||||
[ext_resource path="res://scripts/item_visuals/CharacterAtlasEntry2D.gd" type="Script" id=5]
|
||||
[ext_resource path="res://characters/char_t1_outline_split.png" type="Texture" id=6]
|
||||
|
||||
[sub_resource type="CharacterAtlasEntry" id=1]
|
||||
script = ExtResource( 5 )
|
||||
front_rect = Rect2( 101, 15, 9, 12 )
|
||||
back_rect = Rect2( 74, 18, 9, 12 )
|
||||
right_rect = Rect2( 8, 13, 9, 12 )
|
||||
left_rect = Rect2( 8, 13, 9, 12 )
|
||||
|
||||
[sub_resource type="CharacterAtlasEntry" id=2]
|
||||
script = ExtResource( 5 )
|
||||
front_rect = Rect2( 102, 2, 7, 8 )
|
||||
back_rect = Rect2( 75, 5, 7, 8 )
|
||||
right_rect = Rect2( 9, 0, 7, 8 )
|
||||
left_rect = Rect2( 9, 0, 7, 8 )
|
||||
|
||||
[sub_resource type="CharacterAtlas" id=3]
|
||||
script = ExtResource( 4 )
|
||||
comments = "HUMANOID_BONE_HIP = 0,
|
||||
HUMANOID_BONE_TORSO = 1,
|
||||
HUMANOID_BONE_LEG_R = 2,
|
||||
HUMANOID_BONE_FOOT_R = 3,
|
||||
HUMANOID_BONE_TOE_R = 4,
|
||||
HUMANOID_BONE_LEG_L = 5,
|
||||
HUMANOID_BONE_FOOT_L = 6,
|
||||
HUMANOID_BONE_TOE_L = 7,
|
||||
HUMANOID_BONE_ARM_R = 8,
|
||||
#HUMANOID_BONE_SHOULDER_GUARD_R = 0,
|
||||
HUMANOID_BONE_HAND_R = 9,
|
||||
HUMANOID_BONE_FINGERS_R = 10,
|
||||
HUMANOID_BONE_ARM_L = 11,
|
||||
#HUMANOID_BONE_SHOULDER_GUARD_L = 0,
|
||||
HUMANOID_BONE_HAND_L = 12,
|
||||
HUMANOID_BONE_FINGERS_L = 13,
|
||||
HUMANOID_BONE_HEAD = 14,
|
||||
HUMANOID_BONE_HEAD_TOP = 15,
|
||||
HUMANOID_BONES_MAX = 16,"
|
||||
texture = ExtResource( 6 )
|
||||
slots = [ null, SubResource( 1 ), null, null, null, null, null, null, null, null, null, null, null, null, SubResource( 2 ), null ]
|
||||
|
||||
[node name="Character" type="CharacterSkeleton2D"]
|
||||
entity_type = 1
|
||||
attach_point_paths/0_left_hand = NodePath("")
|
||||
attach_point_paths/1_right_hand = NodePath("")
|
||||
attach_point_paths/2_torso = NodePath("")
|
||||
attach_point_paths/3_root = NodePath("")
|
||||
attach_point_paths/4_right_hip = NodePath("")
|
||||
attach_point_paths/5_left_hip = NodePath("")
|
||||
attach_point_paths/6_spine_2 = NodePath("")
|
||||
attach_point_paths/7_weapon_left = NodePath("")
|
||||
attach_point_paths/8_weapon_right = NodePath("")
|
||||
attach_point_paths/9_weapon_left_back = NodePath("")
|
||||
attach_point_paths/10_weapon_right_back = NodePath("")
|
||||
attach_point_paths/11_weapon_shield_left = NodePath("")
|
||||
script = ExtResource( 1 )
|
||||
front_node_path = NodePath("CharacterFrontModel")
|
||||
front_animation_player_path = NodePath("../Character/CharacterFrontModel/AnimationPlayer")
|
||||
front_animation_tree_path = NodePath("../Character/CharacterFrontModel/AnimationTree")
|
||||
side_node_path = NodePath("CharacterSideModel")
|
||||
side_animation_player_path = NodePath("../Character/CharacterSideModel/AnimationPlayer")
|
||||
side_animation_tree_path = NodePath("../Character/CharacterSideModel/AnimationTree")
|
||||
character_atlas = SubResource( 3 )
|
||||
|
||||
[node name="CharacterFrontModel" parent="." instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
|
||||
[node name="CharacterSideModel" parent="." instance=ExtResource( 2 )]
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,109 +0,0 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://characters/char_t1_outline_split.png" type="Texture" id=1]
|
||||
|
||||
|
||||
[node name="CharacterTest1" type="Node2D"]
|
||||
|
||||
[node name="model" type="Sprite" parent="."]
|
||||
visible = false
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, -15.5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 49, 21, 13, 37 )
|
||||
|
||||
[node name="Shadow" type="Sprite" parent="."]
|
||||
position = Vector2( -0.5, 0 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 27, 57, 14, 6 )
|
||||
|
||||
[node name="RightUpperHand" type="Sprite" parent="."]
|
||||
position = Vector2( -3.5, -25.5 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 1, 11, 4, 9 )
|
||||
|
||||
[node name="RightLowerHand" type="Sprite" parent="."]
|
||||
position = Vector2( -3.47278, -19.9516 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 1, 23, 4, 8 )
|
||||
|
||||
[node name="Torso" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -16 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, -5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 8, 13, 9, 12 )
|
||||
|
||||
[node name="LeftShoulderGuard" type="Sprite" parent="."]
|
||||
position = Vector2( -2.5, -25 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( -1, -1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0.39, 5.79, 6.91, 4.67 )
|
||||
|
||||
[node name="Head" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -26 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, -4 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 9, 0, 7, 8 )
|
||||
|
||||
[node name="LeftUpperArm" type="Sprite" parent="."]
|
||||
position = Vector2( 4, -24 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 2.5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 20, 11, 3, 9 )
|
||||
|
||||
[node name="RightShoulderGuard" type="Sprite" parent="."]
|
||||
position = Vector2( 4, -25.5 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, -0.5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 17.23, 5.56, 6.41, 4.89 )
|
||||
|
||||
[node name="RightUpperLeg" type="Sprite" parent="."]
|
||||
position = Vector2( -2, -13 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 5, 36, 5, 8 )
|
||||
|
||||
[node name="RightLowerLeg" type="Sprite" parent="."]
|
||||
position = Vector2( -3, -8 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 4 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 3, 48, 7, 10 )
|
||||
|
||||
[node name="LeftUpperLeg" type="Sprite" parent="."]
|
||||
position = Vector2( 2, -12.5 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 14, 36, 5, 9 )
|
||||
|
||||
[node name="LeftLowerLeg" type="Sprite" parent="."]
|
||||
position = Vector2( 2, -8 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 4 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 14, 48, 5, 10 )
|
||||
|
||||
[node name="Hip" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -14 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 8, 32, 7, 2 )
|
||||
|
||||
[node name="LeftLowerArm" type="Sprite" parent="."]
|
||||
position = Vector2( 4, -18 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 2 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 20, 24, 3, 6 )
|
@ -1,52 +0,0 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://characters/naturalist_characteratlas.tres" type="CharacterAtlas" id=1]
|
||||
[ext_resource path="res://player/CharacterSkeleton2DGD.gd" type="Script" id=2]
|
||||
[ext_resource path="res://characters/CharacterSideModel.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://characters/CharacterFrontModel.tscn" type="PackedScene" id=6]
|
||||
|
||||
[node name="Character" type="CharacterSkeleton2D"]
|
||||
entity_type = 1
|
||||
attach_point_paths/0_left_hand = NodePath("")
|
||||
attach_point_paths/1_right_hand = NodePath("")
|
||||
attach_point_paths/2_torso = NodePath("")
|
||||
attach_point_paths/3_root = NodePath("")
|
||||
attach_point_paths/4_right_hip = NodePath("")
|
||||
attach_point_paths/5_left_hip = NodePath("")
|
||||
attach_point_paths/6_spine_2 = NodePath("")
|
||||
attach_point_paths/7_weapon_left = NodePath("")
|
||||
attach_point_paths/8_weapon_right = NodePath("")
|
||||
attach_point_paths/9_weapon_left_back = NodePath("")
|
||||
attach_point_paths/10_weapon_right_back = NodePath("")
|
||||
attach_point_paths/11_weapon_shield_left = NodePath("")
|
||||
script = ExtResource( 2 )
|
||||
front_node_path = NodePath("CharacterFrontModel")
|
||||
front_animation_player_path = NodePath("../Character/CharacterFrontModel/AnimationPlayer")
|
||||
front_animation_tree_path = NodePath("../Character/CharacterFrontModel/AnimationTree")
|
||||
side_node_path = NodePath("CharacterSideModel")
|
||||
side_animation_player_path = NodePath("../Character/CharacterSideModel/AnimationPlayer")
|
||||
side_animation_tree_path = NodePath("../Character/CharacterSideModel/AnimationTree")
|
||||
character_atlas = ExtResource( 1 )
|
||||
|
||||
[node name="CharacterFrontModel" parent="." instance=ExtResource( 6 )]
|
||||
visible = false
|
||||
|
||||
[node name="Torso" parent="CharacterFrontModel/Hip" index="1"]
|
||||
position = Vector2( 0, -2.33066 )
|
||||
|
||||
[node name="leg_r" parent="CharacterFrontModel/Hip/Torso" index="0"]
|
||||
position = Vector2( -2, 1 )
|
||||
|
||||
[node name="CharacterSideModel" parent="." instance=ExtResource( 5 )]
|
||||
|
||||
[node name="arm_r" parent="CharacterSideModel" index="0"]
|
||||
position = Vector2( -3.49998, -24.142 )
|
||||
|
||||
[node name="hand_r" parent="CharacterSideModel" index="1"]
|
||||
position = Vector2( -3.49998, -18.642 )
|
||||
|
||||
[node name="Torso" parent="CharacterSideModel/Hip" index="3"]
|
||||
position = Vector2( 5.75098e-05, -1.52647 )
|
||||
|
||||
[editable path="CharacterFrontModel"]
|
||||
[editable path="CharacterSideModel"]
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
@ -1,35 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/char_t1_outline_split - Copy.png-88d6d74e7874948f07096fd2e5e6ae3a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://characters/char_t1_outline_split - Copy.png"
|
||||
dest_files=[ "res://.import/char_t1_outline_split - Copy.png-88d6d74e7874948f07096fd2e5e6ae3a.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB |
@ -1,35 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/char_t1_outline_split.png-9c3f609f043903cf305339bc84929b57.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://characters/char_t1_outline_split.png"
|
||||
dest_files=[ "res://.import/char_t1_outline_split.png-9c3f609f043903cf305339bc84929b57.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
@ -1,43 +0,0 @@
|
||||
[gd_resource type="CharacterAtlas" load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/item_visuals/CharacterAtlas2D.gd" type="Script" id=1]
|
||||
[ext_resource path="res://characters/char_t1_outline_split.png" type="Texture" id=2]
|
||||
[ext_resource path="res://scripts/item_visuals/CharacterAtlasEntry2D.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="CharacterAtlasEntry" id=1]
|
||||
script = ExtResource( 3 )
|
||||
front_rect = Rect2( 101, 15, 9, 12 )
|
||||
back_rect = Rect2( 74, 18, 9, 12 )
|
||||
right_rect = Rect2( 8, 13, 9, 12 )
|
||||
left_rect = Rect2( 8, 13, 9, 12 )
|
||||
|
||||
[sub_resource type="CharacterAtlasEntry" id=2]
|
||||
script = ExtResource( 3 )
|
||||
front_rect = Rect2( 102, 2, 7, 8 )
|
||||
back_rect = Rect2( 75, 5, 7, 8 )
|
||||
right_rect = Rect2( 9, 0, 7, 8 )
|
||||
left_rect = Rect2( 9, 0, 7, 8 )
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
comments = "HUMANOID_BONE_HIP = 0,
|
||||
HUMANOID_BONE_TORSO = 1,
|
||||
HUMANOID_BONE_LEG_R = 2,
|
||||
HUMANOID_BONE_FOOT_R = 3,
|
||||
HUMANOID_BONE_TOE_R = 4,
|
||||
HUMANOID_BONE_LEG_L = 5,
|
||||
HUMANOID_BONE_FOOT_L = 6,
|
||||
HUMANOID_BONE_TOE_L = 7,
|
||||
HUMANOID_BONE_ARM_R = 8,
|
||||
#HUMANOID_BONE_SHOULDER_GUARD_R = 0,
|
||||
HUMANOID_BONE_HAND_R = 9,
|
||||
HUMANOID_BONE_FINGERS_R = 10,
|
||||
HUMANOID_BONE_ARM_L = 11,
|
||||
#HUMANOID_BONE_SHOULDER_GUARD_L = 0,
|
||||
HUMANOID_BONE_HAND_L = 12,
|
||||
HUMANOID_BONE_FINGERS_L = 13,
|
||||
HUMANOID_BONE_HEAD = 14,
|
||||
HUMANOID_BONE_HEAD_TOP = 15,
|
||||
HUMANOID_BONES_MAX = 16,"
|
||||
texture = ExtResource( 2 )
|
||||
slots = [ null, SubResource( 1 ), null, null, null, null, null, null, null, null, null, null, null, null, SubResource( 2 ), null ]
|
@ -1,17 +1,18 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://characters/Character.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://player/Mob.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="EntityResourceHealth" id=2]
|
||||
|
||||
[sub_resource type="EntityResourceSpeed" id=3]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 20.0
|
||||
|
||||
[node name="Mob" type="Entity" groups=[
|
||||
"mobs",
|
||||
]]
|
||||
[node name="Mob" type="Entity" groups=["mobs"]]
|
||||
body_path = NodePath("KinematicBody2D")
|
||||
character_skeleton_path = NodePath("KinematicBody2D/Character")
|
||||
sresources = [ SubResource( 2 ), SubResource( 3 ) ]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="NamePlate" parent="." instance=ExtResource( 1 )]
|
||||
@ -20,5 +21,3 @@ script = ExtResource( 3 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Character" parent="KinematicBody2D" instance=ExtResource( 2 )]
|
||||
|
@ -1,8 +1,7 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://player/NetworkedPlayer.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://characters/Character.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="EntityResourceHealth" id=1]
|
||||
|
||||
@ -13,7 +12,6 @@ radius = 20.0
|
||||
|
||||
[node name="NetworkedPlayer" type="Entity"]
|
||||
body_path = NodePath("KinematicBody2D")
|
||||
character_skeleton_path = NodePath("KinematicBody2D/Character")
|
||||
sresources = [ SubResource( 1 ), SubResource( 2 ) ]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
@ -23,5 +21,3 @@ script = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="Character" parent="KinematicBody2D" instance=ExtResource( 3 )]
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,113 +0,0 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://characters/CharacterFrontModel.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://characters/CharacterSideModel.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://spritesheet_generator/SheetGen.gd" type="Script" id=3]
|
||||
[ext_resource path="res://testsave.png" type="Texture" id=4]
|
||||
[ext_resource path="res://spritesheet_generator/SpriteMover.gd" type="Script" id=5]
|
||||
[ext_resource path="res://characters/naturalist_characteratlas.tres" type="CharacterAtlas" id=6]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/spell_effects/nature2d/NatureCast.tscn" type="PackedScene" id=7]
|
||||
|
||||
[sub_resource type="Environment" id=1]
|
||||
ssao_enabled = true
|
||||
|
||||
[sub_resource type="World" id=2]
|
||||
environment = SubResource( 1 )
|
||||
|
||||
[node name="TextureAtlasGenerator" type="Node2D"]
|
||||
script = ExtResource( 3 )
|
||||
_sprite_size = 38
|
||||
_sprite_num = 16
|
||||
_show_atlas = true
|
||||
save_texture = true
|
||||
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")
|
||||
sprite_preview_path = NodePath("SpritePreview")
|
||||
viewport_path = NodePath("Viewport")
|
||||
atlas_preview_path = NodePath("AtlasPreview")
|
||||
model_front_path = NodePath("Viewport/Node2D/CharacterFrontModel")
|
||||
model_front_animation_player_path = NodePath("Viewport/Node2D/CharacterFrontModel/AnimationPlayer")
|
||||
model_front_animation_tree_player_path = NodePath("Viewport/Node2D/CharacterFrontModel/AnimationTree")
|
||||
model_side_path = NodePath("Viewport/Node2D/CharacterSideModel")
|
||||
model_side_animation_player_path = NodePath("Viewport/Node2D/CharacterSideModel/AnimationPlayer")
|
||||
model_side_animation_tree_player_path = NodePath("Viewport/Node2D/CharacterSideModel/AnimationTree")
|
||||
cast_animation_index = 2
|
||||
cast_animation_scene = ExtResource( 7 )
|
||||
cast_animation_paths = [ NodePath("Viewport/Node2D/CharacterFrontModel/Hip/Torso/remote_arm_r/remote_hand_r/Position2D"), NodePath("Viewport/Node2D/CharacterFrontModel/Hip/Torso/arm_l/hand_l/end"), NodePath("Viewport/Node2D/CharacterSideModel/Hip/Torso/remote_arm_r/remote_hand_r/Position2D"), NodePath("Viewport/Node2D/CharacterSideModel/Hip/Torso/arm_l/hand_l/end") ]
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="."]
|
||||
size = Vector2( 64, 64 )
|
||||
own_world = true
|
||||
world = SubResource( 2 )
|
||||
transparent_bg = true
|
||||
handle_input_locally = false
|
||||
hdr = false
|
||||
usage = 0
|
||||
render_target_v_flip = true
|
||||
render_target_update_mode = 3
|
||||
|
||||
[node name="Camera" type="Camera2D" parent="Viewport"]
|
||||
position = Vector2( 0, -15.726 )
|
||||
z_index = 2
|
||||
current = true
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="Viewport"]
|
||||
|
||||
[node name="CharacterFrontModel" parent="Viewport/Node2D" instance=ExtResource( 1 )]
|
||||
_atlas = ExtResource( 6 )
|
||||
|
||||
[node name="Torso" parent="Viewport/Node2D/CharacterFrontModel/Hip" index="1"]
|
||||
position = Vector2( 0, -2.289 )
|
||||
|
||||
[node name="hand_l" parent="Viewport/Node2D/CharacterFrontModel/Hip/Torso/arm_l" index="0"]
|
||||
z_index = 1
|
||||
|
||||
[node name="AnimationTree" parent="Viewport/Node2D/CharacterFrontModel" index="2"]
|
||||
active = false
|
||||
|
||||
[node name="CharacterSideModel" parent="Viewport/Node2D" instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
rotation = 3.14147
|
||||
scale = Vector2( 1, -1 )
|
||||
_atlas = ExtResource( 6 )
|
||||
|
||||
[node name="arm_r" parent="Viewport/Node2D/CharacterSideModel" index="0"]
|
||||
position = Vector2( -3.50004, -24.6155 )
|
||||
|
||||
[node name="hand_r" parent="Viewport/Node2D/CharacterSideModel" index="1"]
|
||||
position = Vector2( -3.50004, -19.1155 )
|
||||
z_index = 1
|
||||
|
||||
[node name="Torso" parent="Viewport/Node2D/CharacterSideModel/Hip" index="3"]
|
||||
position = Vector2( 0, -2 )
|
||||
|
||||
[node name="AnimationTree" parent="Viewport/Node2D/CharacterSideModel" index="4"]
|
||||
active = false
|
||||
|
||||
[node name="InstantPreview" type="Sprite" parent="."]
|
||||
|
||||
[node name="SpritePreview" type="Sprite" parent="."]
|
||||
|
||||
[node name="AtlasPreview" type="Sprite" parent="."]
|
||||
position = Vector2( 603.531, 254.594 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 101.579, 162.161 )
|
||||
texture = ExtResource( 4 )
|
||||
hframes = 16
|
||||
vframes = 16
|
||||
frame = 9
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Test" type="Sprite" parent="."]
|
||||
position = Vector2( -91.0568, 21.4517 )
|
||||
texture = ExtResource( 4 )
|
||||
hframes = 16
|
||||
vframes = 16
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
current = true
|
||||
|
||||
[editable path="Viewport/Node2D/CharacterFrontModel"]
|
||||
[editable path="Viewport/Node2D/CharacterSideModel"]
|
@ -1,138 +0,0 @@
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://characters/CharacterFrontModel.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://characters/CharacterSideModel.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://spritesheet_generator/SheetGenv2.gd" type="Script" id=3]
|
||||
[ext_resource path="res://testsave.png" type="Texture" id=4]
|
||||
[ext_resource path="res://spritesheet_generator/SpriteMover.gd" type="Script" id=5]
|
||||
[ext_resource path="res://characters/naturalist_characteratlas.tres" type="CharacterAtlas" id=6]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/spell_effects/nature2d/NatureCast.tscn" type="PackedScene" id=7]
|
||||
|
||||
[sub_resource type="Environment" id=1]
|
||||
ssao_enabled = true
|
||||
|
||||
[sub_resource type="World" id=2]
|
||||
environment = SubResource( 1 )
|
||||
|
||||
[sub_resource type="Environment" id=3]
|
||||
|
||||
[sub_resource type="World" id=4]
|
||||
environment = SubResource( 3 )
|
||||
|
||||
[node name="TextureAtlasGenerator" type="Node2D"]
|
||||
script = ExtResource( 3 )
|
||||
_sprite_size = 26
|
||||
_sprite_num = 16
|
||||
outline_color = Color( 0.027451, 0.027451, 0.027451, 1 )
|
||||
_show_atlas = true
|
||||
save_texture = true
|
||||
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") ]
|
||||
wp2_sprite3d_path = NodePath("Viewport2/Sprite3D")
|
||||
instant_preview_path = NodePath("InstantPreview")
|
||||
sprite_preview_path = NodePath("SpritePreview")
|
||||
viewport_path = NodePath("Viewport")
|
||||
viewport2_path = NodePath("Viewport2")
|
||||
atlas_preview_path = NodePath("AtlasPreview")
|
||||
model_front_path = NodePath("Viewport/Node2D/CharacterFrontModel")
|
||||
model_front_animation_player_path = NodePath("Viewport/Node2D/CharacterFrontModel/AnimationPlayer")
|
||||
model_front_animation_tree_player_path = NodePath("Viewport/Node2D/CharacterFrontModel/AnimationTree")
|
||||
model_side_path = NodePath("Viewport/Node2D/CharacterSideModel")
|
||||
model_side_animation_player_path = NodePath("Viewport/Node2D/CharacterSideModel/AnimationPlayer")
|
||||
model_side_animation_tree_player_path = NodePath("Viewport/Node2D/CharacterSideModel/AnimationTree")
|
||||
cast_animation_index = 2
|
||||
cast_animation_scene = ExtResource( 7 )
|
||||
cast_animation_paths = [ NodePath("Viewport/Node2D/CharacterFrontModel/Hip/Torso/remote_arm_r/remote_hand_r/Position2D"), NodePath("Viewport/Node2D/CharacterFrontModel/Hip/Torso/arm_l/hand_l/end"), NodePath("Viewport/Node2D/CharacterSideModel/Hip/Torso/remote_arm_r/remote_hand_r/Position2D"), NodePath("Viewport/Node2D/CharacterSideModel/Hip/Torso/arm_l/hand_l/end") ]
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="."]
|
||||
size = Vector2( 64, 64 )
|
||||
own_world = true
|
||||
world = SubResource( 2 )
|
||||
transparent_bg = true
|
||||
handle_input_locally = false
|
||||
hdr = false
|
||||
usage = 0
|
||||
render_target_v_flip = true
|
||||
render_target_update_mode = 3
|
||||
|
||||
[node name="Camera" type="Camera2D" parent="Viewport"]
|
||||
position = Vector2( 0, -15.726 )
|
||||
z_index = 2
|
||||
current = true
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="Viewport"]
|
||||
|
||||
[node name="CharacterFrontModel" parent="Viewport/Node2D" instance=ExtResource( 1 )]
|
||||
_atlas = ExtResource( 6 )
|
||||
|
||||
[node name="Torso" parent="Viewport/Node2D/CharacterFrontModel/Hip" index="1"]
|
||||
position = Vector2( 0, -2.289 )
|
||||
|
||||
[node name="hand_l" parent="Viewport/Node2D/CharacterFrontModel/Hip/Torso/arm_l" index="0"]
|
||||
z_index = 1
|
||||
|
||||
[node name="AnimationTree" parent="Viewport/Node2D/CharacterFrontModel" index="2"]
|
||||
active = false
|
||||
|
||||
[node name="CharacterSideModel" parent="Viewport/Node2D" instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
rotation = 3.14147
|
||||
scale = Vector2( 1, -1 )
|
||||
_atlas = ExtResource( 6 )
|
||||
|
||||
[node name="arm_r" parent="Viewport/Node2D/CharacterSideModel" index="0"]
|
||||
position = Vector2( -3.50004, -24.6155 )
|
||||
|
||||
[node name="hand_r" parent="Viewport/Node2D/CharacterSideModel" index="1"]
|
||||
position = Vector2( -3.50004, -19.1155 )
|
||||
z_index = 1
|
||||
|
||||
[node name="Torso" parent="Viewport/Node2D/CharacterSideModel/Hip" index="3"]
|
||||
position = Vector2( 0, -2 )
|
||||
|
||||
[node name="AnimationTree" parent="Viewport/Node2D/CharacterSideModel" index="4"]
|
||||
active = false
|
||||
|
||||
[node name="Viewport2" type="Viewport" parent="."]
|
||||
size = Vector2( 64, 64 )
|
||||
own_world = true
|
||||
world = SubResource( 4 )
|
||||
transparent_bg = true
|
||||
handle_input_locally = false
|
||||
keep_3d_linear = true
|
||||
render_target_v_flip = true
|
||||
render_target_update_mode = 3
|
||||
|
||||
[node name="Camera" type="Camera" parent="Viewport2"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.889783, 0.456384, 0, -0.456384, 0.889783, 0, 0.154229, 0.172536 )
|
||||
projection = 1
|
||||
current = true
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Viewport2"]
|
||||
|
||||
[node name="InstantPreview" type="Sprite" parent="."]
|
||||
|
||||
[node name="SpritePreview" type="Sprite" parent="."]
|
||||
|
||||
[node name="AtlasPreview" type="Sprite" parent="."]
|
||||
position = Vector2( 603.531, 254.594 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 101.579, 162.161 )
|
||||
texture = ExtResource( 4 )
|
||||
hframes = 16
|
||||
vframes = 16
|
||||
frame = 9
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Test" type="Sprite" parent="."]
|
||||
position = Vector2( -91.0568, 21.4517 )
|
||||
texture = ExtResource( 4 )
|
||||
hframes = 16
|
||||
vframes = 16
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
current = true
|
||||
|
||||
[editable path="Viewport/Node2D/CharacterFrontModel"]
|
||||
[editable path="Viewport/Node2D/CharacterSideModel"]
|
@ -1,314 +0,0 @@
|
||||
extends Node
|
||||
|
||||
export (int) var _sprite_size
|
||||
export (int) var _sprite_num
|
||||
var _directions : int = 4
|
||||
|
||||
export (bool) var _show_atlas = false
|
||||
|
||||
export (bool) var save_texture = false
|
||||
|
||||
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
|
||||
|
||||
export (NodePath) var instant_preview_path
|
||||
export (NodePath) var sprite_preview_path
|
||||
export (NodePath) var viewport_path
|
||||
export (NodePath) var atlas_preview_path
|
||||
|
||||
export (NodePath) var model_front_path
|
||||
export (NodePath) var model_front_animation_player_path
|
||||
export (NodePath) var model_front_animation_tree_player_path
|
||||
export (NodePath) var model_side_path
|
||||
export (NodePath) var model_side_animation_player_path
|
||||
export (NodePath) var model_side_animation_tree_player_path
|
||||
|
||||
export(int) var cast_animation_index : int = 0
|
||||
export(PackedScene) var cast_animation_scene : PackedScene = null
|
||||
export (Array, NodePath) var cast_animation_paths : Array
|
||||
var cast_animations : Array
|
||||
|
||||
var _viewport
|
||||
var _viewport_texture
|
||||
var _atlas
|
||||
var _image_texture
|
||||
var _atlas_texture
|
||||
|
||||
var _instant_preview
|
||||
var _sprite_preview
|
||||
var _atlas_preview
|
||||
|
||||
var _time = 0
|
||||
var _frame = 0
|
||||
var _index = 0
|
||||
var _direction = 0
|
||||
var _current_animation_index = 0
|
||||
var _current_animation_player = null
|
||||
|
||||
var _running = false
|
||||
|
||||
var _model_front
|
||||
var _model_front_animation_player
|
||||
var _model_front_animation_tree_player
|
||||
var _model_side
|
||||
var _model_side_animation_player
|
||||
var _model_side_animation_tree_player
|
||||
|
||||
var _texture
|
||||
|
||||
var _first = true
|
||||
|
||||
func _ready():
|
||||
_viewport = get_node(viewport_path)
|
||||
|
||||
_instant_preview = get_node(instant_preview_path)
|
||||
_sprite_preview = get_node(sprite_preview_path)
|
||||
_atlas_preview = get_node(atlas_preview_path)
|
||||
|
||||
var img = ImageTexture.new()
|
||||
img.flags = 0
|
||||
img.create(_sprite_size, _sprite_size, 5, 0)
|
||||
_sprite_preview.texture = img
|
||||
|
||||
_model_front = get_node(model_front_path)
|
||||
_model_front_animation_player = get_node(model_front_animation_player_path)
|
||||
_model_front_animation_tree_player = get_node(model_front_animation_tree_player_path)
|
||||
|
||||
if _model_side_animation_tree_player:
|
||||
_model_front_animation_tree_player.active = false
|
||||
|
||||
_model_side = get_node(model_side_path)
|
||||
_model_side_animation_player = get_node(model_side_animation_player_path)
|
||||
_model_side_animation_tree_player = get_node(model_side_animation_tree_player_path)
|
||||
|
||||
if _model_side_animation_tree_player:
|
||||
_model_side_animation_tree_player.active = false
|
||||
|
||||
_model_front.hide()
|
||||
_model_side.show()
|
||||
|
||||
_viewport_texture = _viewport.get_texture()
|
||||
|
||||
_texture = Image.new()
|
||||
var frame = _viewport.get_texture().get_data()
|
||||
_texture.create(_sprite_size * _sprite_num, _sprite_size * _directions * animations.size(), false, frame.get_format())
|
||||
|
||||
_running = true
|
||||
set_process(true)
|
||||
|
||||
func _process(delta):
|
||||
#todo remove, only to make development easier
|
||||
if !_viewport:
|
||||
_ready()
|
||||
|
||||
if _first:
|
||||
_first = false
|
||||
|
||||
setup_direction()
|
||||
|
||||
setup_animation()
|
||||
|
||||
return
|
||||
|
||||
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:
|
||||
return
|
||||
|
||||
if _frame >= _sprite_num:
|
||||
_frame = 0
|
||||
_index += 1
|
||||
_direction += 1
|
||||
|
||||
if _direction >= _directions:
|
||||
_direction = 0
|
||||
|
||||
_current_animation_index += 1
|
||||
|
||||
setup_direction()
|
||||
|
||||
if (_index >= _directions * animations.size()):
|
||||
_running = false
|
||||
create_atlas()
|
||||
return
|
||||
|
||||
setup_animation()
|
||||
|
||||
return
|
||||
|
||||
var ur = frame.get_used_rect()
|
||||
var xx : float = 0
|
||||
xx = (_sprite_size - ur.size.x) / 2
|
||||
|
||||
_texture.blend_rect(frame, ur, Vector2((_frame * _sprite_size) + xx, (_index * _sprite_size)))
|
||||
|
||||
_current_animation_player.seek(_frame * (_current_animation_player.current_animation_length / (_sprite_num)), true)
|
||||
|
||||
_frame += 1
|
||||
|
||||
func setup_animation():
|
||||
_current_animation_player.play(animations[_current_animation_index])
|
||||
_current_animation_player.seek(0, true)
|
||||
|
||||
if !cast_animation_scene:
|
||||
return
|
||||
|
||||
if _current_animation_index == cast_animation_index:
|
||||
for cap in cast_animation_paths:
|
||||
var n = get_node(cap)
|
||||
|
||||
if !n:
|
||||
continue
|
||||
|
||||
var pa = cast_animation_scene.instance()
|
||||
|
||||
cast_animations.push_back(pa)
|
||||
|
||||
n.add_child(pa)
|
||||
else:
|
||||
for n in cast_animations:
|
||||
n.queue_free()
|
||||
|
||||
cast_animations.clear()
|
||||
|
||||
#enum CharacterFacing
|
||||
# FACING_FRONT = 0,
|
||||
# FACING_BACK = 1,
|
||||
# FACING_RIGHT = 2,
|
||||
# FACING_LEFT = 3,
|
||||
|
||||
func setup_direction():
|
||||
for a in cast_animations:
|
||||
if a.has_method("get_z_index"):
|
||||
a.z_index = 0
|
||||
|
||||
if _direction == 0:
|
||||
_current_animation_player = _model_side_animation_player
|
||||
_model_side.set_facing(2)
|
||||
_model_side.transform.x.x = -1
|
||||
|
||||
_model_side.show()
|
||||
_model_front.hide()
|
||||
|
||||
for np in z_index_paths:
|
||||
get_node(np).z_index = 0
|
||||
if _direction == 1:
|
||||
_current_animation_player = _model_side_animation_player
|
||||
_model_side.set_facing(3)
|
||||
_model_side.transform.x.x = 1
|
||||
|
||||
_model_side.show()
|
||||
_model_front.hide()
|
||||
|
||||
for np in z_index_paths:
|
||||
get_node(np).z_index = 0
|
||||
if _direction == 2:
|
||||
_current_animation_player = _model_front_animation_player
|
||||
_model_front.set_facing(0)
|
||||
|
||||
_model_side.hide()
|
||||
_model_front.show()
|
||||
|
||||
for np in z_index_paths:
|
||||
get_node(np).z_index = 0
|
||||
if _direction == 3:
|
||||
_current_animation_player = _model_front_animation_player
|
||||
_model_front.set_facing(1)
|
||||
|
||||
_model_side.hide()
|
||||
_model_front.show()
|
||||
|
||||
for np in z_index_paths:
|
||||
get_node(np).z_index = -1
|
||||
|
||||
for a in cast_animations:
|
||||
if a.has_method("get_z_index"):
|
||||
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)
|
||||
|
||||
_image_texture.get_data().save_png(output_file_name)
|
||||
|
||||
if save_texture:
|
||||
_sprite_preview.set_texture(_image_texture)
|
||||
|
||||
if _show_atlas:
|
||||
_atlas_preview.set_texture(_image_texture)
|
||||
|
||||
|
||||
func set_generate(v : bool) -> void:
|
||||
if !v:
|
||||
return
|
||||
|
||||
#for easier development
|
||||
_ready()
|
||||
_running = true
|
||||
#set_process(true)
|
||||
|
||||
func get_generate() -> bool:
|
||||
return false
|
@ -1,331 +0,0 @@
|
||||
extends Node
|
||||
|
||||
export (int) var _sprite_size
|
||||
export (int) var _sprite_num
|
||||
var _directions : int = 4
|
||||
|
||||
export(bool) var outline_image : bool = true
|
||||
export(Color) var outline_color : Color = Color(0, 0, 0, 1)
|
||||
|
||||
export (bool) var _show_atlas = false
|
||||
|
||||
export (bool) var save_texture = false
|
||||
|
||||
export (bool) var generate : bool = false setget set_generate, get_generate
|
||||
|
||||
export (String) var output_file_name : String = "res://testsave.png"
|
||||
|
||||
export (Array, String) var animations : Array
|
||||
export (Array, NodePath) var z_index_paths : Array
|
||||
|
||||
export (NodePath) var wp2_sprite3d_path
|
||||
|
||||
export (NodePath) var instant_preview_path
|
||||
export (NodePath) var sprite_preview_path
|
||||
export (NodePath) var viewport_path
|
||||
export (NodePath) var viewport2_path
|
||||
export (NodePath) var atlas_preview_path
|
||||
|
||||
export (NodePath) var model_front_path
|
||||
export (NodePath) var model_front_animation_player_path
|
||||
export (NodePath) var model_front_animation_tree_player_path
|
||||
export (NodePath) var model_side_path
|
||||
export (NodePath) var model_side_animation_player_path
|
||||
export (NodePath) var model_side_animation_tree_player_path
|
||||
|
||||
export(int) var cast_animation_index : int = 0
|
||||
export(PackedScene) var cast_animation_scene : PackedScene = null
|
||||
export (Array, NodePath) var cast_animation_paths : Array
|
||||
var cast_animations : Array
|
||||
|
||||
var _wp2_sprite3d
|
||||
|
||||
var _viewport
|
||||
var _viewport_texture
|
||||
var _viewport2
|
||||
var _viewport2_texture
|
||||
var _atlas
|
||||
var _image_texture
|
||||
var _atlas_texture
|
||||
|
||||
var _instant_preview
|
||||
var _sprite_preview
|
||||
var _atlas_preview
|
||||
|
||||
var _time = 0
|
||||
var _frame = 0
|
||||
var _index = 0
|
||||
var _frame_atlas = 0
|
||||
var _index_atlas = 0
|
||||
var _direction = 0
|
||||
var _current_animation_index = 0
|
||||
var _current_animation_player = null
|
||||
|
||||
var _running = false
|
||||
|
||||
var _model_front
|
||||
var _model_front_animation_player
|
||||
var _model_front_animation_tree_player
|
||||
var _model_side
|
||||
var _model_side_animation_player
|
||||
var _model_side_animation_tree_player
|
||||
|
||||
var _texture
|
||||
var _texture2
|
||||
|
||||
var _first = true
|
||||
var _first_frame = true
|
||||
|
||||
func _ready():
|
||||
_viewport = get_node(viewport_path)
|
||||
_viewport2 = get_node(viewport2_path)
|
||||
_wp2_sprite3d = get_node(wp2_sprite3d_path)
|
||||
|
||||
_instant_preview = get_node(instant_preview_path)
|
||||
_sprite_preview = get_node(sprite_preview_path)
|
||||
_atlas_preview = get_node(atlas_preview_path)
|
||||
|
||||
var img = ImageTexture.new()
|
||||
img.flags = 0
|
||||
img.create(_sprite_size, _sprite_size, 5, 0)
|
||||
_sprite_preview.texture = img
|
||||
|
||||
var img2 = ImageTexture.new()
|
||||
img2.flags = 0
|
||||
img2.create(64, 64, 5, 0)
|
||||
_wp2_sprite3d.texture = img2
|
||||
|
||||
_model_front = get_node(model_front_path)
|
||||
_model_front_animation_player = get_node(model_front_animation_player_path)
|
||||
_model_front_animation_tree_player = get_node(model_front_animation_tree_player_path)
|
||||
|
||||
if _model_side_animation_tree_player:
|
||||
_model_front_animation_tree_player.active = false
|
||||
|
||||
_model_side = get_node(model_side_path)
|
||||
_model_side_animation_player = get_node(model_side_animation_player_path)
|
||||
_model_side_animation_tree_player = get_node(model_side_animation_tree_player_path)
|
||||
|
||||
if _model_side_animation_tree_player:
|
||||
_model_side_animation_tree_player.active = false
|
||||
|
||||
_model_front.hide()
|
||||
_model_side.show()
|
||||
|
||||
_viewport_texture = _viewport.get_texture()
|
||||
|
||||
_texture = Image.new()
|
||||
var frame = _viewport.get_texture().get_data()
|
||||
_texture.create(64, 64, false, frame.get_format())
|
||||
|
||||
_texture2 = Image.new()
|
||||
var frame2 = _viewport2.get_texture().get_data()
|
||||
_texture2.create(_sprite_size * _sprite_num, _sprite_size * _directions * animations.size(), false, frame2.get_format())
|
||||
|
||||
|
||||
_running = true
|
||||
set_process(true)
|
||||
|
||||
func _process(delta):
|
||||
if not _running:
|
||||
return
|
||||
|
||||
#todo remove, only to make development easier
|
||||
if !_viewport || !_viewport2:
|
||||
_ready()
|
||||
|
||||
if _first:
|
||||
_first = false
|
||||
|
||||
setup_direction()
|
||||
setup_animation()
|
||||
|
||||
return
|
||||
|
||||
var frame = _viewport.get_texture().get_data()
|
||||
|
||||
_wp2_sprite3d.get_texture().set_data(frame)
|
||||
|
||||
if _first_frame:
|
||||
_first_frame = false
|
||||
#we need to let the second step render the first image from the prev step
|
||||
return
|
||||
|
||||
var frame2 = _viewport2.get_texture().get_data()
|
||||
|
||||
if outline_image:
|
||||
generate_outline(frame2)
|
||||
|
||||
var ur = frame2.get_used_rect()
|
||||
var xx : float = 0
|
||||
xx = (_sprite_size - ur.size.x) / 2
|
||||
_texture2.blend_rect(frame2, ur, Vector2((_frame_atlas * _sprite_size) + xx, (_index_atlas * _sprite_size)))
|
||||
_current_animation_player.seek(_frame_atlas * (_current_animation_player.current_animation_length / (_sprite_num)), true)
|
||||
|
||||
if (_index >= _directions * animations.size()):
|
||||
_running = false
|
||||
create_atlas()
|
||||
return
|
||||
|
||||
_frame_atlas = _frame
|
||||
_index_atlas = _index
|
||||
|
||||
_sprite_preview.get_texture().set_data(frame2)
|
||||
|
||||
if _frame >= _sprite_num:
|
||||
_frame = 0
|
||||
_index += 1
|
||||
_direction += 1
|
||||
|
||||
if _direction >= _directions:
|
||||
_direction = 0
|
||||
|
||||
_current_animation_index += 1
|
||||
|
||||
setup_direction()
|
||||
|
||||
if (_index >= _directions * animations.size()):
|
||||
# _running = false
|
||||
# create_atlas()
|
||||
return
|
||||
|
||||
setup_animation()
|
||||
|
||||
return
|
||||
|
||||
_frame += 1
|
||||
|
||||
func setup_animation():
|
||||
_current_animation_player.play(animations[_current_animation_index])
|
||||
_current_animation_player.seek(0, true)
|
||||
|
||||
if !cast_animation_scene:
|
||||
return
|
||||
|
||||
if _current_animation_index == cast_animation_index:
|
||||
for cap in cast_animation_paths:
|
||||
var n = get_node(cap)
|
||||
|
||||
if !n:
|
||||
continue
|
||||
|
||||
var pa = cast_animation_scene.instance()
|
||||
|
||||
cast_animations.push_back(pa)
|
||||
|
||||
n.add_child(pa)
|
||||
else:
|
||||
for n in cast_animations:
|
||||
n.queue_free()
|
||||
|
||||
cast_animations.clear()
|
||||
|
||||
#enum CharacterFacing
|
||||
# FACING_FRONT = 0,
|
||||
# FACING_BACK = 1,
|
||||
# FACING_RIGHT = 2,
|
||||
# FACING_LEFT = 3,
|
||||
|
||||
func setup_direction():
|
||||
for a in cast_animations:
|
||||
if a.has_method("get_z_index"):
|
||||
a.z_index = 0
|
||||
|
||||
if _direction == 0:
|
||||
_current_animation_player = _model_side_animation_player
|
||||
_model_side.set_facing(2)
|
||||
_model_side.transform.x.x = -1
|
||||
|
||||
_model_side.show()
|
||||
_model_front.hide()
|
||||
|
||||
for np in z_index_paths:
|
||||
get_node(np).z_index = 0
|
||||
if _direction == 1:
|
||||
_current_animation_player = _model_side_animation_player
|
||||
_model_side.set_facing(3)
|
||||
_model_side.transform.x.x = 1
|
||||
|
||||
_model_side.show()
|
||||
_model_front.hide()
|
||||
|
||||
for np in z_index_paths:
|
||||
get_node(np).z_index = 0
|
||||
if _direction == 2:
|
||||
_current_animation_player = _model_front_animation_player
|
||||
_model_front.set_facing(0)
|
||||
|
||||
_model_side.hide()
|
||||
_model_front.show()
|
||||
|
||||
for np in z_index_paths:
|
||||
get_node(np).z_index = 0
|
||||
if _direction == 3:
|
||||
_current_animation_player = _model_front_animation_player
|
||||
_model_front.set_facing(1)
|
||||
|
||||
_model_side.hide()
|
||||
_model_front.show()
|
||||
|
||||
for np in z_index_paths:
|
||||
get_node(np).z_index = -1
|
||||
|
||||
for a in cast_animations:
|
||||
if a.has_method("get_z_index"):
|
||||
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 create_atlas():
|
||||
_image_texture = ImageTexture.new()
|
||||
_image_texture.create_from_image(_texture2, 0)
|
||||
|
||||
_image_texture.get_data().save_png(output_file_name)
|
||||
|
||||
if save_texture:
|
||||
_sprite_preview.set_texture(_image_texture)
|
||||
|
||||
if _show_atlas:
|
||||
_atlas_preview.set_texture(_image_texture)
|
||||
|
||||
|
||||
func set_generate(v : bool) -> void:
|
||||
if !v:
|
||||
return
|
||||
|
||||
#for easier development
|
||||
_ready()
|
||||
_running = true
|
||||
#set_process(true)
|
||||
|
||||
func get_generate() -> bool:
|
||||
return false
|
@ -1,22 +0,0 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
[ext_resource path="res://spritesheet_generator/SpriteMover.gd" type="Script" id=2]
|
||||
|
||||
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
flags_transparent = true
|
||||
params_billboard_mode = 1
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.39352, 0 )
|
||||
material_override = SubResource( 1 )
|
||||
cast_shadow = 0
|
||||
flip_v = true
|
||||
pixel_size = 0.064
|
||||
texture = ExtResource( 1 )
|
||||
vframes = 16
|
||||
hframes = 16
|
||||
script = ExtResource( 2 )
|
||||
|
@ -1,82 +0,0 @@
|
||||
extends Node
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
var _sprite
|
||||
|
||||
export (bool) var enabled = true
|
||||
export(int) var _animset = 0
|
||||
export(int) var _animset_size = 16
|
||||
export(int) var _animset_count = 16
|
||||
var _min_frame = 0
|
||||
var _max_frame = 16 * 16
|
||||
|
||||
var x = 0
|
||||
var y = 0
|
||||
var timer = 0
|
||||
var _frame = 1
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
_sprite = get_node(".")
|
||||
_sprite.set_frame(_min_frame)
|
||||
#_sprite.set_position(Vector2(x, y))
|
||||
|
||||
func set_movement_vector(vector):
|
||||
var a = Vector2(vector.x, vector.z)
|
||||
a = a.normalized()
|
||||
|
||||
var base = Vector2(0, -1)
|
||||
|
||||
var angle = a.angle_to(base) + PI
|
||||
|
||||
var slice = (2*PI) / _animset_count
|
||||
|
||||
var num_slice = int(angle / slice)
|
||||
|
||||
set_animset(num_slice)
|
||||
|
||||
func set_animset(animest_id):
|
||||
if (animest_id >= _animset_count):
|
||||
_animset = _animset_count - 1
|
||||
|
||||
if (animest_id < 0):
|
||||
_animset = 0
|
||||
|
||||
_animset = animest_id
|
||||
|
||||
|
||||
#_min_frame = _animset * _animset_size
|
||||
#_max_frame = _animset * _animset_size + _animset_size
|
||||
|
||||
func _process(delta):
|
||||
#set_animset(_animset)
|
||||
|
||||
if not enabled:
|
||||
set_process(false)
|
||||
return
|
||||
|
||||
timer += delta
|
||||
|
||||
if (timer > 0.05):
|
||||
timer -= 0.05
|
||||
_frame += 1
|
||||
|
||||
if _frame > _animset_size - 1:
|
||||
_frame = 0
|
||||
|
||||
_sprite.set_frame(_frame + (_animset * _animset_size))
|
||||
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func a_process(delta):
|
||||
#x += int(delta * 300)
|
||||
y += int(delta * 200)
|
||||
|
||||
if y > 700:
|
||||
y = -50
|
||||
|
||||
_sprite.set_position(Vector2(x, y))
|
File diff suppressed because one or more lines are too long
@ -1,137 +0,0 @@
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://spritesheet_generator/SheetGen.gd" type="Script" id=3]
|
||||
[ext_resource path="res://spritesheet_generator_3d/Spatial.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://spritesheet_generator/SpriteMover.gd" type="Script" id=5]
|
||||
[ext_resource path="res://spritesheet_generator/Sprite3Ds.tscn" type="PackedScene" id=6]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
[sub_resource type="Environment" id=2]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
background_color = Color( 0.364706, 0.364706, 0.364706, 1 )
|
||||
background_energy = 0.69
|
||||
ambient_light_color = Color( 1, 1, 1, 1 )
|
||||
ambient_light_energy = 0.68
|
||||
ambient_light_sky_contribution = 0.0
|
||||
|
||||
[sub_resource type="Environment" id=3]
|
||||
background_mode = 1
|
||||
background_energy = 0.57
|
||||
ambient_light_color = Color( 0.113725, 0.113725, 0.113725, 1 )
|
||||
ambient_light_energy = 0.68
|
||||
ssao_enabled = true
|
||||
|
||||
[sub_resource type="World" id=4]
|
||||
environment = SubResource( 3 )
|
||||
|
||||
[sub_resource type="Environment" id=5]
|
||||
background_mode = 1
|
||||
background_energy = 0.26
|
||||
ambient_light_color = Color( 0.113725, 0.113725, 0.113725, 1 )
|
||||
ambient_light_energy = 0.58
|
||||
ambient_light_sky_contribution = 0.1
|
||||
tonemap_exposure = 0.36
|
||||
tonemap_white = 0.47
|
||||
|
||||
[sub_resource type="ViewportTexture" id=6]
|
||||
viewport_path = NodePath("Viewport")
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=7]
|
||||
flags_transparent = true
|
||||
params_billboard_mode = 1
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( 2 )
|
||||
|
||||
[node name="player2" parent="." instance=ExtResource( 4 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -34.2601 )
|
||||
visible = false
|
||||
|
||||
[node name="player" parent="." instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
|
||||
[node name="MicamoChar" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="."]
|
||||
size = Vector2( 32, 32 )
|
||||
own_world = true
|
||||
world = SubResource( 4 )
|
||||
transparent_bg = true
|
||||
handle_input_locally = false
|
||||
hdr = false
|
||||
render_target_v_flip = true
|
||||
render_target_update_mode = 3
|
||||
script = ExtResource( 3 )
|
||||
_sprite_size = 32
|
||||
_sprite_num = 16
|
||||
save_texture = true
|
||||
|
||||
[node name="MicamoChar" parent="Viewport" instance=ExtResource( 4 )]
|
||||
|
||||
[node name="Camera" type="Camera" parent="Viewport"]
|
||||
transform = Transform( 0.707107, -0.353553, 0.612372, 0, 0.866025, 0.5, -0.707107, -0.353553, 0.612372, 2.95796, 3.39896, 2.92486 )
|
||||
environment = SubResource( 5 )
|
||||
projection = 1
|
||||
current = true
|
||||
size = 2.2
|
||||
near = 0.01
|
||||
far = 240.8
|
||||
|
||||
[node name="OmniLight" type="OmniLight" parent="Viewport"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.05496, 1.55159, 3.33238 )
|
||||
layers = 3
|
||||
light_color = Color( 0.952941, 0.929412, 0.807843, 1 )
|
||||
light_energy = 0.74
|
||||
light_indirect_energy = 1.27
|
||||
light_specular = 0.15
|
||||
omni_range = 6.4
|
||||
omni_attenuation = 1.1487
|
||||
|
||||
[node name="OmniLight2" type="OmniLight" parent="Viewport"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.4893, 3.88558, -2.30035 )
|
||||
light_color = Color( 0.898039, 0.898039, 0.729412, 1 )
|
||||
light_energy = 0.58
|
||||
light_indirect_energy = 2.95
|
||||
omni_range = 4.3
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 837.448, 475.588 )
|
||||
centered = false
|
||||
flip_v = true
|
||||
hframes = 16
|
||||
vframes = 16
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( 0.707107, -0.353553, 0.612372, 0, 0.866026, 0.5, -0.707107, -0.353553, 0.612372, 13.5879, 9.78323, 18.7533 )
|
||||
projection = 1
|
||||
current = true
|
||||
size = 10.0
|
||||
|
||||
[node name="Sprite2" type="Sprite" parent="."]
|
||||
position = Vector2( 179.55, 160.55 )
|
||||
texture = SubResource( 6 )
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite3" type="Sprite" parent="."]
|
||||
position = Vector2( 603.531, 254.594 )
|
||||
flip_v = true
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.18889, 0, 14.9987 )
|
||||
material_override = SubResource( 7 )
|
||||
cast_shadow = 0
|
||||
flip_v = true
|
||||
pixel_size = 0.0156
|
||||
hframes = 16
|
||||
vframes = 16
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Sprite3D2" parent="." instance=ExtResource( 6 )]
|
||||
visible = false
|
||||
|
||||
[editable path="Viewport/MicamoChar"]
|
@ -1,129 +0,0 @@
|
||||
extends Node
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
export (int) var _sprite_size
|
||||
export (int) var _sprite_num
|
||||
export (int) var _directions
|
||||
|
||||
export (bool) var _show_atlas = false
|
||||
|
||||
export (bool) var save_texture = false
|
||||
|
||||
export (NodePath) var _atlas_show_sprite_path
|
||||
export (NodePath) var _sprite_path
|
||||
export (NodePath) var _animation_player_path
|
||||
export (NodePath) var _player_path
|
||||
export (NodePath) var _animation_tree_player_path
|
||||
|
||||
var _viewport
|
||||
var _viewport_texture
|
||||
var _sprite
|
||||
var _animation_player
|
||||
var _time = 0
|
||||
var _animation_tree_player
|
||||
var _frame = 0
|
||||
var _rotcount = 0
|
||||
var _rotation = 0
|
||||
var _atlas
|
||||
var _image_texture
|
||||
var _running = false
|
||||
var _atlas_sprite_show_node
|
||||
var _atlas_texture
|
||||
var _player
|
||||
|
||||
var _texture
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
_viewport = get_node(".")
|
||||
#_viewport.set
|
||||
_sprite = get_node(_sprite_path)
|
||||
_atlas_sprite_show_node = get_node(_atlas_show_sprite_path)
|
||||
_animation_player = get_node(_animation_player_path)
|
||||
_player = get_node(_player_path)
|
||||
_animation_tree_player = get_node(_animation_tree_player_path)
|
||||
_viewport_texture = _viewport.get_texture()
|
||||
|
||||
_texture = Image.new()
|
||||
var frame = _viewport.get_texture().get_data()
|
||||
_texture.create(_sprite_size * _sprite_num, _sprite_size * _directions, false, frame.get_format())
|
||||
|
||||
yield(get_tree(), "idle_frame")
|
||||
yield(get_tree(), "idle_frame")
|
||||
|
||||
_running = true
|
||||
|
||||
#_generated_image = Image.new()
|
||||
#_generated_image.
|
||||
#_sprite.set_texture(_viewport_texture)
|
||||
|
||||
|
||||
#_frame_data.clear()
|
||||
|
||||
#_generated_image.create_from_data(64, 64, false, Image.FORMAT_RGBA4444, texture.get_data().get_data())
|
||||
#texture = _viewport.get_texture()
|
||||
#_sprite.set_texture(texture)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
|
||||
#if not _running and Input.is_key_pressed(KEY_K):
|
||||
# _running = true
|
||||
|
||||
if not _running:
|
||||
return
|
||||
|
||||
#_viewport.update_worlds()
|
||||
|
||||
var frame = _viewport.get_texture().get_data()
|
||||
|
||||
|
||||
#if _frame == 0 and _rotcount == 0:
|
||||
|
||||
_texture.blend_rect(frame, frame.get_used_rect(), Vector2((_frame * _sprite_size), (_rotcount * _sprite_size)))
|
||||
|
||||
#_time += 0.3
|
||||
#_animation_player.seek (_time , true )
|
||||
_frame += 1
|
||||
|
||||
if _frame > _sprite_num - 1:
|
||||
_frame = 0
|
||||
|
||||
_rotcount += 1
|
||||
|
||||
if (_rotcount > _sprite_num - 1):
|
||||
_running = false
|
||||
create_atlas()
|
||||
return
|
||||
|
||||
#var m3 = Basis()
|
||||
#m3 = m3.rotated( Vector3(0,1,0), 0.19625 )
|
||||
_player.rotate_y((PI*2)/float(_directions))
|
||||
|
||||
_animation_player.play("default")
|
||||
#_rotation = _rotcount * 22.5
|
||||
#_player.tra
|
||||
|
||||
|
||||
#return
|
||||
|
||||
#0.83
|
||||
_animation_player.seek(_frame * (_animation_player.current_animation_length / (_sprite_num - 1)), true)
|
||||
#_animation_tree_player.advance(0.05)
|
||||
|
||||
|
||||
func create_atlas():
|
||||
_image_texture = ImageTexture.new()
|
||||
_image_texture.create_from_image(_texture, 0)
|
||||
|
||||
_image_texture.get_data().save_png("res://testsave.png")
|
||||
|
||||
if save_texture:
|
||||
_sprite.set_texture(_image_texture)
|
||||
|
||||
if _show_atlas:
|
||||
_atlas_sprite_show_node.set_texture(_image_texture)
|
||||
|
||||
pass
|
@ -1,3 +0,0 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
@ -1,19 +0,0 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://testsave.png" type="Texture" id=1]
|
||||
[ext_resource path="res://spritesheet_generator/SpriteMover.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
flags_transparent = true
|
||||
params_billboard_mode = 1
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.39352, 0 )
|
||||
material_override = SubResource( 1 )
|
||||
cast_shadow = 0
|
||||
flip_v = true
|
||||
pixel_size = 0.064
|
||||
texture = ExtResource( 1 )
|
||||
hframes = 16
|
||||
vframes = 16
|
||||
script = ExtResource( 2 )
|
@ -1,82 +0,0 @@
|
||||
extends Node
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
var _sprite
|
||||
|
||||
export (bool) var enabled = true
|
||||
export(int) var _animset = 0
|
||||
export(int) var _animset_size = 16
|
||||
export(int) var _animset_count = 16
|
||||
var _min_frame = 0
|
||||
var _max_frame = 16 * 16
|
||||
|
||||
var x = 0
|
||||
var y = 0
|
||||
var timer = 0
|
||||
var _frame = 1
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
_sprite = get_node(".")
|
||||
_sprite.set_frame(_min_frame)
|
||||
#_sprite.set_position(Vector2(x, y))
|
||||
|
||||
func set_movement_vector(vector):
|
||||
var a = Vector2(vector.x, vector.z)
|
||||
a = a.normalized()
|
||||
|
||||
var base = Vector2(0, -1)
|
||||
|
||||
var angle = a.angle_to(base) + PI
|
||||
|
||||
var slice = (2*PI) / _animset_count
|
||||
|
||||
var num_slice = int(angle / slice)
|
||||
|
||||
set_animset(num_slice)
|
||||
|
||||
func set_animset(animest_id):
|
||||
if (animest_id >= _animset_count):
|
||||
_animset = _animset_count - 1
|
||||
|
||||
if (animest_id < 0):
|
||||
_animset = 0
|
||||
|
||||
_animset = animest_id
|
||||
|
||||
|
||||
#_min_frame = _animset * _animset_size
|
||||
#_max_frame = _animset * _animset_size + _animset_size
|
||||
|
||||
func _process(delta):
|
||||
#set_animset(_animset)
|
||||
|
||||
if not enabled:
|
||||
set_process(false)
|
||||
return
|
||||
|
||||
timer += delta
|
||||
|
||||
if (timer > 0.05):
|
||||
timer -= 0.05
|
||||
_frame += 1
|
||||
|
||||
if _frame > _animset_size - 1:
|
||||
_frame = 0
|
||||
|
||||
_sprite.set_frame(_frame + (_animset * _animset_size))
|
||||
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func a_process(delta):
|
||||
#x += int(delta * 300)
|
||||
y += int(delta * 200)
|
||||
|
||||
if y > 700:
|
||||
y = -50
|
||||
|
||||
_sprite.set_position(Vector2(x, y))
|
@ -27,10 +27,10 @@ Label/constants/line_spacing = 6
|
||||
Label/constants/shadow_as_outline = 0
|
||||
Label/constants/shadow_offset_x = 0
|
||||
Label/constants/shadow_offset_y = 0
|
||||
Label/fonts/font = null
|
||||
Label/fonts/font = ExtResource( 1 )
|
||||
Label/styles/normal = null
|
||||
ProgressBar/colors/font_color = Color( 0.94, 0.94, 0.94, 1 )
|
||||
ProgressBar/colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
ProgressBar/fonts/font = null
|
||||
ProgressBar/fonts/font = ExtResource( 1 )
|
||||
ProgressBar/styles/bg = SubResource( 1 )
|
||||
ProgressBar/styles/fg = SubResource( 2 )
|
||||
|
Loading…
Reference in New Issue
Block a user