ajout du choix de la taille des oreilles via shapes_key.

This commit is contained in:
osquallo 2018-08-27 10:22:15 +02:00
parent ccd332e34d
commit b46a2cda20
11 changed files with 460 additions and 343 deletions

View file

@ -7,6 +7,7 @@ var color = Color( 1.0, 0.25, 0.25, 1.0 )
var gender = 1 var gender = 1
var size = 1.0 var size = 1.0
var slot = 0 var slot = 0
var ears_size = 0.0
var dir = Vector3() var dir = Vector3()
const GRAVITY = -24.8 const GRAVITY = -24.8
@ -23,8 +24,8 @@ var MOUSE_SENSITIVITY = 0.05
onready var camera_rotation = $camera_rotation_helper onready var camera_rotation = $camera_rotation_helper
onready var camera = $camera_rotation_helper/camera onready var camera = $camera_rotation_helper/camera
onready var player_infos_billboard = $infos_spatial/character_infos_billboard onready var player_infos_billboard = $infos_spatial/character_infos_billboard
onready var player_mesh = $mesh_instance onready var player_mesh = $suzanne/mesh
onready var flashlight = $mesh_instance/flashlight onready var flashlight = $suzanne/flashlight
### Caractéristiques du personnage. ### Caractéristiques du personnage.
var douleur = 0 var douleur = 0
@ -57,7 +58,24 @@ func update( start_position = null ):
# $infos_spatial.scale = Vector3( self.size, self.size, self.size ) # $infos_spatial.scale = Vector3( self.size, self.size, self.size )
# self.player_mesh.scale = Vector3( self.size, self.size, self.size ) # self.player_mesh.scale = Vector3( self.size, self.size, self.size )
self.player_mesh.get_surface_material(0).set_shader_param( "albedo", self.color ) # ears_size
if self.ears_size > 0:
self.player_mesh.set( "blend_shapes/big_ears", self.ears_size )
self.player_mesh.set( "blend_shapes/small_ears", 0 )
elif self.ears_size < 0:
self.player_mesh.set( "blend_shapes/big_ears", 0 )
self.player_mesh.set( "blend_shapes/small_ears", -self.ears_size )
else:
self.player_mesh.set( "blend_shapes/big_ears", 0 )
self.player_mesh.set( "blend_shapes/small_ears", 0 )
self.player_mesh.mesh.get( "surface_2/material" ).set_shader_param( "albedo", self.color )
func _process(delta): func _process(delta):
process_input(delta) process_input(delta)

View file

