mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Move layer and frame initial creation code to Main.gd
From Global.gd
This commit is contained in:
parent
66ad745c52
commit
8a5cc6860f
|
@ -103,8 +103,7 @@ var palettes := {}
|
||||||
# Nodes
|
# Nodes
|
||||||
var notification_label_node: PackedScene = preload("res://src/UI/NotificationLabel.tscn")
|
var notification_label_node: PackedScene = preload("res://src/UI/NotificationLabel.tscn")
|
||||||
|
|
||||||
onready var root: Node = get_tree().get_root()
|
onready var control: Node = get_tree().get_root().get_node("Control")
|
||||||
onready var control: Node = root.get_node("Control")
|
|
||||||
|
|
||||||
onready var left_cursor: Sprite = control.find_node("LeftCursor")
|
onready var left_cursor: Sprite = control.find_node("LeftCursor")
|
||||||
onready var right_cursor: Sprite = control.find_node("RightCursor")
|
onready var right_cursor: Sprite = control.find_node("RightCursor")
|
||||||
|
@ -182,10 +181,7 @@ func _ready() -> void:
|
||||||
var proj_size := Vector2(default_width, default_height)
|
var proj_size := Vector2(default_width, default_height)
|
||||||
projects.append(Project.new([], tr("untitled"), proj_size))
|
projects.append(Project.new([], tr("untitled"), proj_size))
|
||||||
current_project = projects[0]
|
current_project = projects[0]
|
||||||
current_project.layers.append(Layer.new())
|
|
||||||
current_project.fill_color = default_fill_color
|
current_project.fill_color = default_fill_color
|
||||||
var frame: Frame = current_project.new_empty_frame()
|
|
||||||
current_project.frames.append(frame)
|
|
||||||
|
|
||||||
for node in get_tree().get_nodes_in_group("UIButtons"):
|
for node in get_tree().get_nodes_in_group("UIButtons"):
|
||||||
var tooltip: String = node.hint_tooltip
|
var tooltip: String = node.hint_tooltip
|
||||||
|
|
|
@ -23,7 +23,10 @@ func _ready() -> void:
|
||||||
|
|
||||||
Global.window_title = tr("untitled") + " - Pixelorama " + Global.current_version
|
Global.window_title = tr("untitled") + " - Pixelorama " + Global.current_version
|
||||||
|
|
||||||
Global.current_project.layers[0].name = tr("Layer") + " 0"
|
Global.current_project.layers.append(Layer.new())
|
||||||
|
var frame: Frame = Global.current_project.new_empty_frame()
|
||||||
|
Global.current_project.frames.append(frame)
|
||||||
|
Global.current_project.layers = Global.current_project.layers
|
||||||
|
|
||||||
Import.import_brushes(Global.directory_module.get_brushes_search_path_in_order())
|
Import.import_brushes(Global.directory_module.get_brushes_search_path_in_order())
|
||||||
Import.import_patterns(Global.directory_module.get_patterns_search_path_in_order())
|
Import.import_patterns(Global.directory_module.get_patterns_search_path_in_order())
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=44 format=2]
|
[gd_scene load_steps=43 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/UI/Timeline/AnimationTimeline.gd" type="Script" id=1]
|
[ext_resource path="res://src/UI/Timeline/AnimationTimeline.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/graphics/layers/new.png" type="Texture" id=2]
|
[ext_resource path="res://assets/graphics/layers/new.png" type="Texture" id=2]
|
||||||
|
@ -9,7 +9,6 @@
|
||||||
[ext_resource path="res://assets/graphics/layers/clone.png" type="Texture" id=7]
|
[ext_resource path="res://assets/graphics/layers/clone.png" type="Texture" id=7]
|
||||||
[ext_resource path="res://assets/graphics/timeline/move_arrow.png" type="Texture" id=8]
|
[ext_resource path="res://assets/graphics/timeline/move_arrow.png" type="Texture" id=8]
|
||||||
[ext_resource path="res://src/UI/Timeline/FrameButton.tscn" type="PackedScene" id=9]
|
[ext_resource path="res://src/UI/Timeline/FrameButton.tscn" type="PackedScene" id=9]
|
||||||
[ext_resource path="res://src/UI/Timeline/LayerButton.tscn" type="PackedScene" id=18]
|
|
||||||
[ext_resource path="res://assets/graphics/timeline/new_frame.png" type="Texture" id=19]
|
[ext_resource path="res://assets/graphics/timeline/new_frame.png" type="Texture" id=19]
|
||||||
[ext_resource path="res://assets/graphics/timeline/remove_frame.png" type="Texture" id=20]
|
[ext_resource path="res://assets/graphics/timeline/remove_frame.png" type="Texture" id=20]
|
||||||
[ext_resource path="res://assets/graphics/timeline/go_to_first_frame.png" type="Texture" id=21]
|
[ext_resource path="res://assets/graphics/timeline/go_to_first_frame.png" type="Texture" id=21]
|
||||||
|
@ -832,16 +831,16 @@ margin_right = 895.0
|
||||||
margin_bottom = 75.0
|
margin_bottom = 75.0
|
||||||
|
|
||||||
[node name="LayersAndFrames" type="HBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll"]
|
[node name="LayersAndFrames" type="HBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll"]
|
||||||
margin_right = 252.0
|
margin_right = 81.0
|
||||||
margin_bottom = 68.0
|
margin_bottom = 68.0
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
|
||||||
[node name="LayerVBoxCont" type="VBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames"]
|
[node name="LayerVBoxCont" type="VBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames"]
|
||||||
margin_right = 212.0
|
margin_right = 41.0
|
||||||
margin_bottom = 68.0
|
margin_bottom = 68.0
|
||||||
|
|
||||||
[node name="LayerLabel" type="Label" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/LayerVBoxCont"]
|
[node name="LayerLabel" type="Label" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/LayerVBoxCont"]
|
||||||
margin_right = 212.0
|
margin_right = 41.0
|
||||||
margin_bottom = 16.0
|
margin_bottom = 16.0
|
||||||
rect_min_size = Vector2( 0, 16 )
|
rect_min_size = Vector2( 0, 16 )
|
||||||
text = "Layers"
|
text = "Layers"
|
||||||
|
@ -850,15 +849,12 @@ valign = 1
|
||||||
|
|
||||||
[node name="LayersContainer" type="VBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/LayerVBoxCont"]
|
[node name="LayersContainer" type="VBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/LayerVBoxCont"]
|
||||||
margin_top = 20.0
|
margin_top = 20.0
|
||||||
margin_right = 212.0
|
margin_right = 41.0
|
||||||
margin_bottom = 56.0
|
margin_bottom = 20.0
|
||||||
|
|
||||||
[node name="LayerContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/LayerVBoxCont/LayersContainer" instance=ExtResource( 18 )]
|
|
||||||
margin_right = 212.0
|
|
||||||
|
|
||||||
[node name="FrameButtonsAndIds" type="VBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames"]
|
[node name="FrameButtonsAndIds" type="VBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames"]
|
||||||
margin_left = 216.0
|
margin_left = 45.0
|
||||||
margin_right = 252.0
|
margin_right = 81.0
|
||||||
margin_bottom = 68.0
|
margin_bottom = 68.0
|
||||||
|
|
||||||
[node name="FrameIDs" type="HBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/FrameButtonsAndIds"]
|
[node name="FrameIDs" type="HBoxContainer" parent="ScrollContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/FrameButtonsAndIds"]
|
||||||
|
|
|
@ -45,7 +45,7 @@ func _input(event: InputEvent) -> void:
|
||||||
and line_edit.visible
|
and line_edit.visible
|
||||||
and event.scancode != KEY_SPACE
|
and event.scancode != KEY_SPACE
|
||||||
):
|
):
|
||||||
save_layer_name(line_edit.text)
|
_save_layer_name(line_edit.text)
|
||||||
|
|
||||||
|
|
||||||
func _on_LayerContainer_gui_input(event: InputEvent) -> void:
|
func _on_LayerContainer_gui_input(event: InputEvent) -> void:
|
||||||
|
@ -81,10 +81,10 @@ func _on_LayerContainer_gui_input(event: InputEvent) -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_LineEdit_focus_exited() -> void:
|
func _on_LineEdit_focus_exited() -> void:
|
||||||
save_layer_name(line_edit.text)
|
_save_layer_name(line_edit.text)
|
||||||
|
|
||||||
|
|
||||||
func save_layer_name(new_name: String) -> void:
|
func _save_layer_name(new_name: String) -> void:
|
||||||
label.visible = true
|
label.visible = true
|
||||||
line_edit.visible = false
|
line_edit.visible = false
|
||||||
line_edit.editable = false
|
line_edit.editable = false
|
||||||
|
|
Loading…
Reference in a new issue