mirror of
https://github.com/Relintai/draw_gd.git
synced 2025-02-01 07:17:03 +01:00
Bit more work.
This commit is contained in:
parent
42d5b1daa7
commit
b4c5976ef2
@ -104,7 +104,6 @@ var zoom_level_label : Label
|
||||
var new_image_dialog : ConfirmationDialog
|
||||
var open_sprites_dialog : FileDialog
|
||||
var save_sprites_dialog : FileDialog
|
||||
var save_sprites_html5_dialog : ConfirmationDialog
|
||||
var export_dialog : AcceptDialog
|
||||
var preferences_dialog : AcceptDialog
|
||||
var unsaved_changes_dialog : ConfirmationDialog
|
||||
@ -204,7 +203,6 @@ func refresh_nodes():
|
||||
new_image_dialog = find_node_by_name(control, "CreateNewImage")
|
||||
open_sprites_dialog = find_node_by_name(control, "OpenSprite")
|
||||
save_sprites_dialog = find_node_by_name(control, "SaveSprite")
|
||||
save_sprites_html5_dialog = find_node_by_name(control, "SaveSpriteHTML5")
|
||||
export_dialog = find_node_by_name(control, "ExportDialog")
|
||||
preferences_dialog = find_node_by_name(control, "PreferencesDialog")
|
||||
unsaved_changes_dialog = find_node_by_name(control, "UnsavedCanvasDialog")
|
||||
|
@ -12,7 +12,7 @@ var size : Vector2 setget size_changed
|
||||
var undo_redo : UndoRedo
|
||||
var undos := 0 # The number of times we added undo properties
|
||||
var has_changed := false setget has_changed_changed
|
||||
var frames := [] setget frames_changed # Array of Frames (that contain Cels)
|
||||
var frames := []
|
||||
var layers := [] setget layers_changed # Array of Layers
|
||||
var current_frame := 0 setget frame_changed
|
||||
var current_layer := 0 setget layer_changed
|
||||
@ -321,33 +321,6 @@ func size_changed(value : Vector2) -> void:
|
||||
if DrawGD.selection_rectangle._selected_rect.has_no_area():
|
||||
select_all_pixels()
|
||||
|
||||
|
||||
func frames_changed(value : Array) -> void:
|
||||
frames = value
|
||||
|
||||
for frame_id in DrawGD.frame_ids.get_children():
|
||||
DrawGD.frame_ids.remove_child(frame_id)
|
||||
frame_id.queue_free()
|
||||
|
||||
for i in range(layers.size() - 1, -1, -1):
|
||||
DrawGD.frames_container.add_child(layers[i].frame_container)
|
||||
|
||||
for j in range(frames.size()):
|
||||
var label := Label.new()
|
||||
label.rect_min_size.x = 36
|
||||
label.align = Label.ALIGN_CENTER
|
||||
label.text = str(j + 1)
|
||||
DrawGD.frame_ids.add_child(label)
|
||||
|
||||
for i in range(layers.size() - 1, -1, -1):
|
||||
var cel_button = load("res://addons/draw_gd/src/UI/Timeline/CelButton.tscn").instance()
|
||||
cel_button.frame = j
|
||||
cel_button.layer = i
|
||||
cel_button.get_child(0).texture = frames[j].cels[i].image_texture
|
||||
|
||||
layers[i].frame_container.add_child(cel_button)
|
||||
|
||||
|
||||
func layers_changed(value : Array) -> void:
|
||||
layers = value
|
||||
if DrawGD.layers_changed_skip:
|
||||
|
@ -203,6 +203,9 @@ func update_texture(layer_index : int, frame_index := -1, project : Project = Dr
|
||||
|
||||
if project == DrawGD.current_project:
|
||||
var frame_texture_rect : TextureRect
|
||||
|
||||
var aaaa= project.layers[layer_index]
|
||||
|
||||
frame_texture_rect = DrawGD.find_node_by_name(project.layers[layer_index].frame_container.get_child(frame_index), "CelTexture")
|
||||
frame_texture_rect.texture = current_cel.image_texture
|
||||
|
||||
|
@ -3,14 +3,16 @@
|
||||
[ext_resource path="res://addons/draw_gd/src/UI/Timeline/CelButton.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="CelButton" type="MarginContainer"]
|
||||
[node name="CelButton" type="Button"]
|
||||
margin_top = 18.0
|
||||
margin_right = 36.0
|
||||
margin_bottom = 54.0
|
||||
rect_min_size = Vector2( 36, 36 )
|
||||
mouse_filter = 2
|
||||
mouse_default_cursor_shape = 2
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MC2" type="MarginContainer" parent="."]
|
||||
margin_right = 36.0
|
||||
|
@ -8,7 +8,7 @@ var lock_button : BaseButton
|
||||
var linked_button : BaseButton
|
||||
var label : Label
|
||||
var line_edit : LineEdit
|
||||
var cel_button : Node
|
||||
var cel_button : Button
|
||||
|
||||
var DrawGD : Node = null
|
||||
|
||||
@ -90,3 +90,8 @@ func _on_LinkButton_pressed() -> void:
|
||||
# If button is pressed and there are no linked cels in the layer
|
||||
DrawGD.current_project.layers[i].linked_cels.append(DrawGD.current_project.frames[DrawGD.current_project.current_frame])
|
||||
#DrawGD.current_project.layers[i].frame_container.get_child(DrawGD.current_project.current_frame)._ready()
|
||||
|
||||
|
||||
func _on_CelButton_pressed():
|
||||
#DrawGD.current_project.current_frame = frame
|
||||
DrawGD.current_project.current_layer = i
|
||||
|
@ -167,10 +167,10 @@ clip_text = true
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="HBoxContainer/LayerName"]
|
||||
visible = false
|
||||
margin_left = 86.0
|
||||
margin_top = 5.0
|
||||
margin_right = 166.0
|
||||
margin_bottom = 37.0
|
||||
margin_left = 24.0
|
||||
margin_top = 2.0
|
||||
margin_right = 104.0
|
||||
margin_bottom = 34.0
|
||||
rect_min_size = Vector2( 80, 32 )
|
||||
size_flags_vertical = 4
|
||||
text = "Layer 0"
|
||||
@ -179,6 +179,7 @@ caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[connection signal="pressed" from="." to="." method="_on_LayerContainer_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/CelButton" to="." method="_on_CelButton_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/LayerButtons/VisibilityButton" to="." method="_on_VisibilityButton_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/LayerButtons/LockButton" to="." method="_on_LockButton_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/LayerButtons/LinkButton" to="." method="_on_LinkButton_pressed"]
|
||||
|
Loading…
Reference in New Issue
Block a user