@ -1,74 +1,19 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://game_scene/Game/Character/Character.gd" type="Script" id=1] [ext_resource path="res://game_scene/Game/Character/Character.gd" type="Script" id=1]
[ext_resource path="res://game_scene/Game/Character/infos_spatial.gd" type="Script" id=2] [ext_resource path="res://game_scene/Game/Character/infos_spatial.gd" type="Script" id=2]
[ext_resource path="res://game_scene/character_infos_billboard.tscn" type="PackedScene" id=3] [ext_resource path="res://game_scene/character_infos_billboard.tscn" type="PackedScene" id=3]
[ext_resource path="res://game_scene/suzanne/suzanne_shape_keys.escn" type="PackedScene" id=4] [ext_resource path="res://game_scene/suzanne/suzanne.tscn" type="PackedScene" id=4]
[ext_resource path="res://game_scene/suzanne/suzanne.obj" type="ArrayMesh" id=5]
[sub_resource type="CapsuleShape" id=1]
[sub_resource type="Shader" id=1] radius = 1.0
height = 1.0
code = "shader_type spatial; [node name="character" type="KinematicBody"]
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
uniform float point_size : hint_range(0,128);
uniform sampler2D texture_metallic : hint_white;
uniform vec4 metallic_texture_channel;
uniform sampler2D texture_roughness : hint_white;
uniform vec4 roughness_texture_channel;
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
void vertex() {
UV=UV*uv1_scale.xy+uv1_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel);
METALLIC = metallic_tex * metallic;
float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
SPECULAR = specular;
}
"
[sub_resource type="ShaderMaterial" id=2]
render_priority = 0
shader = SubResource( 1 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/specular = 0.5
shader_param/metallic = 0.0
shader_param/roughness = 0.0
shader_param/point_size = 1.0
shader_param/metallic_texture_channel = Plane( 1, 0, 0, 0 )
shader_param/roughness_texture_channel = Plane( 1, 0, 0, 0 )
shader_param/uv1_scale = Vector3( 1, 1, 1 )
shader_param/uv1_offset = Vector3( 0, 0, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 )
[sub_resource type="SphereShape" id=3]
radius = 0.520354
[node name="character" type="KinematicBody" index="0"]
transform = Transform( 0.371345, 0, 0, 0, 0.218854, 0, 0, 0, 0.371345, -0.00167466, 0.0124722, 6.02408 ) transform = Transform( 0.371345, 0, 0, 0, 0.218854, 0, 0, 0, 0.371345, -0.00167466, 0.0124722, 6.02408 )
visible = false
input_ray_pickable = false input_ray_pickable = false
input_capture_on_drag = false input_capture_on_drag = false
collision_layer = 1 collision_layer = 1
@ -133,13 +78,13 @@ near = 0.05
far = 10000.0 far = 10000.0
_sections_unfolded = [ "Transform" ] _sections_unfolded = [ "Transform" ]
[node name="suzanne" type="Spatial" parent="." index="2" instance=ExtResource( 4 )] [node name="suzanne" parent="." index="2" instance=ExtResource( 4 )]
transform = Transform( -0.281766, 0, -2.3459e-008, 0, 0.491282, 0, 2.46328e-008, 0, -0.26834, 8975.45, 1800.77, -6275.94 ) transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 0, 1.41059, -0.180126 )
[node name="flashlight" type="SpotLight" parent="suzanne" index="1"] [node name="flashlight" type="SpotLight" parent="suzanne" index="1"]
transform = Transform( -2.54929, -1.60184e-009, 3.70147e-007, 0, 2.42833, 0.0302507, -2.34015e-007, 0.0192396, -4.44583, 31854.2, -3661.36, -23387.1 ) transform = Transform( -0.718303, -4.51344e-010, 1.04295e-007, 0, 1.19299, 0.0148616, -6.27955e-008, 0.00516275, -1.19299, -0.020946, 0.599374, 0.0648584 )
layers = 1 layers = 1
light_color = Color( 1, 1, 1, 1 ) light_color = Color( 1, 1, 1, 1 )
light_energy = 2.0 light_energy = 2.0
@ -160,28 +105,10 @@ spot_angle = 22.2473
spot_angle_attenuation = 1.0 spot_angle_attenuation = 1.0
_sections_unfolded = [ "Light", "Shadow" ] _sections_unfolded = [ "Light", "Shadow" ]
[node name="mesh_instance" type="MeshInstance" parent="." index="3"] [node name="collision_shape" type="CollisionShape" parent="." index="3"]
transform = Transform( -0.281766, 0, -2.3459e-008, 0, 0.491282, 0, 2.46328e-008, 0, -0.26834, 0.00342001, 1.72051, -0.0753574 ) transform = Transform( 0.425419, 0, 0, 0, 1.26042, 0, 0, 0, 0.294585, 0.00823072, 1.1894, -0.356263 )
visible = false shape = SubResource( 1 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = ExtResource( 5 )
skeleton = NodePath("..")
material/0 = SubResource( 2 )
_sections_unfolded = [ "Transform", "material" ]
[node name="collision_shape" type="CollisionShape" parent="." index="4"]
transform = Transform( 0.426611, 0, -2.39179e-015, 0, 0.524356, 0, -2.39179e-015, 0, 0.305713, 0.0063323, 1.96086, -0.0823917 )
shape = SubResource( 3 )
disabled = false disabled = false

File diff suppressed because one or more lines are too long

View file

@ -33,3 +33,17 @@ func _on_return_button_pressed():
get_node( "../character_selection_menu/viewport/character_preview" ).show() get_node( "../character_selection_menu/viewport/character_preview" ).show()
# get_node( "v_box_container/h_box_container/center_container/character_creation_scene").hide() # get_node( "v_box_container/h_box_container/center_container/character_creation_scene").hide()
emit_signal( "return_button_pressed" ) emit_signal( "return_button_pressed" )
func _on_ears_size_value_changed(value):
if value > 0:
self.character_mesh.set( "blend_shape/big_ears", value )
self.character_mesh.set( "blend_shape/small_ears", 0 )
elif value > 0:
self.character_mesh.set( "blend_shape/big_ears", 0 )
self.character_mesh.set( "blend_shape/small_ears", value )
else:
self.character_mesh.set( "blend_shape/big_ears", 0 )
self.character_mesh.set( "blend_shape/small_ears", 0 )

View file

@ -4,7 +4,6 @@
[ext_resource path="res://gui_scene/GUI/character_creation/character_creation_menu.gd" type="Script" id=2] [ext_resource path="res://gui_scene/GUI/character_creation/character_creation_menu.gd" type="Script" id=2]
[ext_resource path="res://login_scene/character_preview.tscn" type="PackedScene" id=3] [ext_resource path="res://login_scene/character_preview.tscn" type="PackedScene" id=3]
[sub_resource type="DynamicFont" id=1] [sub_resource type="DynamicFont" id=1]
size = 14 size = 14
@ -136,9 +135,9 @@ anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 199.0 margin_top = 188.0
margin_right = 510.0 margin_right = 510.0
margin_bottom = 359.0 margin_bottom = 369.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 0 mouse_filter = 0
@ -161,7 +160,7 @@ anchor_bottom = 0.0
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 502.0 margin_right = 502.0
margin_bottom = 152.0 margin_bottom = 173.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 2 mouse_filter = 2
@ -180,7 +179,7 @@ anchor_bottom = 0.0
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 502.0 margin_right = 502.0
margin_bottom = 152.0 margin_bottom = 173.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 0 mouse_filter = 0
@ -202,7 +201,7 @@ anchor_bottom = 0.0
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 486.0 margin_right = 486.0
margin_bottom = 136.0 margin_bottom = 157.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 1 mouse_filter = 1
@ -214,6 +213,7 @@ _sections_unfolded = [ "Size Flags", "Theme", "custom_constants" ]
[node name="name_box" type="HBoxContainer" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="0"] [node name="name_box" type="HBoxContainer" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="0"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -244,7 +244,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 4 size_flags_vertical = 4
text = "Nom: " text = "Nom: "
align = 1 align = 2
percent_visible = 1.0 percent_visible = 1.0
lines_skipped = 0 lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1
@ -278,6 +278,7 @@ _sections_unfolded = [ "Placeholder", "Size Flags" ]
[node name="sexe_box" type="HBoxContainer" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="1"] [node name="sexe_box" type="HBoxContainer" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="1"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -308,7 +309,7 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 4 size_flags_vertical = 4
text = "Sexe: " text = "Sexe: "
align = 1 align = 2
percent_visible = 1.0 percent_visible = 1.0
lines_skipped = 0 lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1
@ -396,15 +397,79 @@ percent_visible = 1.0
lines_skipped = 0 lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1
[node name="error_label" type="Label" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="2"] [node name="ears_size_box" type="HBoxContainer" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="2"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 52.0 margin_top = 52.0
margin_right = 478.0 margin_right = 478.0
margin_bottom = 74.0 margin_bottom = 69.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="label" type="Label" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container/ears_size_box" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 237.0
margin_bottom = 17.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Taille des oreilles:"
align = 2
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Size Flags" ]
[node name="ears_size" type="HScrollBar" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container/ears_size_box" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 241.0
margin_right = 478.0
margin_bottom = 12.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 0
min_value = -1.0
max_value = 1.0
step = 0.1
page = 0.0
value = 0.0
exp_edit = false
rounded = false
custom_step = -1.0
_sections_unfolded = [ "Size Flags" ]
[node name="error_label" type="Label" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 73.0
margin_right = 478.0
margin_bottom = 95.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 2 mouse_filter = 2
@ -420,15 +485,15 @@ lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1
_sections_unfolded = [ "custom_colors", "custom_fonts", "custom_styles" ] _sections_unfolded = [ "custom_colors", "custom_fonts", "custom_styles" ]
[node name="valid_button" type="Button" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="3"] [node name="valid_button" type="Button" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="4"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 78.0 margin_top = 99.0
margin_right = 478.0 margin_right = 478.0
margin_bottom = 101.0 margin_bottom = 122.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
focus_mode = 2 focus_mode = 2
@ -444,15 +509,15 @@ text = "Valider"
flat = false flat = false
align = 1 align = 1
[node name="return_button" type="Button" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="4"] [node name="return_button" type="Button" parent="v_box_container/h_box_container/margin_container/margin_container/v_box_container" index="5"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 105.0 margin_top = 126.0
margin_right = 478.0 margin_right = 478.0
margin_bottom = 128.0 margin_bottom = 149.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
focus_mode = 2 focus_mode = 2
@ -470,6 +535,7 @@ align = 1
[node name="center_container" type="CenterContainer" parent="v_box_container/h_box_container" index="1"] [node name="center_container" type="CenterContainer" parent="v_box_container/h_box_container" index="1"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -575,6 +641,8 @@ max_lines_visible = -1
[connection signal="value_changed" from="v_box_container/h_box_container/margin_container/margin_container/v_box_container/sexe_box/h_box_container/h_scroll_bar" to="." method="_on_h_scroll_bar_value_changed"] [connection signal="value_changed" from="v_box_container/h_box_container/margin_container/margin_container/v_box_container/sexe_box/h_box_container/h_scroll_bar" to="." method="_on_h_scroll_bar_value_changed"]
[connection signal="value_changed" from="v_box_container/h_box_container/margin_container/margin_container/v_box_container/ears_size_box/ears_size" to="." method="_on_ears_size_value_changed"]
[connection signal="pressed" from="v_box_container/h_box_container/margin_container/margin_container/v_box_container/valid_button" to="." method="_on_valid_button_pressed"] [connection signal="pressed" from="v_box_container/h_box_container/margin_container/margin_container/v_box_container/valid_button" to="." method="_on_valid_button_pressed"]
[connection signal="pressed" from="v_box_container/h_box_container/margin_container/margin_container/v_box_container/return_button" to="." method="_on_return_button_pressed"] [connection signal="pressed" from="v_box_container/h_box_container/margin_container/margin_container/v_box_container/return_button" to="." method="_on_return_button_pressed"]

View file

@ -3,6 +3,8 @@ extends MarginContainer
#signal character_changed #signal character_changed
signal sex_bar_changed( value ) signal sex_bar_changed( value )
signal size_bar_changed( value ) signal size_bar_changed( value )
signal ears_size_bar_changed( value )
signal return_button_pressed signal return_button_pressed
signal creation_button_pressed signal creation_button_pressed
@ -75,3 +77,8 @@ func _on_sex_bar_value_changed( value ):
func _on_size_bar_value_changed( value ): func _on_size_bar_value_changed( value ):
emit_signal( "size_bar_changed", value ) emit_signal( "size_bar_changed", value )
func _on_ears_size_value_changed(value):
emit_signal( "ears_size_bar_changed", value )

View file

@ -54,7 +54,7 @@ anchor_bottom = 0.0
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 1016.0 margin_right = 1016.0
margin_bottom = 210.0 margin_bottom = 228.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 2 mouse_filter = 2
@ -73,7 +73,7 @@ anchor_bottom = 0.0
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 1016.0 margin_right = 1016.0
margin_bottom = 210.0 margin_bottom = 228.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 0 mouse_filter = 0
@ -95,7 +95,7 @@ anchor_bottom = 0.0
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 1000.0 margin_right = 1000.0
margin_bottom = 194.0 margin_bottom = 212.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 1 mouse_filter = 1
@ -387,7 +387,6 @@ size_flags_vertical = 1
[node name="sexe_box" type="HBoxContainer" parent="margin_container/v_box_container" index="4"] [node name="sexe_box" type="HBoxContainer" parent="margin_container/v_box_container" index="4"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -626,7 +625,7 @@ percent_visible = 1.0
lines_skipped = 0 lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1
[node name="h_separator3" type="HSeparator" parent="margin_container/v_box_container" index="6"] [node name="ears_size_box" type="HBoxContainer" parent="margin_container/v_box_container" index="6"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -634,7 +633,70 @@ anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 108.0 margin_top = 108.0
margin_right = 992.0 margin_right = 992.0
margin_bottom = 112.0 margin_bottom = 122.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="label" type="Label" parent="margin_container/v_box_container/ears_size_box" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 494.0
margin_bottom = 14.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Taille des oreilles:"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Size Flags" ]
[node name="ears_size" type="HScrollBar" parent="margin_container/v_box_container/ears_size_box" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 498.0
margin_right = 992.0
margin_bottom = 12.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 0
min_value = -1.0
max_value = 1.0
step = 0.1
page = 0.0
value = 0.0
exp_edit = false
rounded = false
custom_step = -1.0
_sections_unfolded = [ "Size Flags" ]
[node name="h_separator3" type="HSeparator" parent="margin_container/v_box_container" index="7"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 126.0
margin_right = 992.0
margin_bottom = 130.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 0 mouse_filter = 0
@ -642,15 +704,15 @@ mouse_default_cursor_shape = 0
size_flags_horizontal = 1 size_flags_horizontal = 1
size_flags_vertical = 1 size_flags_vertical = 1
[node name="error_label" type="Label" parent="margin_container/v_box_container" index="7"] [node name="error_label" type="Label" parent="margin_container/v_box_container" index="8"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 116.0 margin_top = 134.0
margin_right = 992.0 margin_right = 992.0
margin_bottom = 138.0 margin_bottom = 156.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
mouse_filter = 2 mouse_filter = 2
@ -666,15 +728,15 @@ lines_skipped = 0
max_lines_visible = -1 max_lines_visible = -1
_sections_unfolded = [ "custom_colors", "custom_fonts", "custom_styles" ] _sections_unfolded = [ "custom_colors", "custom_fonts", "custom_styles" ]
[node name="valid_button" type="Button" parent="margin_container/v_box_container" index="8"] [node name="valid_button" type="Button" parent="margin_container/v_box_container" index="9"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 142.0 margin_top = 160.0
margin_right = 992.0 margin_right = 992.0
margin_bottom = 162.0 margin_bottom = 180.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
focus_mode = 2 focus_mode = 2
@ -690,15 +752,15 @@ text = "Valider"
flat = false flat = false
align = 1 align = 1
[node name="return_button" type="Button" parent="margin_container/v_box_container" index="9"] [node name="return_button" type="Button" parent="margin_container/v_box_container" index="10"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 166.0 margin_top = 184.0
margin_right = 992.0 margin_right = 992.0
margin_bottom = 186.0 margin_bottom = 204.0
rect_pivot_offset = Vector2( 0, 0 ) rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false rect_clip_content = false
focus_mode = 2 focus_mode = 2
@ -720,6 +782,8 @@ align = 1
[connection signal="value_changed" from="margin_container/v_box_container/size_box/h_box_container/size_bar" to="." method="_on_size_bar_value_changed"] [connection signal="value_changed" from="margin_container/v_box_container/size_box/h_box_container/size_bar" to="." method="_on_size_bar_value_changed"]
[connection signal="value_changed" from="margin_container/v_box_container/ears_size_box/ears_size" to="." method="_on_ears_size_value_changed"]
[connection signal="pressed" from="margin_container/v_box_container/valid_button" to="." method="_on_valid_button_pressed"] [connection signal="pressed" from="margin_container/v_box_container/valid_button" to="." method="_on_valid_button_pressed"]
[connection signal="pressed" from="margin_container/v_box_container/return_button" to="." method="_on_return_button_pressed"] [connection signal="pressed" from="margin_container/v_box_container/return_button" to="." method="_on_return_button_pressed"]

View file

@ -84,7 +84,7 @@ func _ready():
# self.character_preview.get_node( "Camera_rotation_helper/face_camera" ).make_current() # self.character_preview.get_node( "Camera_rotation_helper/face_camera" ).make_current()
self.character_preview.get_node( "face_camera" ).make_current() self.character_preview.get_node( "face_camera" ).make_current()
self.character_mesh = $viewport/character.get_node("mesh_instance") self.character_mesh = $viewport/character.get_node("suzanne/mesh")
# self.character_face_camera = $viewport/character/Camera_rotation_helper/face_camera # self.character_face_camera = $viewport/character/Camera_rotation_helper/face_camera
self.character_box = $margin_container/character_box self.character_box = $margin_container/character_box
self.name_input = self.character_box.get_node( "character_creation_box/margin_container/v_box_container/name_box/line_edit" ) self.name_input = self.character_box.get_node( "character_creation_box/margin_container/v_box_container/name_box/line_edit" )
@ -148,6 +148,9 @@ func update_preview():
var size = config_file.get_value( str(slot), "size", 1.0 ) var size = config_file.get_value( str(slot), "size", 1.0 )
self.character_preview.size = size self.character_preview.size = size
var ears_size = config_file.get_value( str(slot), "ears_size", 0.0 )
self.character_preview.ears_size = ears_size
self.character_preview.update() self.character_preview.update()
@ -172,6 +175,8 @@ func _on_character_creation_box_creation_button_pressed():
config_file.set_value( str(self.character_preview.slot), "gender", self.character_preview.gender) config_file.set_value( str(self.character_preview.slot), "gender", self.character_preview.gender)
config_file.set_value( str(self.character_preview.slot), "color", self.character_preview.color) config_file.set_value( str(self.character_preview.slot), "color", self.character_preview.color)
config_file.set_value( str(self.character_preview.slot), "size", self.character_preview.size) config_file.set_value( str(self.character_preview.slot), "size", self.character_preview.size)
config_file.set_value( str(self.character_preview.slot), "ears_size", self.character_preview.ears_size)
config_file.save( "user://player.cfg" ) config_file.save( "user://player.cfg" )
self.character_box.get_node( "character_slots" ).show() self.character_box.get_node( "character_slots" ).show()
@ -191,9 +196,14 @@ func _on_character_creation_box_size_bar_changed( value ):
self.character_preview.size = value self.character_preview.size = value
self.character_preview.update() self.character_preview.update()
func _process( delta ): func _on_character_creation_box_ears_size_bar_changed( value ):
self.character_preview.ears_size = value
self.character_preview.update()
func _process( delta ):
if turn_direction == "left": if turn_direction == "left":
self.character_mesh.rotation.y -= delta self.character_mesh.rotation.y -= delta
elif turn_direction == "right": elif turn_direction == "right":
@ -239,3 +249,5 @@ func _on_lights_toggled(button_pressed):
func _on_character_preview_image_resized(): func _on_character_preview_image_resized():
$viewport.size = $margin_container/character_box/v_box_container/character_preview_image.rect_size $viewport.size = $margin_container/character_box/v_box_container/character_preview_image.rect_size

View file

@ -391,6 +391,8 @@ _sections_unfolded = [ "Axis Stretch", "Grow Direction", "Margin", "Mouse", "Rec
[connection signal="creation_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_creation_button_pressed"] [connection signal="creation_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_creation_button_pressed"]
[connection signal="ears_size_bar_changed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_ears_size_bar_changed"]
[connection signal="return_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_return_button_pressed"] [connection signal="return_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_return_button_pressed"]
[connection signal="sex_bar_changed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_sex_bar_changed"] [connection signal="sex_bar_changed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_sex_bar_changed"]

View file

@ -27,6 +27,7 @@ func _on_character_selection_menu_character_selected( slot ):
character.gender = config_file.get_value( str(slot), "gender", 1) character.gender = config_file.get_value( str(slot), "gender", 1)
character.color = config_file.get_value( str(slot), "color", Color(1.0, 0.25, 0.25, 1.0) ) character.color = config_file.get_value( str(slot), "color", Color(1.0, 0.25, 0.25, 1.0) )
character.size = config_file.get_value( str(slot), "size", 1.0 ) character.size = config_file.get_value( str(slot), "size", 1.0 )
character.ears_size = config_file.get_value( str(slot), "ears_size", 0.0 )
character.update() character.update()
emit_signal( "character_creation_finished" ) emit_signal( "character_creation_finished" )

View file

@ -4,7 +4,7 @@
[ext_resource path="res://login_scene/character_selection_menu.tscn" type="PackedScene" id=2] [ext_resource path="res://login_scene/character_selection_menu.tscn" type="PackedScene" id=2]
[ext_resource path="res://gui_scene/GUI/login/login_menu.tscn" type="PackedScene" id=3] [ext_resource path="res://gui_scene/GUI/login/login_menu.tscn" type="PackedScene" id=3]
[node name="login_scene" type="Node"] [node name="login_scene" type="Node" index="0"]
script = ExtResource( 1 ) script = ExtResource( 1 )