Improve editor module
This commit is contained in:
@ -1,39 +1,40 @@
|
|||||||
@tool
|
@tool
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
# This module affects runtime nad
|
# This does not effect runtime yet but will in the future.
|
||||||
|
|
||||||
|
|
||||||
#TODO: Add descriptions
|
|
||||||
@export_category("Controller Editor Module")
|
@export_category("Controller Editor Module")
|
||||||
@export var head_y_rotation : float = 0:
|
@export_range(-360.0, 360.0, 0.01, "or_greater", "or_less") var head_y_rotation : float = 0.0:
|
||||||
set(new_rotation):
|
set(new_rotation):
|
||||||
head_y_rotation = new_rotation
|
if HEAD:
|
||||||
HEAD.rotation.y = head_y_rotation
|
head_y_rotation = new_rotation
|
||||||
update_configuration_warnings()
|
HEAD.rotation.y = deg_to_rad(head_y_rotation)
|
||||||
|
update_configuration_warnings()
|
||||||
|
@export_range(-90.0, 90.0, 0.01, "or_greater", "or_less") var head_x_rotation : float = 0.0:
|
||||||
|
set(new_rotation):
|
||||||
|
if HEAD:
|
||||||
|
head_x_rotation = new_rotation
|
||||||
|
HEAD.rotation.x = deg_to_rad(head_x_rotation)
|
||||||
|
update_configuration_warnings()
|
||||||
|
|
||||||
@export_group("Nodes")
|
@export_group("Nodes")
|
||||||
@export var CHARACTER : CharacterBody3D
|
@export var CHARACTER : CharacterBody3D
|
||||||
@export var head_path : String = "Head" # From this nodes parent node
|
@export var head_path : String = "Head" # Relative to the parent node
|
||||||
#@export var CAMERA : Camera3D
|
#@export var CAMERA : Camera3D
|
||||||
#@export var HEADBOB_ANIMATION : AnimationPlayer
|
#@export var HEADBOB_ANIMATION : AnimationPlayer
|
||||||
#@export var JUMP_ANIMATION : AnimationPlayer
|
#@export var JUMP_ANIMATION : AnimationPlayer
|
||||||
#@export var CROUCH_ANIMATION : AnimationPlayer
|
#@export var CROUCH_ANIMATION : AnimationPlayer
|
||||||
#@export var COLLISION_MESH : CollisionShape3D
|
#@export var COLLISION_MESH : CollisionShape3D
|
||||||
|
|
||||||
var HEAD
|
@onready var HEAD = get_node("../" + head_path)
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
HEAD = get_node("../" + head_path)
|
if !Engine.is_editor_hint():
|
||||||
if Engine.is_editor_hint():
|
print("not editor")
|
||||||
pass
|
HEAD.rotation.y = deg_to_rad(head_y_rotation)
|
||||||
else:
|
HEAD.rotation.x = deg_to_rad(head_x_rotation)
|
||||||
HEAD.rotation.y = head_y_rotation
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
if Engine.is_editor_hint():
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _get_configuration_warnings():
|
func _get_configuration_warnings():
|
||||||
var warnings = []
|
var warnings = []
|
||||||
@ -41,8 +42,8 @@ func _get_configuration_warnings():
|
|||||||
if head_y_rotation > 360:
|
if head_y_rotation > 360:
|
||||||
warnings.append("The head rotation is greater than 360")
|
warnings.append("The head rotation is greater than 360")
|
||||||
|
|
||||||
if head_y_rotation < 0:
|
if head_y_rotation < -360:
|
||||||
warnings.append("The head rotation is less than 0")
|
warnings.append("The head rotation is less than -360")
|
||||||
|
|
||||||
# Returning an empty array gives no warnings
|
# Returning an empty array gives no warnings
|
||||||
return warnings
|
return warnings
|
||||||
|
@ -383,7 +383,7 @@ transform = Transform3D(-0.730162, 0, -0.683274, 0, 1, 0, 0.683274, 0, -0.730162
|
|||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_o0unb")
|
"": SubResource("AnimationLibrary_o0unb")
|
||||||
}
|
}
|
||||||
blend_times = [&"walk", &"RESET", 0.5, &"RESET", &"walk", 0.5, &"RESET", &"RESET", 0.5]
|
blend_times = [&"RESET", &"RESET", 0.5, &"RESET", &"walk", 0.5, &"walk", &"RESET", 0.5]
|
||||||
|
|
||||||
[node name="JumpAnimation" type="AnimationPlayer" parent="Head"]
|
[node name="JumpAnimation" type="AnimationPlayer" parent="Head"]
|
||||||
libraries = {
|
libraries = {
|
||||||
@ -423,4 +423,3 @@ target_position = Vector3(0, 0.5, 0)
|
|||||||
|
|
||||||
[node name="EditorModule" type="Node" parent="."]
|
[node name="EditorModule" type="Node" parent="."]
|
||||||
script = ExtResource("3_v3ckk")
|
script = ExtResource("3_v3ckk")
|
||||||
head_y_rotation = -136.9
|
|
||||||
|
Reference in New Issue
Block a user