mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-20 12:33:14 +00:00
Added "Unlink Cell" to FrameButton's PopupMenu (appears on right click)
Behavior may be changed because it's not set to work with UndoRedo. Not sure if it should, yet.
This commit is contained in:
parent
fd0069d2e5
commit
07b62c9fd8
2 changed files with 13 additions and 2 deletions
|
@ -27,12 +27,15 @@ size_flags_horizontal = 0
|
|||
size_flags_vertical = 0
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="PopupMenu" type="PopupMenu" parent="."]
|
||||
margin_right = 20.0
|
||||
margin_bottom = 20.0
|
||||
mouse_default_cursor_shape = 2
|
||||
items = [ "Remove Frame", null, 0, false, true, -1, 0, null, "", false, "Clone Frame", null, 0, false, false, -1, 0, null, "", false, "Move Left", null, 0, false, true, -1, 0, null, "", false, "Move Right", null, 0, false, true, -1, 0, null, "", false ]
|
||||
items = [ "Remove Frame", null, 0, false, true, -1, 0, null, "", false, "Clone Frame", null, 0, false, false, -1, 0, null, "", false, "Move Left", null, 0, false, true, -1, 0, null, "", false, "Move Right", null, 0, false, true, -1, 0, null, "", false, "Unlink Cell", null, 0, false, true, 4, 0, null, "", false ]
|
||||
|
||||
[node name="LinkedIndicator" type="Polygon2D" parent="."]
|
||||
visible = false
|
||||
|
|
|
@ -7,8 +7,12 @@ onready var popup_menu := $PopupMenu
|
|||
|
||||
func _ready() -> void:
|
||||
hint_tooltip = "Frame: %s, Layer: %s" % [frame, layer]
|
||||
if frame in Global.layers[layer][5]:
|
||||
if Global.canvases[frame] in Global.layers[layer][5]:
|
||||
get_node("LinkedIndicator").visible = true
|
||||
popup_menu.set_item_disabled(4, false) # Unlink cell
|
||||
else:
|
||||
get_node("LinkedIndicator").visible = false
|
||||
popup_menu.set_item_disabled(4, true) # Unlink cell
|
||||
|
||||
func _on_FrameButton_pressed() -> void:
|
||||
if Input.is_action_just_released("left_mouse"):
|
||||
|
@ -83,6 +87,10 @@ func _on_PopupMenu_id_pressed(ID : int) -> void:
|
|||
change_frame_order(-1)
|
||||
3: # Move Right
|
||||
change_frame_order(1)
|
||||
4: # Unlink Cell
|
||||
var cell_index : int = Global.layers[layer][5].find(Global.canvases[frame])
|
||||
Global.layers[layer][5].remove(cell_index)
|
||||
_ready()
|
||||
|
||||
func remove_frame() -> void:
|
||||
var canvas : Canvas = Global.canvases[frame]
|
||||
|
|
Loading…
Add table
Reference in a new issue