feat: escoria-wizard
139
addons/escoria-wizard/BackgroundItem.gd
Normal file
@@ -0,0 +1,139 @@
|
||||
tool
|
||||
extends MarginContainer
|
||||
|
||||
var source_image:Image
|
||||
var image_stream_texture:StreamTexture
|
||||
var image_has_been_loaded:bool
|
||||
var image_size:Vector2
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
background_item_reset()
|
||||
|
||||
|
||||
func background_item_reset() -> void:
|
||||
$Content/GridContainer/ItemName.text = "replace_me"
|
||||
$Content/GridContainer/ItemGlobalID.text = ""
|
||||
$Content/GridContainer/StartsInnteractiveCheckBox.pressed = true
|
||||
if $Content/GridContainer/DefaultActionOption.get_item_count() > 0:
|
||||
$Content/GridContainer/DefaultActionOption.clear()
|
||||
for option_list in ["look", "pick up", "open", "close", "use", "push", "pull", "talk"]:
|
||||
$Content/GridContainer/DefaultActionOption.add_item(option_list)
|
||||
$Content/GridContainer/DefaultActionOption.selected = 0
|
||||
image_size = Vector2.ZERO
|
||||
image_has_been_loaded = false
|
||||
|
||||
|
||||
func background_on_ItemName_text_changed(new_text: String) -> void:
|
||||
$Content/GridContainer/ItemGlobalID.text = new_text
|
||||
|
||||
|
||||
func load_button_pressed() -> void:
|
||||
$LoadObjectGraphic/LoadObjectFileDialog.popup()
|
||||
|
||||
|
||||
func LoadObjectFileDialog_file_selected(path: String) -> void:
|
||||
image_stream_texture = load(path)
|
||||
|
||||
$Content/GridContainer/Preview/Preview.texture = image_stream_texture
|
||||
|
||||
var preview_size = $Content/GridContainer/Preview/Preview.rect_size
|
||||
|
||||
# Calculate the scale to make the preview as big as possible in the preview window depending on
|
||||
# the height to width ratio of the frame
|
||||
image_size = image_stream_texture.get_size()
|
||||
var preview_scale = Vector2.ONE
|
||||
preview_scale.x = preview_size.x / image_size.x
|
||||
preview_scale.y = preview_size.y / image_size.y
|
||||
|
||||
if preview_scale.y > preview_scale.x:
|
||||
$Content/GridContainer/Preview/Preview.rect_scale = Vector2(preview_scale.x, preview_scale.x)
|
||||
else:
|
||||
$Content/GridContainer/Preview/Preview.rect_scale = Vector2(preview_scale.y, preview_scale.y)
|
||||
|
||||
$Content/GridContainer/ImageSize.text = "(%s, %s)" % [image_size.x, image_size.y]
|
||||
|
||||
$Content/GridContainer/ImagePath.text = path
|
||||
image_has_been_loaded = true
|
||||
|
||||
|
||||
|
||||
func _on_CreateButton_pressed() -> void:
|
||||
var err_window = "../InformationWindows/generic_error_window"
|
||||
if ! image_has_been_loaded:
|
||||
get_node(err_window).dialog_text = \
|
||||
"No image has been loaded."
|
||||
get_node(err_window).popup()
|
||||
return
|
||||
if $Content/GridContainer/ItemName.text == "replace_me":
|
||||
get_node(err_window).dialog_text = \
|
||||
"Please change the object name."
|
||||
get_node(err_window).popup()
|
||||
return
|
||||
|
||||
var item = ESCItem.new()
|
||||
item.name = $Content/GridContainer/ItemName.text
|
||||
item.global_id = $Content/GridContainer/ItemGlobalID.text
|
||||
item.is_interactive = $Content/GridContainer/StartsInnteractiveCheckBox.pressed
|
||||
item.tooltip_name = $Content/GridContainer/ItemName.text
|
||||
|
||||
var selected_index = $Content/GridContainer/DefaultActionOption.selected
|
||||
item.default_action = $Content/GridContainer/DefaultActionOption.get_item_text(selected_index)
|
||||
|
||||
# Add sprite to the background item
|
||||
var item_sprite = Sprite.new()
|
||||
item_sprite.texture = $Content/GridContainer/Preview/Preview.texture
|
||||
item.add_child(item_sprite)
|
||||
|
||||
# Add Dialog Position to the background item
|
||||
var interact_position = ESCLocation.new()
|
||||
interact_position.name = "interact_position"
|
||||
interact_position.position.y = image_size.y * 2
|
||||
print("A")
|
||||
item.add_child(interact_position)
|
||||
|
||||
# Add Collision shape to the background item
|
||||
var rectangle_shape = RectangleShape2D.new()
|
||||
var collision_shape = CollisionShape2D.new()
|
||||
|
||||
collision_shape.shape = rectangle_shape
|
||||
collision_shape.shape.extents = image_size / 2
|
||||
print("B")
|
||||
item.add_child(collision_shape)
|
||||
print("c")
|
||||
# Make it so all the nodes can be seen in the scene tree
|
||||
interact_position.set_owner(item)
|
||||
print("d")
|
||||
collision_shape.set_owner(item)
|
||||
print("e")
|
||||
|
||||
item_sprite.set_owner(item)
|
||||
|
||||
print("f")
|
||||
|
||||
# get_tree().edited_scene_root.add_child(item)
|
||||
# item.set_owner(get_tree().edited_scene_root)
|
||||
|
||||
|
||||
var current_node = EditorPlugin.new().get_editor_interface().get_selection().get_selected_nodes()[0]
|
||||
# print("Cur = "+str(current_node))
|
||||
# print("Cur0 = "+str(current_node[0]))
|
||||
print("g")
|
||||
|
||||
current_node.add_child(item)
|
||||
print("h")
|
||||
|
||||
# item.set_owner(current_node)
|
||||
item.set_owner(get_tree().edited_scene_root)
|
||||
print("Created.")
|
||||
#item.queue_free()
|
||||
|
||||
#func get_edited_root() -> Node:
|
||||
# var plugin := EditorPlugin.new()
|
||||
# var eds:EditorInterface
|
||||
# eds = plugin.get_selection()
|
||||
# var selected:EditorInterface
|
||||
# selected = eds.get_selected_nodes()[0]
|
||||
# if selected:
|
||||
# return selected.get_tree().get_edited_scene_root()
|
||||
# return null
|
||||
1615
addons/escoria-wizard/CharacterCreator.gd
Normal file
1448
addons/escoria-wizard/CharacterCreator.tscn
Normal file
436
addons/escoria-wizard/ItemCreator.tscn
Normal file
@@ -0,0 +1,436 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-wizard/item_creator.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/inventory_preview.png" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/object_preview.png" type="Texture" id=3]
|
||||
|
||||
[node name="ItemCreator" type="MarginContainer"]
|
||||
margin_left = 395.0
|
||||
margin_top = 50.0
|
||||
margin_right = 895.0
|
||||
margin_bottom = 850.0
|
||||
rect_min_size = Vector2( 500, 500 )
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="window_background_colour" type="ColorRect" parent="."]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 800.0
|
||||
rect_min_size = Vector2( 500, 800 )
|
||||
color = Color( 0.235294, 0.341176, 0.290196, 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 800.0
|
||||
|
||||
[node name="Control" type="Control" parent="VBoxContainer"]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 60.0
|
||||
rect_min_size = Vector2( 0, 60 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Control"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -183.5
|
||||
margin_top = -20.0
|
||||
margin_right = 183.5
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Control/CenterContainer"]
|
||||
margin_left = 3.0
|
||||
margin_top = 8.0
|
||||
margin_right = 364.0
|
||||
margin_bottom = 32.0
|
||||
|
||||
[node name="BackgroundObjectCheckBox" type="CheckBox" parent="VBoxContainer/Control/CenterContainer/HBoxContainer"]
|
||||
margin_right = 190.0
|
||||
margin_bottom = 24.0
|
||||
pressed = true
|
||||
text = "Create background object"
|
||||
|
||||
[node name="InventoryItemCheckBox" type="CheckBox" parent="VBoxContainer/Control/CenterContainer/HBoxContainer"]
|
||||
margin_left = 194.0
|
||||
margin_right = 361.0
|
||||
margin_bottom = 24.0
|
||||
text = "Create inventory item"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||
margin_top = 64.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="HelperHeading" type="MarginContainer" parent="VBoxContainer"]
|
||||
margin_top = 72.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 112.0
|
||||
rect_min_size = Vector2( 0, 40 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/HelperHeading"]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="ObjectHeading" type="Label" parent="VBoxContainer/HelperHeading/CenterContainer"]
|
||||
margin_left = 196.0
|
||||
margin_top = 13.0
|
||||
margin_right = 303.0
|
||||
margin_bottom = 27.0
|
||||
custom_colors/font_color = Color( 0.592157, 0.87451, 0.533333, 1 )
|
||||
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
text = "Object Creator"
|
||||
uppercase = true
|
||||
|
||||
[node name="InventoryHeading" type="Label" parent="VBoxContainer/HelperHeading/CenterContainer"]
|
||||
visible = false
|
||||
margin_left = 165.0
|
||||
margin_top = 13.0
|
||||
margin_right = 335.0
|
||||
margin_bottom = 27.0
|
||||
custom_colors/font_color = Color( 0.592157, 0.87451, 0.533333, 1 )
|
||||
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
text = "Inventory Item Creator"
|
||||
uppercase = true
|
||||
|
||||
[node name="Description" type="MarginContainer" parent="VBoxContainer"]
|
||||
margin_top = 116.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 232.0
|
||||
|
||||
[node name="ObjectDescription" type="Label" parent="VBoxContainer/Description"]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 116.0
|
||||
text = "The object creator is used to create background objects
|
||||
that the player can interact with, but that will not become
|
||||
part of their inventory.
|
||||
|
||||
NOTE: The node will be created as a child of whichever node
|
||||
is currently selected in the scene tree.
|
||||
"
|
||||
align = 1
|
||||
|
||||
[node name="InventoryDescription" type="Label" parent="VBoxContainer/Description"]
|
||||
visible = false
|
||||
margin_right = 500.0
|
||||
margin_bottom = 116.0
|
||||
text = "The inventory item creator is used to create objects
|
||||
that the player can pick up to add
|
||||
to their inventory.
|
||||
|
||||
NOTE: The node will be created in the inventory folder shown
|
||||
below. You can change this in Godot's settings under:
|
||||
\"Escoria/UI/Items autoregister path\""
|
||||
align = 1
|
||||
|
||||
[node name="Content" type="MarginContainer" parent="VBoxContainer"]
|
||||
margin_top = 236.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 736.0
|
||||
rect_min_size = Vector2( 0, 500 )
|
||||
mouse_filter = 1
|
||||
custom_constants/margin_right = 20
|
||||
custom_constants/margin_top = 0
|
||||
custom_constants/margin_left = 20
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/Content"]
|
||||
margin_left = 20.0
|
||||
margin_right = 480.0
|
||||
margin_bottom = 500.0
|
||||
rect_min_size = Vector2( 460, 500 )
|
||||
columns = 3
|
||||
|
||||
[node name="ItemNameLabel" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 19.0
|
||||
text = "Item name:"
|
||||
|
||||
[node name="ItemName" type="LineEdit" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 114.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 200, 0 )
|
||||
text = "replace_me"
|
||||
|
||||
[node name="BlankItem" type="Control" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 358.0
|
||||
margin_right = 460.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="ItemGlobalIDLabel" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_top = 33.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 47.0
|
||||
text = "Global ID:"
|
||||
|
||||
[node name="ItemGlobalID" type="LineEdit" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 114.0
|
||||
margin_top = 28.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 52.0
|
||||
|
||||
[node name="BlankItem2" type="Control" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 358.0
|
||||
margin_top = 28.0
|
||||
margin_right = 460.0
|
||||
margin_bottom = 52.0
|
||||
|
||||
[node name="StartsInteractiveLabel" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_top = 61.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 75.0
|
||||
rect_min_size = Vector2( 110, 0 )
|
||||
text = "Is 'Interactive':"
|
||||
|
||||
[node name="StartsInteractiveCheckBox" type="CheckBox" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 114.0
|
||||
margin_top = 56.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 80.0
|
||||
hint_tooltip = "When the room first loads, can the player interact with this?"
|
||||
pressed = true
|
||||
|
||||
[node name="BlankItem3" type="Control" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 358.0
|
||||
margin_top = 56.0
|
||||
margin_right = 460.0
|
||||
margin_bottom = 80.0
|
||||
|
||||
[node name="DefaultActionLabel" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_top = 84.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 115.0
|
||||
text = "Default action:
|
||||
"
|
||||
valign = 1
|
||||
|
||||
[node name="DefaultActionOption" type="OptionButton" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 114.0
|
||||
margin_top = 84.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 115.0
|
||||
rect_min_size = Vector2( 200, 31 )
|
||||
text = "look"
|
||||
items = [ "look", null, false, 0, null, "pick up", null, false, 1, null, "open", null, false, 2, null, "close", null, false, 3, null, "use", null, false, 4, null, "push", null, false, 5, null, "pull", null, false, 6, null, "talk", null, false, 7, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="BlankItem4" type="Control" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 358.0
|
||||
margin_top = 84.0
|
||||
margin_right = 460.0
|
||||
margin_bottom = 115.0
|
||||
|
||||
[node name="ImagePathLabel" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_top = 124.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 138.0
|
||||
text = "Item graphic:"
|
||||
|
||||
[node name="ImagePath" type="LineEdit" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 114.0
|
||||
margin_top = 119.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 143.0
|
||||
editable = false
|
||||
|
||||
[node name="ChangeImageButton" type="Button" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 358.0
|
||||
margin_top = 119.0
|
||||
margin_right = 460.0
|
||||
margin_bottom = 143.0
|
||||
text = "Change Image"
|
||||
|
||||
[node name="PreviewLabel" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_top = 260.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 274.0
|
||||
text = "Preview:"
|
||||
|
||||
[node name="Preview" type="ColorRect" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 114.0
|
||||
margin_top = 147.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 387.0
|
||||
rect_min_size = Vector2( 240, 240 )
|
||||
color = Color( 0.121569, 0.196078, 0.0823529, 1 )
|
||||
|
||||
[node name="BackgroundColour" type="ColorRect" parent="VBoxContainer/Content/GridContainer/Preview"]
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 236.0
|
||||
margin_bottom = 236.0
|
||||
rect_min_size = Vector2( 232, 232 )
|
||||
color = Color( 0.254902, 0.231373, 0.231373, 1 )
|
||||
|
||||
[node name="InventoryPreview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview"]
|
||||
visible = false
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 236.0
|
||||
margin_bottom = 236.0
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="ObjectPreview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview"]
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 236.0
|
||||
margin_bottom = 236.0
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="Preview" type="TextureRect" parent="VBoxContainer/Content/GridContainer/Preview"]
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 236.0
|
||||
margin_bottom = 236.0
|
||||
rect_min_size = Vector2( 232, 232 )
|
||||
|
||||
[node name="BlankItem5" type="Control" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 358.0
|
||||
margin_top = 147.0
|
||||
margin_right = 460.0
|
||||
margin_bottom = 387.0
|
||||
|
||||
[node name="ImageSizeLabel" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_top = 391.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 405.0
|
||||
text = "Image size:"
|
||||
|
||||
[node name="ImageSize" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 114.0
|
||||
margin_top = 391.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 405.0
|
||||
text = "(0, 0)"
|
||||
|
||||
[node name="BlankItem6" type="Control" parent="VBoxContainer/Content/GridContainer"]
|
||||
margin_left = 358.0
|
||||
margin_top = 391.0
|
||||
margin_right = 460.0
|
||||
margin_bottom = 405.0
|
||||
|
||||
[node name="InventoryPathLabel" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
visible = false
|
||||
margin_top = 409.0
|
||||
margin_right = 110.0
|
||||
margin_bottom = 423.0
|
||||
text = "Inventory path:"
|
||||
|
||||
[node name="InventoryPath" type="Label" parent="VBoxContainer/Content/GridContainer"]
|
||||
visible = false
|
||||
margin_left = 114.0
|
||||
margin_top = 409.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 423.0
|
||||
text = "res://"
|
||||
|
||||
[node name="BlankItem7" type="Control" parent="VBoxContainer/Content/GridContainer"]
|
||||
visible = false
|
||||
margin_left = 114.0
|
||||
margin_top = 409.0
|
||||
margin_right = 354.0
|
||||
margin_bottom = 423.0
|
||||
|
||||
[node name="Buttons" type="MarginContainer" parent="VBoxContainer"]
|
||||
margin_top = 740.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 770.0
|
||||
mouse_filter = 2
|
||||
custom_constants/margin_bottom = 10
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Buttons"]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Buttons/CenterContainer"]
|
||||
margin_left = 98.0
|
||||
margin_right = 402.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="CreateButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"]
|
||||
margin_right = 100.0
|
||||
margin_bottom = 20.0
|
||||
text = "Create Object"
|
||||
|
||||
[node name="Spacer" type="Control" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"]
|
||||
margin_left = 104.0
|
||||
margin_right = 124.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 20, 0 )
|
||||
|
||||
[node name="ClearButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"]
|
||||
margin_left = 128.0
|
||||
margin_right = 193.0
|
||||
margin_bottom = 20.0
|
||||
text = "Clear All"
|
||||
|
||||
[node name="Spacer2" type="Control" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"]
|
||||
margin_left = 197.0
|
||||
margin_right = 217.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 20, 0 )
|
||||
|
||||
[node name="ExitButton" type="Button" parent="VBoxContainer/Buttons/CenterContainer/HBoxContainer"]
|
||||
margin_left = 221.0
|
||||
margin_right = 304.0
|
||||
margin_bottom = 20.0
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="LoadObjectGraphic" type="CenterContainer" parent="."]
|
||||
visible = false
|
||||
margin_right = 500.0
|
||||
margin_bottom = 800.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="LoadObjectFileDialog" type="FileDialog" parent="LoadObjectGraphic"]
|
||||
margin_left = -150.0
|
||||
margin_top = 100.0
|
||||
margin_right = 650.0
|
||||
margin_bottom = 700.0
|
||||
rect_min_size = Vector2( 800, 600 )
|
||||
popup_exclusive = true
|
||||
window_title = "Open a File"
|
||||
mode = 0
|
||||
filters = PoolStringArray( "*.png", "*.bmp", "*.jpg", "*.jpeg", "*.webp", "*.tga" )
|
||||
|
||||
[node name="Windows" type="CenterContainer" parent="."]
|
||||
visible = false
|
||||
margin_right = 500.0
|
||||
margin_bottom = 800.0
|
||||
|
||||
[node name="ConfirmationDialog" type="ConfirmationDialog" parent="Windows"]
|
||||
margin_left = 90.0
|
||||
margin_top = 354.0
|
||||
margin_right = 409.0
|
||||
margin_bottom = 446.0
|
||||
dialog_text = "WARNING!
|
||||
|
||||
If you continue you will lose the current object."
|
||||
|
||||
[node name="ErrorDialog" type="AcceptDialog" parent="Windows"]
|
||||
margin_left = 208.0
|
||||
margin_top = 371.0
|
||||
margin_right = 291.0
|
||||
margin_bottom = 429.0
|
||||
|
||||
[node name="CreateCompleteDialog" type="AcceptDialog" parent="Windows"]
|
||||
margin_left = 208.0
|
||||
margin_top = 371.0
|
||||
margin_right = 291.0
|
||||
margin_bottom = 429.0
|
||||
|
||||
[connection signal="toggled" from="VBoxContainer/Control/CenterContainer/HBoxContainer/BackgroundObjectCheckBox" to="." method="_on_BackgroundObjectCheckBox_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Control/CenterContainer/HBoxContainer/InventoryItemCheckBox" to="." method="_on_InventoryItemCheckBox_toggled"]
|
||||
[connection signal="text_changed" from="VBoxContainer/Content/GridContainer/ItemName" to="." method="background_on_ItemName_text_changed"]
|
||||
[connection signal="text_changed" from="VBoxContainer/Content/GridContainer/ItemGlobalID" to="." method="_on_ItemGlobalID_text_changed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Content/GridContainer/StartsInteractiveCheckBox" to="." method="_on_StartsInteractiveCheckBox_pressed"]
|
||||
[connection signal="item_selected" from="VBoxContainer/Content/GridContainer/DefaultActionOption" to="." method="_on_DefaultActionOption_item_selected"]
|
||||
[connection signal="pressed" from="VBoxContainer/Content/GridContainer/ChangeImageButton" to="." method="load_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Buttons/CenterContainer/HBoxContainer/CreateButton" to="." method="_on_CreateButton_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Buttons/CenterContainer/HBoxContainer/ClearButton" to="." method="Item_on_ClearButton_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Buttons/CenterContainer/HBoxContainer/ExitButton" to="." method="Item_on_ExitButton_pressed"]
|
||||
[connection signal="file_selected" from="LoadObjectGraphic/LoadObjectFileDialog" to="." method="LoadObjectFileDialog_file_selected"]
|
||||
[connection signal="confirmed" from="Windows/ConfirmationDialog" to="." method="_on_ObjectConfirmationDialog_confirmed"]
|
||||
[connection signal="confirmed" from="Windows/CreateCompleteDialog" to="." method="_on_CreateCompleteDialog_confirmed"]
|
||||
323
addons/escoria-wizard/RoomCreator.gd
Normal file
@@ -0,0 +1,323 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
const ROOM_NAME = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/RoomName"
|
||||
const GLOBAL_ID = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/GlobalID"
|
||||
const PLAYER_SCENE = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/PlayerScene"
|
||||
const SELECT_PLAYER_SCENE = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/SelectPlayerScene"
|
||||
const SELECT_PLAYER_SCENE_SPACER = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/SelectPlayerSceneSpacer"
|
||||
const USE_EMPTY_PLAYER_BUTTON = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/UseEmptyPlayerButton"
|
||||
const ESC_SCRIPT = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/ESCScript"
|
||||
const USE_EMPTY_ROOM_SCRIPT = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/UseEmptyRoomScript"
|
||||
const USE_EMPTY_ROOM_SPACER = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/UseEmptyRoomSpacer"
|
||||
const BACKGROUND_IMAGE = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/BackgroundImage"
|
||||
const USE_EMPTY_BACKGROUND = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/UseEmptyBackground"
|
||||
const SELECT_BACKGROUND = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/SelectBackground"
|
||||
const SELECT_BACKGROUNDSPACER = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/SelectBackgroundSpacer"
|
||||
const ROOM_FOLDER_PATH = "MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/RoomFolder"
|
||||
const ROOM_BACKGROUND = "MarginContainer/MarginContainer/VBoxContainer/PreviewSection/CenterContainer/RoomBackground"
|
||||
const BACKGROUND_PREVIEW = "MarginContainer/MarginContainer/VBoxContainer/PreviewSection/BackgroundPreview"
|
||||
|
||||
const SCRIPT_BLANK_TEXT = "Room will not have a script configured."
|
||||
const SCRIPT_SELECT_TEXT = "Please select script."
|
||||
const PLAYER_BLANK_TEXT = "Scene will be left blank."
|
||||
const PLAYER_SELECT_TEXT = "Please select scene."
|
||||
const BACKGROUND_BLANK_TEXT = "Image will be left blank."
|
||||
const BACKGROUND_SELECT_TEXT = "Please select image."
|
||||
|
||||
|
||||
var settings_modified: bool
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
room_creator_reset()
|
||||
$"InformationWindows/PlayerSceneFileDialog".get_cancel().connect("pressed", self, "PlayerSceneCancelled")
|
||||
$"InformationWindows/BackgroundImageFileDialog".get_cancel().connect("pressed", self, "BackgroundFileCancelled")
|
||||
|
||||
|
||||
func PlayerSceneCancelled() -> void:
|
||||
if get_node(PLAYER_SCENE).text == PLAYER_SELECT_TEXT:
|
||||
get_node(USE_EMPTY_PLAYER_BUTTON).pressed = true
|
||||
|
||||
|
||||
func BackgroundFileCancelled() -> void:
|
||||
if get_node(BACKGROUND_IMAGE).text == BACKGROUND_SELECT_TEXT:
|
||||
get_node(USE_EMPTY_BACKGROUND).pressed = true
|
||||
|
||||
|
||||
func room_creator_reset() -> void:
|
||||
get_node(ROOM_NAME).text = ""
|
||||
get_node(GLOBAL_ID).text = ""
|
||||
get_node(PLAYER_SCENE).text = PLAYER_BLANK_TEXT
|
||||
get_node(SELECT_PLAYER_SCENE).visible = false
|
||||
get_node(SELECT_PLAYER_SCENE_SPACER).visible = true
|
||||
get_node(USE_EMPTY_PLAYER_BUTTON).pressed = true
|
||||
get_node(ESC_SCRIPT).editable = false
|
||||
get_node(ESC_SCRIPT).text = SCRIPT_BLANK_TEXT
|
||||
get_node(USE_EMPTY_ROOM_SCRIPT).pressed = true
|
||||
get_node(BACKGROUND_IMAGE).text = BACKGROUND_BLANK_TEXT
|
||||
get_node(USE_EMPTY_ROOM_SPACER).visible = true
|
||||
get_node(USE_EMPTY_BACKGROUND).pressed = true
|
||||
get_node(SELECT_BACKGROUND).visible = false
|
||||
get_node(SELECT_BACKGROUNDSPACER).visible = true
|
||||
get_node(BACKGROUND_PREVIEW).visible = true
|
||||
get_node(ROOM_BACKGROUND).visible = true
|
||||
get_node(BACKGROUND_PREVIEW).texture = null
|
||||
get_node(ROOM_FOLDER_PATH).text = ProjectSettings.get_setting("escoria/debug/room_selector_room_dir")
|
||||
$InformationWindows/RoomFolderDialog.current_dir = ProjectSettings.get_setting("escoria/debug/room_selector_room_dir")
|
||||
settings_modified = false
|
||||
|
||||
|
||||
func _on_RoomName_text_changed(new_text: String) -> void:
|
||||
get_node(GLOBAL_ID).text = new_text
|
||||
settings_modified = true
|
||||
|
||||
|
||||
func _on_GlobalID_text_changed(new_text: String) -> void:
|
||||
settings_modified = true
|
||||
|
||||
|
||||
func _on_UseEmptyPlayerButton_toggled(button_pressed: bool) -> void:
|
||||
if button_pressed == true:
|
||||
get_node(SELECT_PLAYER_SCENE).visible = false
|
||||
get_node(SELECT_PLAYER_SCENE_SPACER).visible = true
|
||||
get_node(PLAYER_SCENE).text = PLAYER_BLANK_TEXT
|
||||
else:
|
||||
get_node(SELECT_PLAYER_SCENE).visible = true
|
||||
get_node(SELECT_PLAYER_SCENE_SPACER).visible = false
|
||||
get_node(PLAYER_SCENE).text = PLAYER_SELECT_TEXT
|
||||
$"InformationWindows/PlayerSceneFileDialog".popup_centered()
|
||||
|
||||
|
||||
func _on_SelectPlayerScene_pressed() -> void:
|
||||
$"InformationWindows/PlayerSceneFileDialog".visible = true
|
||||
$"InformationWindows/PlayerSceneFileDialog".invalidate()
|
||||
|
||||
|
||||
func _on_PlayerSceneFileDialog_file_selected(path: String) -> void:
|
||||
settings_modified = true
|
||||
get_node(PLAYER_SCENE).text = path
|
||||
|
||||
|
||||
func _on_UseEmptyRoomScript_toggled(button_pressed: bool) -> void:
|
||||
if button_pressed == true:
|
||||
get_node(ESC_SCRIPT).editable = false
|
||||
get_node(ESC_SCRIPT).text = SCRIPT_BLANK_TEXT
|
||||
else:
|
||||
get_node(ESC_SCRIPT).editable = true
|
||||
get_node(ESC_SCRIPT).text = "%s.esc" % get_node(GLOBAL_ID).text
|
||||
|
||||
|
||||
func _on_SelectRoomScript_pressed() -> void:
|
||||
$"InformationWindows/ESCScriptFileDialog".visible = true
|
||||
$"InformationWindows/ESCScriptFileDialog".invalidate()
|
||||
|
||||
|
||||
func _on_ESCScriptFileDialog_file_selected(path: String) -> void:
|
||||
settings_modified = true
|
||||
get_node(ESC_SCRIPT).text = path
|
||||
|
||||
|
||||
func _on_UseEmptyBackground_toggled(button_pressed: bool) -> void:
|
||||
if button_pressed == true:
|
||||
get_node(SELECT_BACKGROUND).visible = false
|
||||
get_node(SELECT_BACKGROUNDSPACER).visible = true
|
||||
get_node(BACKGROUND_IMAGE).text = BACKGROUND_BLANK_TEXT
|
||||
get_node(BACKGROUND_PREVIEW).texture = null
|
||||
get_node(ROOM_BACKGROUND).visible = true
|
||||
else:
|
||||
get_node(SELECT_BACKGROUND).visible = true
|
||||
get_node(SELECT_BACKGROUNDSPACER).visible = false
|
||||
get_node(BACKGROUND_IMAGE).text = BACKGROUND_SELECT_TEXT
|
||||
|
||||
var viewport_centre: Vector2 = get_viewport_rect().size / 2
|
||||
var dialog_start: Vector2 = $"InformationWindows/BackgroundImageFileDialog".rect_size / 2
|
||||
var dialog_pos: Vector2 = viewport_centre - dialog_start
|
||||
$"InformationWindows/BackgroundImageFileDialog".rect_position = dialog_pos
|
||||
|
||||
$"InformationWindows/BackgroundImageFileDialog".popup_centered()
|
||||
|
||||
|
||||
func _on_SelectBackground_pressed() -> void:
|
||||
var viewport_centre: Vector2 = get_viewport_rect().size / 2
|
||||
var dialog_start: Vector2 = $"InformationWindows/BackgroundImageFileDialog".rect_size / 2
|
||||
var dialog_pos: Vector2 = viewport_centre - dialog_start
|
||||
$"InformationWindows/BackgroundImageFileDialog".rect_position = dialog_pos
|
||||
|
||||
$"InformationWindows/BackgroundImageFileDialog".visible = true
|
||||
$"InformationWindows/BackgroundImageFileDialog".invalidate()
|
||||
|
||||
|
||||
func _on_BackgroundImageFileDialog_file_selected(path: String) -> void:
|
||||
settings_modified = true
|
||||
|
||||
get_node(BACKGROUND_IMAGE).text = path
|
||||
|
||||
var image_stream_texture:StreamTexture
|
||||
|
||||
image_stream_texture = load(path)
|
||||
|
||||
var preview_size = get_node(ROOM_BACKGROUND).rect_size
|
||||
|
||||
get_node(BACKGROUND_PREVIEW).texture = image_stream_texture
|
||||
get_node(ROOM_BACKGROUND).visible = false
|
||||
set_preview_scale()
|
||||
|
||||
|
||||
func set_preview_scale() -> void:
|
||||
var preview_scale = Vector2.ONE
|
||||
# Calculate the scale to make the preview as big as possible in the preview window depending on
|
||||
# the height to width ratio of the frame
|
||||
var preview_size = get_node(ROOM_BACKGROUND).get_size()
|
||||
# get_node(BACKGROUND_PREVIEW).rect_scale = Vector2.ONE
|
||||
var image_size = get_node(BACKGROUND_PREVIEW).texture.get_size()
|
||||
|
||||
preview_scale.x = preview_size.x / image_size.x
|
||||
preview_scale.y = preview_size.y / image_size.y
|
||||
|
||||
# print("scale = "+str(preview_scale)+", preview size = "+str(preview_size)+", image_size = "+str(image_size))
|
||||
if preview_scale.y > preview_scale.x:
|
||||
get_node(BACKGROUND_PREVIEW).rect_scale = Vector2(preview_scale.x, preview_scale.x)
|
||||
else:
|
||||
# Image width will hit the preview boundary before the height will
|
||||
get_node(BACKGROUND_PREVIEW).rect_scale = Vector2(preview_scale.y, preview_scale.y)
|
||||
|
||||
|
||||
func _on_ClearButton_pressed() -> void:
|
||||
if settings_modified:
|
||||
$InformationWindows/ClearConfirmationDialog.popup_centered()
|
||||
|
||||
|
||||
func _on_MainMenuButton_pressed() -> void:
|
||||
if settings_modified:
|
||||
$InformationWindows/MainMenuConfirmationDialog.popup_centered()
|
||||
else:
|
||||
get_node("../Menu").visible = true
|
||||
get_node("../RoomCreator").visible = false
|
||||
|
||||
|
||||
func _on_ClearConfirmationDialog_confirmed() -> void:
|
||||
room_creator_reset()
|
||||
|
||||
|
||||
func _on_MainMenuConfirmationDialog_confirmed() -> void:
|
||||
get_node("../Menu").visible = true
|
||||
get_node("../RoomCreator").visible = false
|
||||
|
||||
|
||||
func _on_ChangeRoomFolderButton_pressed() -> void:
|
||||
$"InformationWindows/RoomFolderDialog".popup_centered()
|
||||
|
||||
|
||||
func _on_RoomFolderDialog_dir_selected(dir: String) -> void:
|
||||
ProjectSettings.set_setting("escoria/debug/room_selector_room_dir", dir)
|
||||
get_node(ROOM_FOLDER_PATH).text = dir
|
||||
|
||||
|
||||
func _on_CreateButton_pressed() -> void:
|
||||
var RoomName = get_node(ROOM_NAME).text
|
||||
|
||||
if RoomName.length() < 1:
|
||||
$"InformationWindows/GenericErrorDialog".dialog_text = "Error!\n\nRoom name must be specified."
|
||||
$"InformationWindows/GenericErrorDialog".popup_centered()
|
||||
return
|
||||
|
||||
var ScriptName = get_node(ESC_SCRIPT).text
|
||||
|
||||
if get_node(USE_EMPTY_ROOM_SCRIPT).pressed == false:
|
||||
if ScriptName.length() < 5 or ! ScriptName.substr(ScriptName.length() - 4) == ".esc":
|
||||
$"InformationWindows/GenericErrorDialog".dialog_text = "Error!\n\n" \
|
||||
+ "Room ESC script must be a filename ending in '.esc'"
|
||||
$"InformationWindows/GenericErrorDialog".popup_centered()
|
||||
return
|
||||
|
||||
if "/" in get_node(ESC_SCRIPT).text:
|
||||
$"InformationWindows/GenericErrorDialog".dialog_text = "Error!\n\n" \
|
||||
+ "Please remove any '/' characters from the name of the Room ESC script."
|
||||
$"InformationWindows/GenericErrorDialog".popup_centered()
|
||||
return
|
||||
|
||||
var BaseDir = ProjectSettings.get_setting("escoria/debug/room_selector_room_dir")
|
||||
var ImageSize = Vector2(1,1)
|
||||
var NewRoom = ESCRoom.new()
|
||||
|
||||
NewRoom.name = RoomName
|
||||
NewRoom.global_id = get_node(GLOBAL_ID).text
|
||||
|
||||
if ! get_node(ESC_SCRIPT).text == SCRIPT_SELECT_TEXT and ! get_node(ESC_SCRIPT).text == SCRIPT_BLANK_TEXT:
|
||||
NewRoom.esc_script = "%s/%s/scripts/%s" % [BaseDir, RoomName, get_node(ESC_SCRIPT).text]
|
||||
|
||||
if ! get_node(PLAYER_SCENE).text == PLAYER_SELECT_TEXT and ! get_node(PLAYER_SCENE).text == PLAYER_BLANK_TEXT:
|
||||
var player_scene = load(get_node(PLAYER_SCENE).text)
|
||||
NewRoom.player_scene = player_scene
|
||||
|
||||
var Background = ESCBackground.new()
|
||||
Background.name = "Background"
|
||||
|
||||
var BackgroundSize = Vector2.ONE
|
||||
|
||||
if ! get_node(BACKGROUND_IMAGE).text == BACKGROUND_SELECT_TEXT and ! get_node(BACKGROUND_IMAGE).text == BACKGROUND_BLANK_TEXT:
|
||||
Background.texture = get_node(BACKGROUND_PREVIEW).texture
|
||||
BackgroundSize = Background.texture.get_size()
|
||||
else:
|
||||
# Set TextureRect to have the same size as the Viewport so that the room
|
||||
# works even if no texture is set in the TextureRect
|
||||
BackgroundSize = Vector2(ProjectSettings.get_setting("display/window/size/width"), \
|
||||
ProjectSettings.get_setting("display/window/size/height"))
|
||||
Background.rect_size = BackgroundSize
|
||||
|
||||
NewRoom.add_child(Background)
|
||||
|
||||
var NewTerrain = ESCTerrain.new()
|
||||
NewTerrain.name = "WalkableArea"
|
||||
var NewNavigationPolygonInstance = NavigationPolygonInstance.new()
|
||||
|
||||
var NewNavigationPolygon = NavigationPolygon.new()
|
||||
NewNavigationPolygonInstance.navpoly = NewNavigationPolygon
|
||||
|
||||
NewRoom.add_child(NewTerrain)
|
||||
|
||||
NewTerrain.add_child(NewNavigationPolygonInstance)
|
||||
|
||||
var Objects = Node2D.new()
|
||||
Objects.name = "RoomObjects"
|
||||
NewRoom.add_child(Objects)
|
||||
|
||||
var StartPos = ESCLocation.new()
|
||||
StartPos.name = "StartPos"
|
||||
StartPos.is_start_location = true
|
||||
StartPos.global_id = "%s_start_pos" % RoomName
|
||||
StartPos.position = Vector2(int(BackgroundSize.x / 2), int(BackgroundSize.y / 2))
|
||||
NewRoom.add_child(StartPos)
|
||||
|
||||
get_tree().edited_scene_root.add_child(NewRoom)
|
||||
NewRoom.set_owner(get_tree().edited_scene_root)
|
||||
NewNavigationPolygonInstance.set_owner(NewRoom)
|
||||
NewTerrain.set_owner(NewRoom)
|
||||
Background.set_owner(NewRoom)
|
||||
Objects.set_owner(NewRoom)
|
||||
StartPos.set_owner(NewRoom)
|
||||
|
||||
var dir = Directory.new()
|
||||
dir.make_dir_recursive("%s/%s/scripts" % [BaseDir, RoomName])
|
||||
dir.make_dir_recursive("%s/%s/objects" % [BaseDir, RoomName])
|
||||
dir.copy("res://addons/escoria-wizard/room_script_template.esc", "%s/%s/scripts/%s" % \
|
||||
[BaseDir, RoomName, get_node(ESC_SCRIPT).text])
|
||||
|
||||
# Export scene
|
||||
var packed_scene = PackedScene.new()
|
||||
packed_scene.pack(get_tree().edited_scene_root.get_node(NewRoom.name))
|
||||
|
||||
# Flag suggestions from https://godotengine.org/qa/50437/how-to-turn-a-node-into-a-packedscene-via-gdscript
|
||||
ResourceSaver.save("%s/%s/%s.tscn" % [BaseDir, RoomName, RoomName], \
|
||||
packed_scene, ResourceSaver.FLAG_CHANGE_PATH|ResourceSaver.FLAG_REPLACE_SUBRESOURCE_PATHS)
|
||||
|
||||
NewRoom.queue_free()
|
||||
get_tree().edited_scene_root.get_node(NewRoom.name).queue_free()
|
||||
# Scan the filesystem so that the new folders show up in the file browser.
|
||||
# Without this you might not see the objects/scripts folders in the filetree.
|
||||
var ep = EditorPlugin.new()
|
||||
ep.get_editor_interface().get_resource_filesystem().scan()
|
||||
ep.free()
|
||||
|
||||
$InformationWindows/CreateCompleteDialog.popup_centered()
|
||||
431
addons/escoria-wizard/RoomCreator.tscn
Normal file
@@ -0,0 +1,431 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-wizard/RoomCreator.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/background_preview.png" type="Texture" id=2]
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_clip_content = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
margin_left = 135.0
|
||||
margin_top = 73.0
|
||||
margin_right = 1145.0
|
||||
margin_bottom = 827.0
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="MarginContainer"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 754.0
|
||||
color = Color( 0.235294, 0.341176, 0.290196, 1 )
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 754.0
|
||||
custom_constants/margin_right = 5
|
||||
custom_constants/margin_top = 5
|
||||
custom_constants/margin_left = 5
|
||||
custom_constants/margin_bottom = 5
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/MarginContainer"]
|
||||
margin_left = 5.0
|
||||
margin_top = 5.0
|
||||
margin_right = 1005.0
|
||||
margin_bottom = 749.0
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
margin_right = 1000.0
|
||||
margin_bottom = 40.0
|
||||
rect_min_size = Vector2( 0, 40 )
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/CenterContainer"]
|
||||
margin_left = 448.0
|
||||
margin_top = 13.0
|
||||
margin_right = 552.0
|
||||
margin_bottom = 27.0
|
||||
custom_colors/font_color = Color( 0.921569, 1, 0, 1 )
|
||||
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
text = "Room Creator"
|
||||
uppercase = true
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
margin_top = 44.0
|
||||
margin_right = 1000.0
|
||||
margin_bottom = 256.0
|
||||
rect_min_size = Vector2( 460, 200 )
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer"]
|
||||
margin_right = 1000.0
|
||||
margin_bottom = 212.0
|
||||
rect_min_size = Vector2( 300, 200 )
|
||||
custom_constants/hseparation = 10
|
||||
columns = 4
|
||||
|
||||
[node name="RoomNameLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_top = 5.0
|
||||
margin_right = 127.0
|
||||
margin_bottom = 19.0
|
||||
text = "Room name:"
|
||||
|
||||
[node name="RoomName" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 137.0
|
||||
margin_right = 537.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="Spacer3" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 547.0
|
||||
margin_right = 782.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 40, 0 )
|
||||
|
||||
[node name="Spacer6" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 792.0
|
||||
margin_right = 992.0
|
||||
margin_bottom = 24.0
|
||||
rect_min_size = Vector2( 200, 0 )
|
||||
|
||||
[node name="GlobalIDLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_top = 33.0
|
||||
margin_right = 127.0
|
||||
margin_bottom = 47.0
|
||||
text = "Global ID:"
|
||||
|
||||
[node name="GlobalID" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 137.0
|
||||
margin_top = 28.0
|
||||
margin_right = 537.0
|
||||
margin_bottom = 52.0
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="Spacer4" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 547.0
|
||||
margin_top = 28.0
|
||||
margin_right = 782.0
|
||||
margin_bottom = 52.0
|
||||
rect_min_size = Vector2( 40, 0 )
|
||||
|
||||
[node name="Spacer7" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 792.0
|
||||
margin_top = 28.0
|
||||
margin_right = 992.0
|
||||
margin_bottom = 52.0
|
||||
rect_min_size = Vector2( 40, 0 )
|
||||
|
||||
[node name="PlayerSceneLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_top = 69.0
|
||||
margin_right = 127.0
|
||||
margin_bottom = 83.0
|
||||
text = "Player scene:"
|
||||
|
||||
[node name="PlayerScene" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 137.0
|
||||
margin_top = 56.0
|
||||
margin_right = 537.0
|
||||
margin_bottom = 96.0
|
||||
text = "Scene will be left blank."
|
||||
editable = false
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="UseEmptyPlayerButton" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 547.0
|
||||
margin_top = 56.0
|
||||
margin_right = 782.0
|
||||
margin_bottom = 96.0
|
||||
pressed = true
|
||||
text = "Use empty player scene"
|
||||
|
||||
[node name="SelectPlayerScene" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
visible = false
|
||||
margin_left = 578.0
|
||||
margin_top = 56.0
|
||||
margin_right = 808.0
|
||||
margin_bottom = 96.0
|
||||
text = "Select Player Scene"
|
||||
|
||||
[node name="SelectPlayerSceneSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 792.0
|
||||
margin_top = 56.0
|
||||
margin_right = 992.0
|
||||
margin_bottom = 96.0
|
||||
rect_min_size = Vector2( 40, 0 )
|
||||
|
||||
[node name="ESCScriptLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_top = 113.0
|
||||
margin_right = 127.0
|
||||
margin_bottom = 127.0
|
||||
text = "Room ESC script:"
|
||||
|
||||
[node name="ESCScript" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 137.0
|
||||
margin_top = 100.0
|
||||
margin_right = 537.0
|
||||
margin_bottom = 140.0
|
||||
hint_tooltip = "In the room's scripts folder
|
||||
an empty file will be created
|
||||
with this name."
|
||||
text = "Room will not have a script configured."
|
||||
editable = false
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="UseEmptyRoomScript" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 547.0
|
||||
margin_top = 100.0
|
||||
margin_right = 782.0
|
||||
margin_bottom = 140.0
|
||||
pressed = true
|
||||
text = "No script"
|
||||
|
||||
[node name="UseEmptyRoomSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 792.0
|
||||
margin_top = 100.0
|
||||
margin_right = 992.0
|
||||
margin_bottom = 140.0
|
||||
rect_min_size = Vector2( 40, 0 )
|
||||
|
||||
[node name="BackgroundImageLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_top = 157.0
|
||||
margin_right = 127.0
|
||||
margin_bottom = 171.0
|
||||
text = "Background image:"
|
||||
|
||||
[node name="BackgroundImage" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 137.0
|
||||
margin_top = 144.0
|
||||
margin_right = 537.0
|
||||
margin_bottom = 184.0
|
||||
text = "Image will be left blank."
|
||||
editable = false
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="UseEmptyBackground" type="CheckButton" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 547.0
|
||||
margin_top = 144.0
|
||||
margin_right = 782.0
|
||||
margin_bottom = 184.0
|
||||
pressed = true
|
||||
text = "Use empty background"
|
||||
|
||||
[node name="SelectBackground" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
visible = false
|
||||
margin_left = 564.0
|
||||
margin_top = 144.0
|
||||
margin_right = 693.0
|
||||
margin_bottom = 184.0
|
||||
text = "Select Background"
|
||||
|
||||
[node name="SelectBackgroundSpacer" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 792.0
|
||||
margin_top = 144.0
|
||||
margin_right = 992.0
|
||||
margin_bottom = 184.0
|
||||
rect_min_size = Vector2( 40, 0 )
|
||||
|
||||
[node name="RoomFolderLabel" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_top = 193.0
|
||||
margin_right = 127.0
|
||||
margin_bottom = 207.0
|
||||
text = "Room folder parent:"
|
||||
|
||||
[node name="RoomFolder" type="LineEdit" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 137.0
|
||||
margin_top = 188.0
|
||||
margin_right = 537.0
|
||||
margin_bottom = 212.0
|
||||
hint_tooltip = "A folder (<Global ID>) for your room will be created inside this parent folder."
|
||||
text = "res://game/rooms"
|
||||
editable = false
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="ChangeRoomFolderButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 547.0
|
||||
margin_top = 188.0
|
||||
margin_right = 782.0
|
||||
margin_bottom = 212.0
|
||||
text = "Change Room Folder"
|
||||
|
||||
[node name="Spacer8" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer"]
|
||||
margin_left = 792.0
|
||||
margin_top = 188.0
|
||||
margin_right = 992.0
|
||||
margin_bottom = 212.0
|
||||
rect_min_size = Vector2( 40, 0 )
|
||||
|
||||
[node name="PreviewSection" type="Control" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
margin_top = 260.0
|
||||
margin_right = 1000.0
|
||||
margin_bottom = 660.0
|
||||
rect_min_size = Vector2( 1000, 400 )
|
||||
|
||||
[node name="PreviewFrame" type="ColorRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection"]
|
||||
margin_right = 1000.0
|
||||
margin_bottom = 400.0
|
||||
rect_min_size = Vector2( 1000, 400 )
|
||||
color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection"]
|
||||
margin_left = 5.0
|
||||
margin_top = 5.0
|
||||
margin_right = 995.0
|
||||
margin_bottom = 395.0
|
||||
|
||||
[node name="RoomBackground" type="TextureRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection/CenterContainer"]
|
||||
margin_right = 990.0
|
||||
margin_bottom = 390.0
|
||||
rect_min_size = Vector2( 990, 390 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="BackgroundPreview" type="TextureRect" parent="MarginContainer/MarginContainer/VBoxContainer/PreviewSection"]
|
||||
margin_left = 5.0
|
||||
margin_top = 5.0
|
||||
margin_right = 5.0
|
||||
margin_bottom = 5.0
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
margin_top = 664.0
|
||||
margin_right = 1000.0
|
||||
margin_bottom = 744.0
|
||||
rect_min_size = Vector2( 0, 80 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2"]
|
||||
margin_right = 1000.0
|
||||
margin_bottom = 80.0
|
||||
rect_min_size = Vector2( 800, 80 )
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer"]
|
||||
margin_left = 349.0
|
||||
margin_top = 20.0
|
||||
margin_right = 650.0
|
||||
margin_bottom = 60.0
|
||||
rect_min_size = Vector2( 300, 40 )
|
||||
custom_constants/hseparation = 40
|
||||
columns = 3
|
||||
|
||||
[node name="CreateButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer"]
|
||||
margin_right = 94.0
|
||||
margin_bottom = 20.0
|
||||
text = "Create Room"
|
||||
|
||||
[node name="ClearButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer"]
|
||||
margin_left = 134.0
|
||||
margin_right = 178.0
|
||||
margin_bottom = 20.0
|
||||
text = "Clear"
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer"]
|
||||
margin_left = 218.0
|
||||
margin_right = 301.0
|
||||
margin_bottom = 20.0
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="InformationWindows" type="Control" parent="."]
|
||||
margin_left = 640.0
|
||||
margin_top = 450.0
|
||||
margin_right = 640.0
|
||||
margin_bottom = 450.0
|
||||
|
||||
[node name="PlayerSceneFileDialog" type="FileDialog" parent="InformationWindows"]
|
||||
margin_left = 1400.0
|
||||
margin_top = 1400.0
|
||||
margin_right = 2000.0
|
||||
margin_bottom = 2000.0
|
||||
rect_min_size = Vector2( 600, 600 )
|
||||
popup_exclusive = true
|
||||
window_title = "Open a File"
|
||||
mode = 0
|
||||
filters = PoolStringArray( "*.tscn, *.scn ; Scene Files" )
|
||||
__meta__ = {
|
||||
"_editor_description_": ""
|
||||
}
|
||||
|
||||
[node name="ESCScriptFileDialog" type="FileDialog" parent="InformationWindows"]
|
||||
margin_left = 172.0
|
||||
margin_top = -206.0
|
||||
margin_right = 772.0
|
||||
margin_bottom = 394.0
|
||||
rect_min_size = Vector2( 600, 600 )
|
||||
popup_exclusive = true
|
||||
window_title = "Open a File"
|
||||
mode = 0
|
||||
filters = PoolStringArray( "*.esc; Escoria script files" )
|
||||
__meta__ = {
|
||||
"_editor_description_": ""
|
||||
}
|
||||
|
||||
[node name="BackgroundImageFileDialog" type="FileDialog" parent="InformationWindows"]
|
||||
margin_left = 1400.0
|
||||
margin_top = 1400.0
|
||||
margin_right = 2000.0
|
||||
margin_bottom = 2000.0
|
||||
rect_min_size = Vector2( 600, 600 )
|
||||
popup_exclusive = true
|
||||
window_title = "Open a File"
|
||||
mode = 0
|
||||
filters = PoolStringArray( "*.png, *.jpg, *.jpeg ; Supported Images" )
|
||||
|
||||
[node name="ClearConfirmationDialog" type="ConfirmationDialog" parent="InformationWindows"]
|
||||
margin_right = 353.0
|
||||
margin_bottom = 92.0
|
||||
popup_exclusive = true
|
||||
dialog_text = "WARNING!
|
||||
|
||||
If you continue you will lose the current room setup."
|
||||
|
||||
[node name="MainMenuConfirmationDialog" type="ConfirmationDialog" parent="InformationWindows"]
|
||||
margin_right = 353.0
|
||||
margin_bottom = 92.0
|
||||
popup_exclusive = true
|
||||
dialog_text = "WARNING!
|
||||
|
||||
If you continue you will lose the current room setup."
|
||||
|
||||
[node name="GenericErrorDialog" type="AcceptDialog" parent="InformationWindows"]
|
||||
margin_right = 83.0
|
||||
margin_bottom = 58.0
|
||||
popup_exclusive = true
|
||||
dialog_text = "ERROR!
|
||||
|
||||
Please supply a name for the room."
|
||||
|
||||
[node name="CreateCompleteDialog" type="AcceptDialog" parent="InformationWindows"]
|
||||
margin_right = 83.0
|
||||
margin_bottom = 58.0
|
||||
popup_exclusive = true
|
||||
window_title = "Export Complete"
|
||||
dialog_text = "The room has been created."
|
||||
|
||||
[node name="RoomFolderDialog" type="FileDialog" parent="InformationWindows"]
|
||||
margin_left = -279.0
|
||||
margin_top = -343.0
|
||||
margin_right = 321.0
|
||||
margin_bottom = 257.0
|
||||
rect_min_size = Vector2( 600, 600 )
|
||||
popup_exclusive = true
|
||||
window_title = "Open a Directory"
|
||||
mode = 2
|
||||
|
||||
[connection signal="text_changed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/RoomName" to="." method="_on_RoomName_text_changed"]
|
||||
[connection signal="text_changed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/GlobalID" to="." method="_on_GlobalID_text_changed"]
|
||||
[connection signal="toggled" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/UseEmptyPlayerButton" to="." method="_on_UseEmptyPlayerButton_toggled"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/SelectPlayerScene" to="." method="_on_SelectPlayerScene_pressed"]
|
||||
[connection signal="toggled" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/UseEmptyRoomScript" to="." method="_on_UseEmptyRoomScript_toggled"]
|
||||
[connection signal="toggled" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/UseEmptyBackground" to="." method="_on_UseEmptyBackground_toggled"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/SelectBackground" to="." method="_on_SelectBackground_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer/GridContainer/ChangeRoomFolderButton" to="." method="_on_ChangeRoomFolderButton_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer/CreateButton" to="." method="_on_CreateButton_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer/ClearButton" to="." method="_on_ClearButton_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/MarginContainer2/CenterContainer/GridContainer/MainMenuButton" to="." method="_on_MainMenuButton_pressed"]
|
||||
[connection signal="file_selected" from="InformationWindows/PlayerSceneFileDialog" to="." method="_on_PlayerSceneFileDialog_file_selected"]
|
||||
[connection signal="file_selected" from="InformationWindows/ESCScriptFileDialog" to="." method="_on_ESCScriptFileDialog_file_selected"]
|
||||
[connection signal="file_selected" from="InformationWindows/BackgroundImageFileDialog" to="." method="_on_BackgroundImageFileDialog_file_selected"]
|
||||
[connection signal="confirmed" from="InformationWindows/ClearConfirmationDialog" to="." method="_on_ClearConfirmationDialog_confirmed"]
|
||||
[connection signal="confirmed" from="InformationWindows/MainMenuConfirmationDialog" to="." method="_on_MainMenuConfirmationDialog_confirmed"]
|
||||
[connection signal="dir_selected" from="InformationWindows/RoomFolderDialog" to="." method="_on_RoomFolderDialog_dir_selected"]
|
||||
BIN
addons/escoria-wizard/background.pdn
Normal file
44
addons/escoria-wizard/draw_frame_rects.gd
Normal file
@@ -0,0 +1,44 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
const grid_colour = Color.brown
|
||||
const highlight_colour = Color.gold #fuchsia
|
||||
|
||||
# Number of rows to break the spritesheet into
|
||||
export var total_num_rows:int
|
||||
# Number of columns to break the spritesheet into
|
||||
export var total_num_columns:int
|
||||
# First animation cell. Boxes will be drawn around every cell from the start_cell to end_cell.
|
||||
export var start_cell:int
|
||||
# Last animation cell. Boxes will be drawn around every cell from the start_cell to end_cell.
|
||||
export var end_cell:int
|
||||
# The size of each animation cell in pixels.
|
||||
export var cell_size:Vector2
|
||||
# Zoom factor
|
||||
export var zoom_factor:float
|
||||
|
||||
# This function will calculate where on the spritesheet the start and end frames for an animation
|
||||
# are, and draw boxes around all used frames. The visual indicator makes frame selection easier.
|
||||
func _draw() -> void:
|
||||
if start_cell > 0:
|
||||
# Draw grid for all frames in the spritesheet
|
||||
for yloop in range(total_num_rows):
|
||||
for xloop in range(total_num_columns):
|
||||
var corner1 = Vector2(xloop * cell_size.x, yloop * cell_size.y)
|
||||
var corner2 = Vector2(corner1.x + cell_size.x, corner1.y + cell_size.y)
|
||||
draw_line(Vector2(corner1.x * zoom_factor, corner1.y * zoom_factor), Vector2(corner2.x * zoom_factor, corner1.y * zoom_factor), grid_colour, 2.0, false)
|
||||
draw_line(Vector2(corner1.x * zoom_factor, corner1.y * zoom_factor), Vector2(corner1.x * zoom_factor, corner2.y * zoom_factor), grid_colour, 2.0, false)
|
||||
draw_line(Vector2(corner1.x * zoom_factor, corner2.y * zoom_factor), Vector2(corner2.x * zoom_factor, corner2.y * zoom_factor), grid_colour, 2.0, false)
|
||||
draw_line(Vector2(corner2.x * zoom_factor, corner1.y * zoom_factor), Vector2(corner2.x * zoom_factor, corner2.y * zoom_factor), grid_colour, 2.0, false)
|
||||
|
||||
# Highlight selected frames in the spritesheet
|
||||
for loop in range(end_cell - start_cell + 1):
|
||||
var current_cell = start_cell + loop
|
||||
var frame_row = (current_cell - 1) / total_num_columns
|
||||
var frame_column = (current_cell - 1) % total_num_columns
|
||||
var corner1 = Vector2(frame_column * cell_size.x, frame_row * cell_size.y)
|
||||
var corner2 = Vector2(corner1.x + cell_size.x, corner1.y + cell_size.y)
|
||||
draw_line(Vector2(corner1.x * zoom_factor, corner1.y * zoom_factor), Vector2(corner2.x * zoom_factor, corner1.y * zoom_factor), highlight_colour, 2.0, false)
|
||||
draw_line(Vector2(corner1.x * zoom_factor, corner1.y * zoom_factor), Vector2(corner1.x * zoom_factor, corner2.y * zoom_factor), highlight_colour, false)
|
||||
draw_line(Vector2(corner1.x * zoom_factor, corner2.y * zoom_factor), Vector2(corner2.x * zoom_factor, corner2.y * zoom_factor), highlight_colour, 2.0, false)
|
||||
draw_line(Vector2(corner2.x * zoom_factor, corner1.y * zoom_factor), Vector2(corner2.x * zoom_factor, corner2.y * zoom_factor), highlight_colour, 2.0, false)
|
||||
45
addons/escoria-wizard/escoria_wizard.gd
Normal file
@@ -0,0 +1,45 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
|
||||
const GENERIC_ERROR_NODE = "Menu/InformationWindows/generic_error_window"
|
||||
|
||||
|
||||
# This variable is set by plugin.gd and used to allow the plugin to interact with the Godot
|
||||
# editor (open the ESCPlayer scene in the editor once it's created)
|
||||
var plugin_reference
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
for section_loop in ["RoomCreator", "CharacterCreator", "ItemCreator"]:
|
||||
get_node(section_loop).visible = false
|
||||
|
||||
$Menu.visible = true
|
||||
|
||||
|
||||
func NewGame_pressed() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func NewRoom_pressed() -> void:
|
||||
$Menu.visible = false
|
||||
$RoomCreator.visible = true
|
||||
$RoomCreator.room_creator_reset()
|
||||
|
||||
|
||||
func CharacterCreator_pressed() -> void:
|
||||
$Menu.visible = false
|
||||
$CharacterCreator.visible = true
|
||||
|
||||
if plugin_reference == null:
|
||||
get_node(GENERIC_ERROR_NODE).dialog_text = "Warning!\n\nExporting your character will fail when\n"
|
||||
get_node(GENERIC_ERROR_NODE).dialog_text += "running the character creator directly rather than\n"
|
||||
get_node(GENERIC_ERROR_NODE).dialog_text += "as a plugin.\n\nPlease open this as a plugin."
|
||||
get_node(GENERIC_ERROR_NODE).popup()
|
||||
|
||||
|
||||
func InventoryItem_pressed() -> void:
|
||||
$Menu.visible = false
|
||||
$ItemCreator.visible = true
|
||||
$ItemCreator.inventory_mode = false
|
||||
$ItemCreator.item_creator_reset()
|
||||
101
addons/escoria-wizard/escoria_wizard.tscn
Normal file
@@ -0,0 +1,101 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/background.png" type="Texture" id=1]
|
||||
[ext_resource path="res://addons/escoria-wizard/CharacterCreator.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/escoria-wizard/ItemCreator.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/escoria-wizard/RoomCreator.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/escoria-wizard/escoria_wizard.gd" type="Script" id=38]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/character.png" type="Texture" id=40]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/room.png" type="Texture" id=42]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/inventory.png" type="Texture" id=44]
|
||||
|
||||
[node name="root" type="MarginContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_right = 10.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 38 )
|
||||
|
||||
[node name="background" type="TextureRect" parent="."]
|
||||
margin_right = 1290.0
|
||||
margin_bottom = 900.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource( 1 )
|
||||
expand = true
|
||||
stretch_mode = 2
|
||||
|
||||
[node name="Menu" type="MarginContainer" parent="."]
|
||||
margin_right = 1290.0
|
||||
margin_bottom = 900.0
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="Menu"]
|
||||
margin_right = 1290.0
|
||||
margin_bottom = 900.0
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="Menu/CenterContainer"]
|
||||
margin_left = 549.0
|
||||
margin_top = 325.0
|
||||
margin_right = 740.0
|
||||
margin_bottom = 575.0
|
||||
custom_constants/vseparation = 20
|
||||
|
||||
[node name="NewRoom" type="Button" parent="Menu/CenterContainer/GridContainer"]
|
||||
margin_right = 191.0
|
||||
margin_bottom = 70.0
|
||||
text = "Room Creator"
|
||||
icon = ExtResource( 42 )
|
||||
|
||||
[node name="CharacterCreator" type="Button" parent="Menu/CenterContainer/GridContainer"]
|
||||
margin_top = 90.0
|
||||
margin_right = 191.0
|
||||
margin_bottom = 160.0
|
||||
custom_constants/hseparation = 5
|
||||
text = "Character Creator"
|
||||
icon = ExtResource( 40 )
|
||||
|
||||
[node name="InventoryItem" type="Button" parent="Menu/CenterContainer/GridContainer"]
|
||||
margin_top = 180.0
|
||||
margin_right = 191.0
|
||||
margin_bottom = 250.0
|
||||
custom_constants/hseparation = 5
|
||||
text = "Item Creator"
|
||||
icon = ExtResource( 44 )
|
||||
|
||||
[node name="InformationWindows" type="Control" parent="Menu"]
|
||||
visible = false
|
||||
margin_right = 1290.0
|
||||
margin_bottom = 900.0
|
||||
|
||||
[node name="generic_error_window" type="AcceptDialog" parent="Menu/InformationWindows"]
|
||||
margin_left = 519.0
|
||||
margin_top = 234.0
|
||||
margin_right = 846.0
|
||||
margin_bottom = 394.0
|
||||
input_pass_on_modal_close_click = false
|
||||
popup_exclusive = true
|
||||
dialog_text = "Warning!
|
||||
|
||||
Exporting your character will fail when
|
||||
running the character creator directly rather than
|
||||
as a plugin.
|
||||
|
||||
Please open this as a plugin."
|
||||
|
||||
[node name="RoomCreator" parent="." instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 1290.0
|
||||
margin_bottom = 900.0
|
||||
|
||||
[node name="CharacterCreator" parent="." instance=ExtResource( 2 )]
|
||||
visible = false
|
||||
|
||||
[node name="ItemCreator" parent="." instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
|
||||
[connection signal="pressed" from="Menu/CenterContainer/GridContainer/NewRoom" to="." method="NewRoom_pressed"]
|
||||
[connection signal="pressed" from="Menu/CenterContainer/GridContainer/CharacterCreator" to="." method="CharacterCreator_pressed"]
|
||||
[connection signal="pressed" from="Menu/CenterContainer/GridContainer/InventoryItem" to="." method="InventoryItem_pressed"]
|
||||
BIN
addons/escoria-wizard/graphics/background.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
addons/escoria-wizard/graphics/background_preview.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
addons/escoria-wizard/graphics/character.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
addons/escoria-wizard/graphics/darkgreenarrow_down.png
Normal file
|
After Width: | Height: | Size: 523 B |
BIN
addons/escoria-wizard/graphics/darkgreenarrow_downleft.png
Normal file
|
After Width: | Height: | Size: 726 B |
BIN
addons/escoria-wizard/graphics/darkgreenarrow_downright.png
Normal file
|
After Width: | Height: | Size: 798 B |
BIN
addons/escoria-wizard/graphics/darkgreenarrow_left.png
Normal file
|
After Width: | Height: | Size: 559 B |
BIN
addons/escoria-wizard/graphics/darkgreenarrow_right.png
Normal file
|
After Width: | Height: | Size: 546 B |
BIN
addons/escoria-wizard/graphics/darkgreenarrow_up.png
Normal file
|
After Width: | Height: | Size: 536 B |
BIN
addons/escoria-wizard/graphics/darkgreenarrow_upleft.png
Normal file
|
After Width: | Height: | Size: 824 B |
BIN
addons/escoria-wizard/graphics/darkgreenarrow_upright.png
Normal file
|
After Width: | Height: | Size: 738 B |
BIN
addons/escoria-wizard/graphics/darkgreyarrow_d.png
Normal file
|
After Width: | Height: | Size: 534 B |
BIN
addons/escoria-wizard/graphics/darkgreyarrow_dl.png
Normal file
|
After Width: | Height: | Size: 748 B |
BIN
addons/escoria-wizard/graphics/darkgreyarrow_dr.png
Normal file
|
After Width: | Height: | Size: 816 B |
BIN
addons/escoria-wizard/graphics/darkgreyarrow_l.png
Normal file
|
After Width: | Height: | Size: 612 B |
BIN
addons/escoria-wizard/graphics/darkgreyarrow_r.png
Normal file
|
After Width: | Height: | Size: 599 B |
BIN
addons/escoria-wizard/graphics/darkgreyarrow_u.png
Normal file
|
After Width: | Height: | Size: 564 B |
BIN
addons/escoria-wizard/graphics/darkgreyarrow_ul.png
Normal file
|
After Width: | Height: | Size: 897 B |
BIN
addons/escoria-wizard/graphics/darkgreyarrow_ur.png
Normal file
|
After Width: | Height: | Size: 779 B |
BIN
addons/escoria-wizard/graphics/greenarrow_down.png
Normal file
|
After Width: | Height: | Size: 466 B |
BIN
addons/escoria-wizard/graphics/greenarrow_downleft.png
Normal file
|
After Width: | Height: | Size: 745 B |
BIN
addons/escoria-wizard/graphics/greenarrow_downright.png
Normal file
|
After Width: | Height: | Size: 812 B |
BIN
addons/escoria-wizard/graphics/greenarrow_left.png
Normal file
|
After Width: | Height: | Size: 426 B |
BIN
addons/escoria-wizard/graphics/greenarrow_right.png
Normal file
|
After Width: | Height: | Size: 438 B |
BIN
addons/escoria-wizard/graphics/greenarrow_up.png
Normal file
|
After Width: | Height: | Size: 491 B |
BIN
addons/escoria-wizard/graphics/greenarrow_upleft.png
Normal file
|
After Width: | Height: | Size: 843 B |
BIN
addons/escoria-wizard/graphics/greenarrow_upright.png
Normal file
|
After Width: | Height: | Size: 740 B |
BIN
addons/escoria-wizard/graphics/greyarrow_d.png
Normal file
|
After Width: | Height: | Size: 531 B |
BIN
addons/escoria-wizard/graphics/greyarrow_dl.png
Normal file
|
After Width: | Height: | Size: 766 B |
BIN
addons/escoria-wizard/graphics/greyarrow_dr.png
Normal file
|
After Width: | Height: | Size: 854 B |
BIN
addons/escoria-wizard/graphics/greyarrow_l.png
Normal file
|
After Width: | Height: | Size: 589 B |
BIN
addons/escoria-wizard/graphics/greyarrow_r.png
Normal file
|
After Width: | Height: | Size: 584 B |
BIN
addons/escoria-wizard/graphics/greyarrow_u.png
Normal file
|
After Width: | Height: | Size: 560 B |
BIN
addons/escoria-wizard/graphics/greyarrow_ul.png
Normal file
|
After Width: | Height: | Size: 888 B |
BIN
addons/escoria-wizard/graphics/greyarrow_ur.png
Normal file
|
After Width: | Height: | Size: 809 B |
BIN
addons/escoria-wizard/graphics/help/help_background.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
addons/escoria-wizard/graphics/help/left1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
addons/escoria-wizard/graphics/help/left2.png
Normal file
|
After Width: | Height: | Size: 429 B |
BIN
addons/escoria-wizard/graphics/help/left3.png
Normal file
|
After Width: | Height: | Size: 428 B |
BIN
addons/escoria-wizard/graphics/help/left4.png
Normal file
|
After Width: | Height: | Size: 573 B |
BIN
addons/escoria-wizard/graphics/help/left5.png
Normal file
|
After Width: | Height: | Size: 647 B |
BIN
addons/escoria-wizard/graphics/help/leftall.png
Normal file
|
After Width: | Height: | Size: 167 B |
BIN
addons/escoria-wizard/graphics/help/middle1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
addons/escoria-wizard/graphics/help/middle2.png
Normal file
|
After Width: | Height: | Size: 407 B |
BIN
addons/escoria-wizard/graphics/help/middle3.png
Normal file
|
After Width: | Height: | Size: 420 B |
BIN
addons/escoria-wizard/graphics/help/middleall.png
Normal file
|
After Width: | Height: | Size: 171 B |
BIN
addons/escoria-wizard/graphics/help/right1.png
Normal file
|
After Width: | Height: | Size: 322 B |
BIN
addons/escoria-wizard/graphics/help/right2.png
Normal file
|
After Width: | Height: | Size: 453 B |
BIN
addons/escoria-wizard/graphics/help/right3.png
Normal file
|
After Width: | Height: | Size: 364 B |
BIN
addons/escoria-wizard/graphics/help/right4.png
Normal file
|
After Width: | Height: | Size: 360 B |
BIN
addons/escoria-wizard/graphics/help/right5.png
Normal file
|
After Width: | Height: | Size: 384 B |
BIN
addons/escoria-wizard/graphics/help/rightall.png
Normal file
|
After Width: | Height: | Size: 162 B |
BIN
addons/escoria-wizard/graphics/icon.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
addons/escoria-wizard/graphics/icon16x16.png
Normal file
|
After Width: | Height: | Size: 241 B |
BIN
addons/escoria-wizard/graphics/inventory.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
addons/escoria-wizard/graphics/inventory_preview.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
addons/escoria-wizard/graphics/mark-animtest.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
addons/escoria-wizard/graphics/no_animation.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
addons/escoria-wizard/graphics/no_spritesheet.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
addons/escoria-wizard/graphics/object_preview.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
addons/escoria-wizard/graphics/robot/idle_all.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
addons/escoria-wizard/graphics/robot/open_all.png
Normal file
|
After Width: | Height: | Size: 343 KiB |
BIN
addons/escoria-wizard/graphics/robot/talk_down.png
Normal file
|
After Width: | Height: | Size: 126 KiB |
BIN
addons/escoria-wizard/graphics/robot/talk_downleft.png
Normal file
|
After Width: | Height: | Size: 176 KiB |
BIN
addons/escoria-wizard/graphics/robot/talk_downright.png
Normal file
|
After Width: | Height: | Size: 169 KiB |
BIN
addons/escoria-wizard/graphics/robot/talk_right.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
addons/escoria-wizard/graphics/robot/talk_up.png
Normal file
|
After Width: | Height: | Size: 137 KiB |
BIN
addons/escoria-wizard/graphics/robot/talk_upright.png
Normal file
|
After Width: | Height: | Size: 156 KiB |
BIN
addons/escoria-wizard/graphics/robot/walk_down.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
addons/escoria-wizard/graphics/robot/walk_downleft.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
addons/escoria-wizard/graphics/robot/walk_downright.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
addons/escoria-wizard/graphics/robot/walk_right.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
addons/escoria-wizard/graphics/robot/walk_up.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
addons/escoria-wizard/graphics/robot/walk_upright.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
addons/escoria-wizard/graphics/room.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
addons/escoria-wizard/graphics/roomitem.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
addons/escoria-wizard/graphics/wand.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
56
addons/escoria-wizard/help_window.gd
Normal file
@@ -0,0 +1,56 @@
|
||||
tool
|
||||
extends WindowDialog
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
|
||||
const LAST_PAGE = 15
|
||||
|
||||
export var current_page = 1
|
||||
|
||||
|
||||
func help_on_prev_button_pressed() -> void:
|
||||
current_page -= 1
|
||||
if current_page < 1:
|
||||
current_page = 1
|
||||
show_page()
|
||||
|
||||
|
||||
func help_on_next_button_pressed() -> void:
|
||||
current_page += 1
|
||||
if current_page > LAST_PAGE:
|
||||
current_page = LAST_PAGE
|
||||
show_page()
|
||||
|
||||
|
||||
func show_page() -> void:
|
||||
for loop in get_tree().get_nodes_in_group("masks"):
|
||||
loop.visible = false
|
||||
for loop in get_tree().get_nodes_in_group("pagetext"):
|
||||
loop.visible = false
|
||||
|
||||
$masks/leftall.visible = true
|
||||
$masks/middleall.visible = true
|
||||
$masks/rightall.visible = true
|
||||
|
||||
get_node("masks").get_node("page%s" % current_page).visible = true
|
||||
get_node("text").get_node("page%s" % current_page).visible = true
|
||||
|
||||
match current_page:
|
||||
2: $masks/leftall.visible = false
|
||||
3: $masks/rightall.visible = false
|
||||
4: $masks/leftall.visible = false
|
||||
5: $masks/leftall.visible = false
|
||||
6: $masks/leftall.visible = false
|
||||
7: $masks/leftall.visible = false
|
||||
8: $masks/middleall.visible = false
|
||||
9: $masks/middleall.visible = false
|
||||
10: $masks/middleall.visible = false
|
||||
11: $masks/rightall.visible = false
|
||||
12: $masks/rightall.visible = false
|
||||
13: $masks/rightall.visible = false
|
||||
14: $masks/rightall.visible = false
|
||||
|
||||
|
||||
533
addons/escoria-wizard/help_window.tscn
Normal file
@@ -0,0 +1,533 @@
|
||||
[gd_scene load_steps=19 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/left3.png" type="Texture" id=1]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/left4.png" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/left5.png" type="Texture" id=3]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/middle3.png" type="Texture" id=4]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/right4.png" type="Texture" id=5]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/middleall.png" type="Texture" id=6]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/middle2.png" type="Texture" id=7]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/left2.png" type="Texture" id=8]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/rightall.png" type="Texture" id=9]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/right5.png" type="Texture" id=10]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/right2.png" type="Texture" id=11]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/right3.png" type="Texture" id=12]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/leftall.png" type="Texture" id=13]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/help_background.png" type="Texture" id=14]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/left1.png" type="Texture" id=15]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/middle1.png" type="Texture" id=16]
|
||||
[ext_resource path="res://addons/escoria-wizard/graphics/help/right1.png" type="Texture" id=17]
|
||||
[ext_resource path="res://addons/escoria-wizard/help_window.gd" type="Script" id=18]
|
||||
|
||||
[node name="help_window" type="WindowDialog"]
|
||||
margin_left = 100.0
|
||||
margin_top = 100.0
|
||||
margin_right = 1012.0
|
||||
margin_bottom = 742.0
|
||||
popup_exclusive = true
|
||||
script = ExtResource( 18 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 908.0
|
||||
margin_bottom = 638.0
|
||||
|
||||
[node name="Background" type="TextureRect" parent="VBoxContainer"]
|
||||
margin_right = 904.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 14 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer"]
|
||||
margin_top = 614.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 634.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/CenterContainer"]
|
||||
margin_left = 322.0
|
||||
margin_right = 581.0
|
||||
margin_bottom = 20.0
|
||||
|
||||
[node name="prev_button" type="Button" parent="VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
margin_right = 118.0
|
||||
margin_bottom = 20.0
|
||||
text = "<- Previous Page"
|
||||
|
||||
[node name="Control" type="Control" parent="VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
margin_left = 122.0
|
||||
margin_right = 162.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 40, 20 )
|
||||
|
||||
[node name="next_button" type="Button" parent="VBoxContainer/CenterContainer/HBoxContainer"]
|
||||
margin_left = 166.0
|
||||
margin_right = 259.0
|
||||
margin_bottom = 20.0
|
||||
text = "Next Page ->"
|
||||
|
||||
[node name="masks" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="leftall" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 309.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 13 )
|
||||
|
||||
[node name="middleall" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 324.0
|
||||
margin_top = 8.0
|
||||
margin_right = 663.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
[node name="rightall" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 678.0
|
||||
margin_top = 8.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 9 )
|
||||
|
||||
[node name="page1" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 305.0
|
||||
margin_bottom = 606.0
|
||||
|
||||
[node name="page2" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 309.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 15 )
|
||||
|
||||
[node name="page3" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 678.0
|
||||
margin_top = 8.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 17 )
|
||||
|
||||
[node name="page4" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 309.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 8 )
|
||||
|
||||
[node name="page5" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 309.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="page6" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 309.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="page7" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 309.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="page8" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 324.0
|
||||
margin_top = 8.0
|
||||
margin_right = 663.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 16 )
|
||||
|
||||
[node name="page9" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 324.0
|
||||
margin_top = 8.0
|
||||
margin_right = 663.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 7 )
|
||||
|
||||
[node name="page10" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 324.0
|
||||
margin_top = 8.0
|
||||
margin_right = 663.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 4 )
|
||||
|
||||
[node name="page11" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 678.0
|
||||
margin_top = 8.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 11 )
|
||||
|
||||
[node name="page12" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 678.0
|
||||
margin_top = 8.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 12 )
|
||||
|
||||
[node name="page13" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 678.0
|
||||
margin_top = 8.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 5 )
|
||||
|
||||
[node name="page14" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.882353 )
|
||||
margin_left = 678.0
|
||||
margin_top = 8.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 610.0
|
||||
texture = ExtResource( 10 )
|
||||
|
||||
[node name="page15" type="TextureRect" parent="masks" groups=["masks"]]
|
||||
visible = false
|
||||
modulate = Color( 1, 1, 1, 0.784314 )
|
||||
margin_left = 678.0
|
||||
margin_top = 8.0
|
||||
margin_right = 979.0
|
||||
margin_bottom = 610.0
|
||||
|
||||
[node name="text" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="page1" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 229.0
|
||||
margin_top = 137.0
|
||||
margin_right = 699.0
|
||||
margin_bottom = 440.0
|
||||
text = "Escoria Player Creator
|
||||
|
||||
Game characters in Escoria are Godot scenes with an ESCPlayer node.
|
||||
The ESCPlayer requires configuration to define things like how many
|
||||
directions the character has animations defined for, and which
|
||||
movement direction in the game world corresponds to each animation.
|
||||
|
||||
While Escoria can create characters that can move in as many
|
||||
directions as you like, most games will feature characters that can
|
||||
move in either 4 or 8 directions. For each direction, walk, talk and idle
|
||||
animations are required. This tool simplifies the process for configuring
|
||||
all these settings.
|
||||
|
||||
These help pages will guide you through the process, but essentially you
|
||||
give your character a name, choose 4 or 8 directions, then choose frames
|
||||
from sprite sheets for walk, talk and idle animations in each direction.
|
||||
|
||||
Click the \"Next Page\" button below to progress to the next help page."
|
||||
|
||||
[node name="page2" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 301.0
|
||||
margin_top = 6.0
|
||||
margin_right = 657.0
|
||||
margin_bottom = 156.0
|
||||
text = "Use the name field to supply a name for your character.
|
||||
Any changes to the name will be reflected to the
|
||||
global_id field. The global_id is used to identify the
|
||||
character in scripts.
|
||||
|
||||
Note that you can change the global_id to be different
|
||||
from the name if you choose. It's generally easiest
|
||||
to keep them the same but there's no requirement to.
|
||||
"
|
||||
|
||||
[node name="page3" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 299.0
|
||||
margin_top = 10.0
|
||||
margin_right = 654.0
|
||||
margin_bottom = 194.0
|
||||
text = "Use the \"Load Spritesheet\" button to load a spritesheet
|
||||
graphic. The spritesheet is an image that contains one
|
||||
or more sprite frames that will be used for the walk,
|
||||
talk and/or idle animation frames for the character.
|
||||
|
||||
The character creator remembers which spritesheet is
|
||||
used for each type and direction of animation, so you
|
||||
can use one spritesheet for all the animations, one
|
||||
spritesheet per animation, or any combination
|
||||
inbetween.
|
||||
"
|
||||
|
||||
[node name="page4" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 298.0
|
||||
margin_top = 59.0
|
||||
margin_right = 591.0
|
||||
margin_bottom = 124.0
|
||||
text = "Use these buttons to indicate whether your
|
||||
character will have animations facing in either
|
||||
4 or 8 directions. This can be changed at any
|
||||
time while creating the character."
|
||||
|
||||
[node name="page5" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 303.0
|
||||
margin_top = 105.0
|
||||
margin_right = 596.0
|
||||
margin_bottom = 170.0
|
||||
text = "You will use these buttons to choose whether
|
||||
you are currently creating walk, talk, or idle
|
||||
animations."
|
||||
|
||||
[node name="page6" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 133.0
|
||||
margin_top = 126.0
|
||||
margin_right = 523.0
|
||||
margin_bottom = 378.0
|
||||
text = "Click the arrow matching the direction you wish to create
|
||||
an animation for. For example, if you select walk from the
|
||||
options above, and the right arrow, you'll be creating the
|
||||
animation for the character walking right.
|
||||
|
||||
Once you store (save) the animation, the arrow will change
|
||||
to a green colour to show you the animation has been
|
||||
configured. It can still be edited once it has been stored.
|
||||
|
||||
When you select an direction that isn't up or down, the
|
||||
mirror button will appear. If you click this button, the
|
||||
animation will be created automatically as a mirror of the
|
||||
opposite side's animation. e.g. If you create the right side
|
||||
animation, you can click the left arrow then the mirror
|
||||
button to quickly create the left hand animation."
|
||||
|
||||
[node name="page7" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 63.0
|
||||
margin_top = 369.0
|
||||
margin_right = 334.0
|
||||
margin_bottom = 417.0
|
||||
text = "When you select the animation frames to
|
||||
define a particular animation, a preview
|
||||
of the animation will be shown in this box."
|
||||
|
||||
[node name="page8" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 37.0
|
||||
margin_top = 21.0
|
||||
margin_right = 308.0
|
||||
margin_bottom = 103.0
|
||||
text = "This is the currently loaded spritesheet.
|
||||
As you select particular frames to be
|
||||
part of the current animation, a box will
|
||||
be drawn around them to help you see
|
||||
what is included in the animation."
|
||||
|
||||
[node name="page9" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 339.0
|
||||
margin_top = 422.0
|
||||
margin_right = 610.0
|
||||
margin_bottom = 538.0
|
||||
text = "Use this slider to reset the zoom level
|
||||
on the spritesheet. The zoom is only
|
||||
used in this tool and will not affect the
|
||||
zoom level of your character in game.
|
||||
|
||||
Use the reset button to reset the zoom
|
||||
level."
|
||||
|
||||
[node name="page10" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 354.0
|
||||
margin_top = 511.0
|
||||
margin_right = 594.0
|
||||
margin_bottom = 559.0
|
||||
text = "This information window tells you the
|
||||
filename of the currently loaded
|
||||
spritesheet."
|
||||
|
||||
[node name="page11" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 297.0
|
||||
margin_top = 28.0
|
||||
margin_right = 622.0
|
||||
margin_bottom = 229.0
|
||||
text = "Once you've loaded your spritesheet you need to
|
||||
tell the character creator how to divide it into
|
||||
individual frames with the horizontal/vertical
|
||||
frames selectors.
|
||||
|
||||
The start/end frame selectors tell the tool which
|
||||
frames to use from the spritesheet to create the
|
||||
animation.
|
||||
|
||||
The speed slider defines the speed of this
|
||||
animation in frames per second. Each animation
|
||||
can have a different speed value if desired."
|
||||
|
||||
[node name="page12" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 374.0
|
||||
margin_top = 124.0
|
||||
margin_right = 651.0
|
||||
margin_bottom = 189.0
|
||||
text = "These lines are informational. They tell you
|
||||
how big the current spritesheet is, and how
|
||||
big each animation frame is based on the
|
||||
frame settings above."
|
||||
|
||||
[node name="page13" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 374.0
|
||||
margin_top = 171.0
|
||||
margin_right = 648.0
|
||||
margin_bottom = 321.0
|
||||
text = "When you change the settings for the
|
||||
current animation, the \"store animation\"
|
||||
button will appear. This saves the current
|
||||
settings to the selected animation.
|
||||
|
||||
If the settings are changed back to how
|
||||
they were, the store button will
|
||||
disappear to tell you that there is currently
|
||||
no change to save."
|
||||
|
||||
[node name="page14" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 332.0
|
||||
margin_top = 228.0
|
||||
margin_right = 660.0
|
||||
margin_bottom = 429.0
|
||||
text = "Click this button to export the completed character
|
||||
out to a Godot scene for use by Escoria.
|
||||
Note that a walk, talk and idle animation for each of
|
||||
the specified (4 or 8) directions must have been
|
||||
set up before you can export the character.
|
||||
|
||||
If any animations haven't been configured, it will
|
||||
tell you that animations are missing.
|
||||
|
||||
Direction arrows that haven't turned green are a
|
||||
visual indicator of the directions still requiring
|
||||
animations."
|
||||
|
||||
[node name="page15" type="Label" parent="text" groups=["pagetext"]]
|
||||
visible = false
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 273.0
|
||||
margin_top = 143.0
|
||||
margin_right = 663.0
|
||||
margin_bottom = 412.0
|
||||
text = "Once you have exported your character they will be a saved
|
||||
ESCPlayer scene in your filesystem. The scene will be named
|
||||
based on the name you gave your character in the Name
|
||||
field.
|
||||
|
||||
If this is a user-controllable character, this character can now
|
||||
be included in your game by :
|
||||
|
||||
* Creating a Godot scene for your room
|
||||
* Creating an ESCRoom node
|
||||
* Selecting the created ESCPlayer scene as the Player Scene
|
||||
property in that node.
|
||||
|
||||
If they are an NPC, add the scene to your scene tree, and
|
||||
program them in your ESC scripts using the global_id you
|
||||
have configured."
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/CenterContainer/HBoxContainer/prev_button" to="." method="help_on_prev_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/CenterContainer/HBoxContainer/next_button" to="." method="help_on_next_button_pressed"]
|
||||
283
addons/escoria-wizard/item_creator.gd
Normal file
@@ -0,0 +1,283 @@
|
||||
tool
|
||||
extends MarginContainer
|
||||
|
||||
|
||||
const ITEM_NAME_NODE = "VBoxContainer/Content/GridContainer/ItemName"
|
||||
const GLOBAL_ID_NODE = "VBoxContainer/Content/GridContainer/ItemGlobalID"
|
||||
const INTERACTIVE_NODE = "VBoxContainer/Content/GridContainer/StartsInteractiveCheckBox"
|
||||
const ACTION_NODE = "VBoxContainer/Content/GridContainer/DefaultActionOption"
|
||||
const PREVIEW_NODE = "VBoxContainer/Content/GridContainer/Preview/Preview"
|
||||
const IMAGE_SIZE_NODE = "VBoxContainer/Content/GridContainer/ImageSize"
|
||||
const IMAGE_PATH_NODE = "VBoxContainer/Content/GridContainer/ImagePath"
|
||||
const LOAD_NODE = "LoadObjectGraphic/LoadObjectFileDialog"
|
||||
const CONFIRM_NODE = "Windows/ConfirmationDialog"
|
||||
const OBJECT_HEADING_NODE = "VBoxContainer/HelperHeading/CenterContainer/ObjectHeading"
|
||||
const OBJECT_DESC_NODE = "VBoxContainer/Description/ObjectDescription"
|
||||
const INVENTORY_HEADING_NODE = "VBoxContainer/HelperHeading/CenterContainer/InventoryHeading"
|
||||
const INVENTORY_DESC_NODE = "VBoxContainer/Description/InventoryDescription"
|
||||
const INVENTORY_PATH_NODE = "VBoxContainer/Content/GridContainer/InventoryPath"
|
||||
const INVENTORY_PATH_LABEL_NODE = "VBoxContainer/Content/GridContainer/InventoryPathLabel"
|
||||
const INVENTORY_PATH_SPACER_NODE = "VBoxContainer/Content/GridContainer/BlankItem7"
|
||||
const CREATE_BUTTON_NODE = "VBoxContainer/Buttons/CenterContainer/HBoxContainer/CreateButton"
|
||||
const ERROR_WINDOW_NODE = "Windows/ErrorDialog"
|
||||
const INVENTORY_PREV_NODE = "VBoxContainer/Content/GridContainer/Preview/InventoryPreview"
|
||||
const OBJECT_PREV_NODE = "VBoxContainer/Content/GridContainer/Preview/ObjectPreview"
|
||||
|
||||
|
||||
var source_image:Image
|
||||
var image_stream_texture:StreamTexture
|
||||
var image_has_been_loaded:bool
|
||||
var image_size:Vector2
|
||||
var main_menu_requested:bool
|
||||
var inventory_mode:bool
|
||||
var settings_modified:bool
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
inventory_mode = false
|
||||
item_creator_reset()
|
||||
|
||||
|
||||
func item_creator_reset() -> void:
|
||||
get_node(ITEM_NAME_NODE).text = "replace_me"
|
||||
get_node(GLOBAL_ID_NODE).text = ""
|
||||
get_node(IMAGE_PATH_NODE).text = ""
|
||||
get_node(INTERACTIVE_NODE).pressed = true
|
||||
|
||||
if get_node(ACTION_NODE).get_item_count() > 0:
|
||||
get_node(ACTION_NODE).clear()
|
||||
|
||||
for option_list in ["look", "pick up", "open", "close", "use", "push", "pull", "talk"]:
|
||||
get_node(ACTION_NODE).add_item(option_list)
|
||||
|
||||
get_node(ACTION_NODE).selected = 0
|
||||
image_size = Vector2.ZERO
|
||||
image_has_been_loaded = false
|
||||
main_menu_requested = false
|
||||
settings_modified = false
|
||||
get_node(PREVIEW_NODE).texture = null
|
||||
|
||||
if inventory_mode:
|
||||
get_node(INVENTORY_PATH_NODE).text = ProjectSettings.get_setting("escoria/ui/inventory_items_path")
|
||||
get_node(CREATE_BUTTON_NODE).text = "Create Inventory"
|
||||
get_node(INVENTORY_PREV_NODE).visible = true
|
||||
get_node(OBJECT_PREV_NODE).visible = false
|
||||
|
||||
for loop in [INVENTORY_PATH_NODE, INVENTORY_PATH_LABEL_NODE, INVENTORY_PATH_SPACER_NODE]:
|
||||
get_node(loop).visible = true
|
||||
else:
|
||||
get_node(CREATE_BUTTON_NODE).text = "Create Object"
|
||||
get_node(INVENTORY_PREV_NODE).visible = false
|
||||
get_node(OBJECT_PREV_NODE).visible = true
|
||||
for loop in [INVENTORY_PATH_NODE, INVENTORY_PATH_LABEL_NODE, INVENTORY_PATH_SPACER_NODE]:
|
||||
get_node(loop).visible = false
|
||||
|
||||
for loop in [OBJECT_HEADING_NODE, OBJECT_DESC_NODE]:
|
||||
get_node(loop).visible = not inventory_mode
|
||||
|
||||
for loop in [INVENTORY_HEADING_NODE, INVENTORY_DESC_NODE, INVENTORY_PATH_NODE]:
|
||||
get_node(loop).visible = inventory_mode
|
||||
|
||||
|
||||
func resize_image() -> void:
|
||||
var preview_size = get_node(PREVIEW_NODE).rect_size
|
||||
|
||||
# Calculate the scale to make the preview as big as possible in the preview window depending on
|
||||
# the height to width ratio of the frame
|
||||
image_size = image_stream_texture.get_size()
|
||||
var preview_scale = Vector2.ONE
|
||||
preview_scale.x = preview_size.x / image_size.x
|
||||
preview_scale.y = preview_size.y / image_size.y
|
||||
|
||||
if preview_scale.y > preview_scale.x:
|
||||
get_node(PREVIEW_NODE).rect_scale = Vector2(preview_scale.x, preview_scale.x)
|
||||
else:
|
||||
get_node(PREVIEW_NODE).rect_scale = Vector2(preview_scale.y, preview_scale.y)
|
||||
|
||||
|
||||
func background_on_ItemName_text_changed(new_text: String) -> void:
|
||||
get_node(GLOBAL_ID_NODE).text = new_text
|
||||
settings_modified = true
|
||||
|
||||
|
||||
func load_button_pressed() -> void:
|
||||
get_node(LOAD_NODE).popup_centered()
|
||||
|
||||
|
||||
func LoadObjectFileDialog_file_selected(path: String) -> void:
|
||||
image_stream_texture = load(path)
|
||||
|
||||
get_node(PREVIEW_NODE).texture = image_stream_texture
|
||||
|
||||
resize_image()
|
||||
|
||||
get_node(IMAGE_SIZE_NODE).text = "(%s, %s)" % [image_size.x, image_size.y]
|
||||
|
||||
get_node(IMAGE_PATH_NODE).text = path
|
||||
image_has_been_loaded = true
|
||||
settings_modified = true
|
||||
get_node(INVENTORY_PREV_NODE).visible = false
|
||||
get_node(OBJECT_PREV_NODE).visible = false
|
||||
|
||||
|
||||
func _on_CreateButton_pressed() -> void:
|
||||
if not image_has_been_loaded:
|
||||
get_node(ERROR_WINDOW_NODE).dialog_text = \
|
||||
"No image has been loaded."
|
||||
get_node(ERROR_WINDOW_NODE).popup_centered()
|
||||
return
|
||||
|
||||
if get_node(ITEM_NAME_NODE).text == "replace_me":
|
||||
get_node(ERROR_WINDOW_NODE).dialog_text = \
|
||||
"Please change the object name."
|
||||
get_node(ERROR_WINDOW_NODE).popup_centered()
|
||||
return
|
||||
|
||||
if inventory_mode == false:
|
||||
if not EditorPlugin.new().get_editor_interface().get_selection().get_selected_nodes():
|
||||
get_node(ERROR_WINDOW_NODE).dialog_text = \
|
||||
"Please select a node in the scene tree\nto attach the object to."
|
||||
get_node(ERROR_WINDOW_NODE).popup_centered()
|
||||
return
|
||||
|
||||
var item = ESCItem.new()
|
||||
item.name = get_node(ITEM_NAME_NODE).text
|
||||
item.global_id = get_node(GLOBAL_ID_NODE).text
|
||||
item.is_interactive = get_node(INTERACTIVE_NODE).pressed
|
||||
item.tooltip_name = get_node(ITEM_NAME_NODE).text
|
||||
|
||||
var selected_index = get_node(ACTION_NODE).selected
|
||||
item.default_action = get_node(ACTION_NODE).get_item_text(selected_index)
|
||||
|
||||
# Add Dialog Position to the background item
|
||||
var interact_position = ESCLocation.new()
|
||||
interact_position.name = "interact_position"
|
||||
interact_position.position.y = image_size.y * 2
|
||||
item.add_child(interact_position)
|
||||
|
||||
# Add Collision shape to the background item
|
||||
var rectangle_shape = RectangleShape2D.new()
|
||||
var collision_shape = CollisionShape2D.new()
|
||||
|
||||
collision_shape.shape = rectangle_shape
|
||||
collision_shape.shape.extents = image_size / 2
|
||||
item.add_child(collision_shape)
|
||||
|
||||
# Add sprite to the background item
|
||||
var item_sprite = Sprite.new()
|
||||
item_sprite.texture = get_node(PREVIEW_NODE).texture
|
||||
item.add_child(item_sprite)
|
||||
|
||||
if not inventory_mode:
|
||||
# Create in scene tree
|
||||
# Attach to currently selected node in scene tree
|
||||
var current_node = EditorPlugin.new().get_editor_interface().get_selection().get_selected_nodes()[0]
|
||||
current_node.add_child(item)
|
||||
var owning_node = get_tree().edited_scene_root
|
||||
item.set_owner(owning_node)
|
||||
# Make it so all the nodes can be seen in the scene tree
|
||||
collision_shape.set_owner(owning_node)
|
||||
interact_position.set_owner(owning_node)
|
||||
item_sprite.set_owner(owning_node)
|
||||
|
||||
get_node("Windows/CreateCompleteDialog").dialog_text = \
|
||||
"Background object %s created.\n\n" % item + \
|
||||
"Note that you can right-click the node in the\n" + \
|
||||
"scene tree and select \"Save branch as scene\"\n" + \
|
||||
"if you'd like to reuse this item."
|
||||
print("Background object %s created." % item)
|
||||
get_node("Windows/CreateCompleteDialog").popup_centered()
|
||||
else:
|
||||
get_tree().edited_scene_root.add_child(item)
|
||||
# Make it so all the nodes can be seen in the scene tree
|
||||
collision_shape.set_owner(item)
|
||||
interact_position.set_owner(item)
|
||||
item_sprite.set_owner(item)
|
||||
|
||||
item.set_owner(get_tree().edited_scene_root)
|
||||
# Export scene - create in inventory folder
|
||||
var packed_scene = PackedScene.new()
|
||||
|
||||
packed_scene.pack(get_tree().edited_scene_root.get_node(item.name))
|
||||
var inventory_path = ProjectSettings.get_setting("escoria/ui/inventory_items_path")
|
||||
ResourceSaver.save("%s/%s.tscn" % [inventory_path, get_node(ITEM_NAME_NODE).text], packed_scene)
|
||||
|
||||
# Flag suggestions from https://godotengine.org/qa/50437/how-to-turn-a-node-into-a-packedscene-via-gdscript
|
||||
ResourceSaver.save("%s/%s.tscn" % [inventory_path, get_node(ITEM_NAME_NODE).text], packed_scene, \
|
||||
ResourceSaver.FLAG_CHANGE_PATH|ResourceSaver.FLAG_REPLACE_SUBRESOURCE_PATHS)
|
||||
|
||||
item.queue_free()
|
||||
get_tree().edited_scene_root.get_node(item.name).queue_free()
|
||||
get_node("Windows/CreateCompleteDialog").dialog_text = \
|
||||
"Inventory item %s/%s.tscn created." % [inventory_path, get_node(ITEM_NAME_NODE).text]
|
||||
print("Inventory item %s/%s.tscn created." % [inventory_path, get_node(ITEM_NAME_NODE).text])
|
||||
get_node("Windows/CreateCompleteDialog").popup_centered()
|
||||
|
||||
|
||||
func Item_on_ClearButton_pressed() -> void:
|
||||
if settings_modified == true:
|
||||
main_menu_requested = false
|
||||
get_node(CONFIRM_NODE).dialog_text = "WARNING!\n\n" + \
|
||||
"If you continue you will lose the current object."
|
||||
get_node(CONFIRM_NODE).popup_centered()
|
||||
|
||||
|
||||
func _on_ObjectConfirmationDialog_confirmed() -> void:
|
||||
if main_menu_requested == true:
|
||||
switch_to_main_menu()
|
||||
else:
|
||||
item_creator_reset()
|
||||
|
||||
|
||||
func Item_on_ExitButton_pressed() -> void:
|
||||
if settings_modified == true:
|
||||
main_menu_requested = true
|
||||
get_node(CONFIRM_NODE).dialog_text = "WARNING!\n\n" + \
|
||||
"If you continue you will lose the current object."
|
||||
get_node(CONFIRM_NODE).popup_centered()
|
||||
else:
|
||||
switch_to_main_menu()
|
||||
|
||||
|
||||
func switch_to_main_menu() -> void:
|
||||
get_node("../Menu").visible = true
|
||||
get_node("../ItemCreator").visible = false
|
||||
|
||||
|
||||
func _on_StartsInteractiveCheckBox_pressed() -> void:
|
||||
settings_modified = true
|
||||
|
||||
|
||||
func _on_ItemGlobalID_text_changed(_new_text: String) -> void:
|
||||
settings_modified = true
|
||||
|
||||
|
||||
func _on_DefaultActionOption_item_selected(_index: int) -> void:
|
||||
settings_modified = true
|
||||
|
||||
|
||||
func _on_CreateCompleteDialog_confirmed() -> void:
|
||||
item_creator_reset()
|
||||
|
||||
|
||||
func _on_BackgroundObjectCheckBox_toggled(button_pressed: bool) -> void:
|
||||
if button_pressed == false:
|
||||
$VBoxContainer/Control/CenterContainer/HBoxContainer/InventoryItemCheckBox.set_pressed_no_signal(true)
|
||||
inventory_mode = true
|
||||
else:
|
||||
$VBoxContainer/Control/CenterContainer/HBoxContainer/InventoryItemCheckBox.set_pressed_no_signal(false)
|
||||
inventory_mode = false
|
||||
|
||||
item_creator_reset()
|
||||
|
||||
|
||||
func _on_InventoryItemCheckBox_toggled(button_pressed: bool) -> void:
|
||||
if button_pressed == false:
|
||||
$VBoxContainer/Control/CenterContainer/HBoxContainer/BackgroundObjectCheckBox.set_pressed_no_signal(true)
|
||||
inventory_mode = false
|
||||
else:
|
||||
$VBoxContainer/Control/CenterContainer/HBoxContainer/BackgroundObjectCheckBox.set_pressed_no_signal(false)
|
||||
inventory_mode = true
|
||||
|
||||
item_creator_reset()
|
||||
7
addons/escoria-wizard/plugin.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[plugin]
|
||||
|
||||
name="Escoria Wizard"
|
||||
description="This plugin is used to make the creation of Escoria resources easier for developers."
|
||||
author="BalloonPopper"
|
||||
version="1.0.0"
|
||||
script="plugin.gd"
|
||||
41
addons/escoria-wizard/plugin.gd
Normal file
@@ -0,0 +1,41 @@
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
const helper_ui = preload("res://addons/escoria-wizard/escoria_wizard.tscn")
|
||||
|
||||
# This is the instance of the plugin code that is instantiated by the plugin.
|
||||
var helper_instance
|
||||
|
||||
func _enter_tree() -> void:
|
||||
helper_instance = helper_ui.instance()
|
||||
helper_instance.plugin_reference = self
|
||||
# Add the panel to the main viewport
|
||||
get_editor_interface().get_editor_viewport().add_child(helper_instance)
|
||||
make_visible(false)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if helper_instance:
|
||||
helper_instance.queue_free()
|
||||
|
||||
|
||||
func has_main_screen() -> bool:
|
||||
# Add the button to the Godot interface ribbon
|
||||
return true
|
||||
|
||||
|
||||
func make_visible(visible: bool) -> void:
|
||||
if helper_instance:
|
||||
helper_instance.visible = visible
|
||||
|
||||
|
||||
func get_plugin_name() -> String:
|
||||
return "Escoria Wizard"
|
||||
|
||||
|
||||
func get_plugin_icon() -> Texture:
|
||||
return (preload("res://addons/escoria-wizard/graphics/icon16x16.png"))
|
||||
|
||||
|
||||
func open_scene(path: String) -> void:
|
||||
get_editor_interface().open_scene_from_path(path)
|
||||
41
addons/escoria-wizard/room_script_template.esc
Normal file
@@ -0,0 +1,41 @@
|
||||
# Room script template
|
||||
|
||||
# ":setup" is used to configure anything you want in place before the
|
||||
# transition-in event runs (i.e. anything you need to set up before the player
|
||||
# sees the room). Reset movable objects to their start positions here.
|
||||
|
||||
:setup
|
||||
|
||||
|
||||
|
||||
# ":ready" runs after any events configured in setup complete. It is used to
|
||||
# configure everything that happens after the transition-in (if any) completes.
|
||||
# runs. Story telling events go here (e.g. if you want the character to walk to
|
||||
# a specific location in the room before giving control to the player.)
|
||||
|
||||
:ready
|
||||
|
||||
|
||||
|
||||
# Code examples - feel free to delete this section
|
||||
#
|
||||
# 1) Run this code when the player enters this room for the first time only.
|
||||
# This assumes your room is called "room_hallway". Also resets the "window"
|
||||
# to closed by playing the animation "close_window" using 'set_state'.
|
||||
#
|
||||
# > [!room_hallway_visited]
|
||||
# set_global room_hallway_visited true
|
||||
# set_state window close_window true
|
||||
#
|
||||
#
|
||||
# 2) Change where the player starts depending on which doorway they entered
|
||||
# the room from. Assumes your character is called "cleaner"
|
||||
#
|
||||
# > [eq ESC_LAST_SCENE room2]
|
||||
# teleport cleaner r1_r_exit
|
||||
# # Set cleaner look left
|
||||
# set_angle cleaner 270
|
||||
#
|
||||
#
|
||||
|
||||
|
||||