mirror of
https://github.com/Relintai/draw_gd.git
synced 2025-02-12 07:40:07 +01:00
Removal of the DrawGD/Global singleton part 2.
This commit is contained in:
parent
2f27051aa0
commit
f0bf996e70
@ -16,7 +16,7 @@ var root_directory := "."
|
|||||||
var window_title := "" setget title_changed # Why doesn't Godot have get_window_title()?
|
var window_title := "" setget title_changed # Why doesn't Godot have get_window_title()?
|
||||||
var config_cache := ConfigFile.new()
|
var config_cache := ConfigFile.new()
|
||||||
var XDGDataPaths = preload("res://addons/draw_gd/src/XDGDataPaths.gd")
|
var XDGDataPaths = preload("res://addons/draw_gd/src/XDGDataPaths.gd")
|
||||||
var directory_module : Reference
|
var directory_module : Node
|
||||||
|
|
||||||
var projects := [] # Array of Projects
|
var projects := [] # Array of Projects
|
||||||
var current_project : Project
|
var current_project : Project
|
||||||
@ -173,7 +173,7 @@ var tools = null
|
|||||||
var opensave_script = preload("res://addons/draw_gd/src/Autoload/OpenSave.gd")
|
var opensave_script = preload("res://addons/draw_gd/src/Autoload/OpenSave.gd")
|
||||||
var opensave = null
|
var opensave = null
|
||||||
|
|
||||||
func _ready() -> void:
|
func _enter_tree() -> void:
|
||||||
randomize()
|
randomize()
|
||||||
if OS.has_feature("standalone"):
|
if OS.has_feature("standalone"):
|
||||||
root_directory = OS.get_executable_path().get_base_dir()
|
root_directory = OS.get_executable_path().get_base_dir()
|
||||||
@ -188,7 +188,7 @@ func _ready() -> void:
|
|||||||
|
|
||||||
# The fact that root_dir is set earlier than this is important
|
# The fact that root_dir is set earlier than this is important
|
||||||
# XDGDataDirs depends on it nyaa
|
# XDGDataDirs depends on it nyaa
|
||||||
directory_module = XDGDataPaths.new()
|
directory_module = $XDGDataPaths
|
||||||
image_clipboard = Image.new()
|
image_clipboard = Image.new()
|
||||||
Input.set_custom_mouse_cursor(cursor_image, Input.CURSOR_CROSS, Vector2(15, 15))
|
Input.set_custom_mouse_cursor(cursor_image, Input.CURSOR_CROSS, Vector2(15, 15))
|
||||||
|
|
||||||
@ -429,9 +429,7 @@ func change_button_texturerect(texture_button : TextureRect, new_file_name : Str
|
|||||||
|
|
||||||
|
|
||||||
func update_hint_tooltips() -> void:
|
func update_hint_tooltips() -> void:
|
||||||
var root = get_tree().get_root()
|
var rect_select : BaseButton = find_node_by_name(self, "RectSelect")
|
||||||
|
|
||||||
var rect_select : BaseButton = find_node_by_name(root, "RectSelect")
|
|
||||||
rect_select.hint_tooltip = tr("""Rectangular Selection
|
rect_select.hint_tooltip = tr("""Rectangular Selection
|
||||||
|
|
||||||
%s for left mouse button
|
%s for left mouse button
|
||||||
@ -439,21 +437,21 @@ func update_hint_tooltips() -> void:
|
|||||||
|
|
||||||
Press %s to move the content""") % [InputMap.get_action_list("left_rectangle_select_tool")[0].as_text(), InputMap.get_action_list("right_rectangle_select_tool")[0].as_text(), "Shift"]
|
Press %s to move the content""") % [InputMap.get_action_list("left_rectangle_select_tool")[0].as_text(), InputMap.get_action_list("right_rectangle_select_tool")[0].as_text(), "Shift"]
|
||||||
|
|
||||||
var zoom_tool : BaseButton = find_node_by_name(root, "Zoom")
|
var zoom_tool : BaseButton = find_node_by_name(self, "Zoom")
|
||||||
zoom_tool.hint_tooltip = tr("""Zoom
|
zoom_tool.hint_tooltip = tr("""Zoom
|
||||||
|
|
||||||
%s for left mouse button
|
%s for left mouse button
|
||||||
%s for right mouse button""") % [InputMap.get_action_list("left_zoom_tool")[0].as_text(), InputMap.get_action_list("right_zoom_tool")[0].as_text()]
|
%s for right mouse button""") % [InputMap.get_action_list("left_zoom_tool")[0].as_text(), InputMap.get_action_list("right_zoom_tool")[0].as_text()]
|
||||||
|
|
||||||
|
|
||||||
var color_picker : BaseButton = find_node_by_name(root, "ColorPicker")
|
var color_picker : BaseButton = find_node_by_name(self, "ColorPicker")
|
||||||
color_picker.hint_tooltip = tr("""Color Picker
|
color_picker.hint_tooltip = tr("""Color Picker
|
||||||
Select a color from a pixel of the sprite
|
Select a color from a pixel of the sprite
|
||||||
|
|
||||||
%s for left mouse button
|
%s for left mouse button
|
||||||
%s for right mouse button""") % [InputMap.get_action_list("left_colorpicker_tool")[0].as_text(), InputMap.get_action_list("right_colorpicker_tool")[0].as_text()]
|
%s for right mouse button""") % [InputMap.get_action_list("left_colorpicker_tool")[0].as_text(), InputMap.get_action_list("right_colorpicker_tool")[0].as_text()]
|
||||||
|
|
||||||
var pencil : BaseButton = find_node_by_name(root, "Pencil")
|
var pencil : BaseButton = find_node_by_name(self, "Pencil")
|
||||||
pencil.hint_tooltip = tr("""Pencil
|
pencil.hint_tooltip = tr("""Pencil
|
||||||
|
|
||||||
%s for left mouse button
|
%s for left mouse button
|
||||||
@ -461,7 +459,7 @@ Select a color from a pixel of the sprite
|
|||||||
|
|
||||||
Hold %s to make a line""") % [InputMap.get_action_list("left_pencil_tool")[0].as_text(), InputMap.get_action_list("right_pencil_tool")[0].as_text(), "Shift"]
|
Hold %s to make a line""") % [InputMap.get_action_list("left_pencil_tool")[0].as_text(), InputMap.get_action_list("right_pencil_tool")[0].as_text(), "Shift"]
|
||||||
|
|
||||||
var eraser : BaseButton = find_node_by_name(root, "Eraser")
|
var eraser : BaseButton = find_node_by_name(self, "Eraser")
|
||||||
eraser.hint_tooltip = tr("""Eraser
|
eraser.hint_tooltip = tr("""Eraser
|
||||||
|
|
||||||
%s for left mouse button
|
%s for left mouse button
|
||||||
@ -469,27 +467,27 @@ Hold %s to make a line""") % [InputMap.get_action_list("left_pencil_tool")[0].as
|
|||||||
|
|
||||||
Hold %s to make a line""") % [InputMap.get_action_list("left_eraser_tool")[0].as_text(), InputMap.get_action_list("right_eraser_tool")[0].as_text(), "Shift"]
|
Hold %s to make a line""") % [InputMap.get_action_list("left_eraser_tool")[0].as_text(), InputMap.get_action_list("right_eraser_tool")[0].as_text(), "Shift"]
|
||||||
|
|
||||||
var bucket : BaseButton = find_node_by_name(root, "Bucket")
|
var bucket : BaseButton = find_node_by_name(self, "Bucket")
|
||||||
bucket.hint_tooltip = tr("""Bucket
|
bucket.hint_tooltip = tr("""Bucket
|
||||||
|
|
||||||
%s for left mouse button
|
%s for left mouse button
|
||||||
%s for right mouse button""") % [InputMap.get_action_list("left_fill_tool")[0].as_text(), InputMap.get_action_list("right_fill_tool")[0].as_text()]
|
%s for right mouse button""") % [InputMap.get_action_list("left_fill_tool")[0].as_text(), InputMap.get_action_list("right_fill_tool")[0].as_text()]
|
||||||
|
|
||||||
var ld : BaseButton = find_node_by_name(root, "LightenDarken")
|
var ld : BaseButton = find_node_by_name(self, "LightenDarken")
|
||||||
ld.hint_tooltip = tr("""Lighten/Darken
|
ld.hint_tooltip = tr("""Lighten/Darken
|
||||||
|
|
||||||
%s for left mouse button
|
%s for left mouse button
|
||||||
%s for right mouse button""") % [InputMap.get_action_list("left_lightdark_tool")[0].as_text(), InputMap.get_action_list("right_lightdark_tool")[0].as_text()]
|
%s for right mouse button""") % [InputMap.get_action_list("left_lightdark_tool")[0].as_text(), InputMap.get_action_list("right_lightdark_tool")[0].as_text()]
|
||||||
|
|
||||||
var color_switch : BaseButton = find_node_by_name(root, "ColorSwitch")
|
var color_switch : BaseButton = find_node_by_name(self, "ColorSwitch")
|
||||||
color_switch.hint_tooltip = tr("""Switch left and right colors
|
color_switch.hint_tooltip = tr("""Switch left and right colors
|
||||||
(%s)""") % InputMap.get_action_list("switch_colors")[0].as_text()
|
(%s)""") % InputMap.get_action_list("switch_colors")[0].as_text()
|
||||||
|
|
||||||
var first_frame : BaseButton = find_node_by_name(root, "FirstFrame")
|
var first_frame : BaseButton = find_node_by_name(self, "FirstFrame")
|
||||||
first_frame.hint_tooltip = tr("""Jump to the first frame
|
first_frame.hint_tooltip = tr("""Jump to the first frame
|
||||||
(%s)""") % InputMap.get_action_list("go_to_first_frame")[0].as_text()
|
(%s)""") % InputMap.get_action_list("go_to_first_frame")[0].as_text()
|
||||||
|
|
||||||
var previous_frame : BaseButton = find_node_by_name(root, "PreviousFrame")
|
var previous_frame : BaseButton = find_node_by_name(self, "PreviousFrame")
|
||||||
previous_frame.hint_tooltip = tr("""Go to the previous frame
|
previous_frame.hint_tooltip = tr("""Go to the previous frame
|
||||||
(%s)""") % InputMap.get_action_list("go_to_previous_frame")[0].as_text()
|
(%s)""") % InputMap.get_action_list("go_to_previous_frame")[0].as_text()
|
||||||
|
|
||||||
@ -499,11 +497,11 @@ Hold %s to make a line""") % [InputMap.get_action_list("left_eraser_tool")[0].as
|
|||||||
play_forward.hint_tooltip = tr("""Play the animation forward (from beginning to end)
|
play_forward.hint_tooltip = tr("""Play the animation forward (from beginning to end)
|
||||||
(%s)""") % InputMap.get_action_list("play_forward")[0].as_text()
|
(%s)""") % InputMap.get_action_list("play_forward")[0].as_text()
|
||||||
|
|
||||||
var next_frame : BaseButton = find_node_by_name(root, "NextFrame")
|
var next_frame : BaseButton = find_node_by_name(self, "NextFrame")
|
||||||
next_frame.hint_tooltip = tr("""Go to the next frame
|
next_frame.hint_tooltip = tr("""Go to the next frame
|
||||||
(%s)""") % InputMap.get_action_list("go_to_next_frame")[0].as_text()
|
(%s)""") % InputMap.get_action_list("go_to_next_frame")[0].as_text()
|
||||||
|
|
||||||
var last_frame : BaseButton = find_node_by_name(root, "LastFrame")
|
var last_frame : BaseButton = find_node_by_name(self, "LastFrame")
|
||||||
last_frame.hint_tooltip = tr("""Jump to the last frame
|
last_frame.hint_tooltip = tr("""Jump to the last frame
|
||||||
(%s)""") % InputMap.get_action_list("go_to_last_frame")[0].as_text()
|
(%s)""") % InputMap.get_action_list("go_to_last_frame")[0].as_text()
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ var opensprite_file_selected := false
|
|||||||
var redone := false
|
var redone := false
|
||||||
var is_quitting_on_save := false
|
var is_quitting_on_save := false
|
||||||
|
|
||||||
onready var DrawGD : Node = $DrawGDSingleton
|
onready var DrawGD : Node = get_node("..")
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
get_tree().set_auto_accept_quit(false)
|
#get_tree().set_auto_accept_quit(false)
|
||||||
setup_application_window_size()
|
setup_application_window_size()
|
||||||
|
|
||||||
DrawGD.window_title = tr("untitled") + " - Pixelorama " + DrawGD.current_version
|
DrawGD.window_title = tr("untitled") + " - Pixelorama " + DrawGD.current_version
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=18 format=2]
|
[gd_scene load_steps=19 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/draw_gd/src/Main.gd" type="Script" id=1]
|
[ext_resource path="res://addons/draw_gd/src/Main.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/ImageEffects.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/ImageEffects/ImageEffects.tscn" type="PackedScene" id=2]
|
||||||
@ -13,6 +13,7 @@
|
|||||||
[ext_resource path="res://addons/draw_gd/src/UI/TopMenuContainer.tscn" type="PackedScene" id=11]
|
[ext_resource path="res://addons/draw_gd/src/UI/TopMenuContainer.tscn" type="PackedScene" id=11]
|
||||||
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/SaveSprite.tscn" type="PackedScene" id=12]
|
[ext_resource path="res://addons/draw_gd/src/UI/Dialogs/SaveSprite.tscn" type="PackedScene" id=12]
|
||||||
[ext_resource path="res://addons/draw_gd/src/Autoload/DrawGD.gd" type="Script" id=13]
|
[ext_resource path="res://addons/draw_gd/src/Autoload/DrawGD.gd" type="Script" id=13]
|
||||||
|
[ext_resource path="res://addons/draw_gd/src/XDGDataPaths.gd" type="Script" id=14]
|
||||||
|
|
||||||
[sub_resource type="Image" id=5]
|
[sub_resource type="Image" id=5]
|
||||||
data = {
|
data = {
|
||||||
@ -160,6 +161,9 @@ texture = SubResource( 4 )
|
|||||||
|
|
||||||
[node name="ModulateTween" type="Tween" parent="DrawGDControl"]
|
[node name="ModulateTween" type="Tween" parent="DrawGDControl"]
|
||||||
|
|
||||||
|
[node name="XDGDataPaths" type="Node" parent="."]
|
||||||
|
script = ExtResource( 14 )
|
||||||
|
|
||||||
[connection signal="popup_hide" from="DrawGDControl/Dialogs/CreateNewImage" to="DrawGDControl" method="_can_draw_true"]
|
[connection signal="popup_hide" from="DrawGDControl/Dialogs/CreateNewImage" to="DrawGDControl" method="_can_draw_true"]
|
||||||
[connection signal="file_selected" from="DrawGDControl/Dialogs/OpenSprite" to="DrawGDControl" method="_on_OpenSprite_file_selected"]
|
[connection signal="file_selected" from="DrawGDControl/Dialogs/OpenSprite" to="DrawGDControl" method="_on_OpenSprite_file_selected"]
|
||||||
[connection signal="popup_hide" from="DrawGDControl/Dialogs/OpenSprite" to="DrawGDControl" method="_on_OpenSprite_popup_hide"]
|
[connection signal="popup_hide" from="DrawGDControl/Dialogs/OpenSprite" to="DrawGDControl" method="_on_OpenSprite_popup_hide"]
|
||||||
|
@ -4,7 +4,17 @@ extends AcceptDialog
|
|||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
# Preferences table: [Prop name in DrawGD, relative node path, value type, default value]
|
# Preferences table: [Prop name in DrawGD, relative node path, value type, default value]
|
||||||
var preferences = [
|
var preferences = []
|
||||||
|
|
||||||
|
var selected_item := 0
|
||||||
|
|
||||||
|
onready var list : ItemList = $HSplitContainer/List
|
||||||
|
onready var right_side : VBoxContainer = $HSplitContainer/ScrollContainer/VBoxContainer
|
||||||
|
onready var autosave_interval : SpinBox = $HSplitContainer/ScrollContainer/VBoxContainer/Backup/AutosaveContainer/AutosaveInterval
|
||||||
|
onready var restore_default_button_scene = preload("res://addons/draw_gd/src/Preferences/RestoreDefaultButton.tscn")
|
||||||
|
|
||||||
|
func load_prefs():
|
||||||
|
preferences = [
|
||||||
["open_last_project", "Startup/StartupContainer/OpenLastProject", "pressed", DrawGD.open_last_project],
|
["open_last_project", "Startup/StartupContainer/OpenLastProject", "pressed", DrawGD.open_last_project],
|
||||||
["smooth_zoom", "Canvas/ZoomOptions/SmoothZoom", "pressed", DrawGD.smooth_zoom],
|
["smooth_zoom", "Canvas/ZoomOptions/SmoothZoom", "pressed", DrawGD.smooth_zoom],
|
||||||
["pressure_sensitivity_mode", "Startup/PressureSentivity/PressureSensitivityOptionButton", "selected", DrawGD.pressure_sensitivity_mode],
|
["pressure_sensitivity_mode", "Startup/PressureSentivity/PressureSensitivityOptionButton", "selected", DrawGD.pressure_sensitivity_mode],
|
||||||
@ -30,17 +40,18 @@ var preferences = [
|
|||||||
["checker_color_2", "Canvas/CheckerOptions/CheckerColor2", "color", DrawGD.checker_color_2],
|
["checker_color_2", "Canvas/CheckerOptions/CheckerColor2", "color", DrawGD.checker_color_2],
|
||||||
["checker_follow_movement", "Canvas/CheckerOptions/CheckerFollowMovement", "pressed", DrawGD.checker_follow_movement],
|
["checker_follow_movement", "Canvas/CheckerOptions/CheckerFollowMovement", "pressed", DrawGD.checker_follow_movement],
|
||||||
["checker_follow_scale", "Canvas/CheckerOptions/CheckerFollowScale", "pressed", DrawGD.checker_follow_scale],
|
["checker_follow_scale", "Canvas/CheckerOptions/CheckerFollowScale", "pressed", DrawGD.checker_follow_scale],
|
||||||
]
|
]
|
||||||
|
|
||||||
var selected_item := 0
|
|
||||||
|
|
||||||
onready var list : ItemList = $HSplitContainer/List
|
|
||||||
onready var right_side : VBoxContainer = $HSplitContainer/ScrollContainer/VBoxContainer
|
|
||||||
onready var autosave_interval : SpinBox = $HSplitContainer/ScrollContainer/VBoxContainer/Backup/AutosaveContainer/AutosaveInterval
|
|
||||||
onready var restore_default_button_scene = preload("res://addons/draw_gd/src/Preferences/RestoreDefaultButton.tscn")
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
|
load_prefs()
|
||||||
|
|
||||||
# Replace OK with Close since preference changes are being applied immediately, not after OK confirmation
|
# Replace OK with Close since preference changes are being applied immediately, not after OK confirmation
|
||||||
get_ok().text = tr("Close")
|
get_ok().text = tr("Close")
|
||||||
|
|
||||||
|
@ -102,7 +102,10 @@ func camera_zoom() -> void:
|
|||||||
DrawGD.transparent_checker._ready() # To update the rect size
|
DrawGD.transparent_checker._ready() # To update the rect size
|
||||||
|
|
||||||
|
|
||||||
func new_empty_frame(first_time := false, single_layer := false, size := DrawGD.current_project.size) -> Frame:
|
func new_empty_frame(first_time := false, single_layer := false, size := Vector2(-1, -1)) -> Frame:
|
||||||
|
if size.x < 0 || size.y < 0:
|
||||||
|
size = DrawGD.current_project.size
|
||||||
|
|
||||||
var frame := Frame.new()
|
var frame := Frame.new()
|
||||||
for l in DrawGD.current_project.layers: # Create as many cels as there are layers
|
for l in DrawGD.current_project.layers: # Create as many cels as there are layers
|
||||||
# The sprite itself
|
# The sprite itself
|
||||||
@ -114,6 +117,7 @@ func new_empty_frame(first_time := false, single_layer := false, size := DrawGD.
|
|||||||
DrawGD.current_project.size.y = DrawGD.config_cache.get_value("preferences", "default_image_height")
|
DrawGD.current_project.size.y = DrawGD.config_cache.get_value("preferences", "default_image_height")
|
||||||
if DrawGD.config_cache.has_section_key("preferences", "default_fill_color"):
|
if DrawGD.config_cache.has_section_key("preferences", "default_fill_color"):
|
||||||
fill_color = DrawGD.config_cache.get_value("preferences", "default_fill_color")
|
fill_color = DrawGD.config_cache.get_value("preferences", "default_fill_color")
|
||||||
|
|
||||||
sprite.create(size.x, size.y, false, Image.FORMAT_RGBA8)
|
sprite.create(size.x, size.y, false, Image.FORMAT_RGBA8)
|
||||||
sprite.fill(fill_color)
|
sprite.fill(fill_color)
|
||||||
sprite.lock()
|
sprite.lock()
|
||||||
|
@ -12,7 +12,14 @@ var last : Vector2
|
|||||||
|
|
||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
func _ready() -> void:
|
func _enter_tree() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
DrawGD.main_viewport.connect("item_rect_changed", self, "update")
|
DrawGD.main_viewport.connect("item_rect_changed", self, "update")
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,13 @@ var last : Vector2
|
|||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
DrawGD.main_viewport.connect("item_rect_changed", self, "update")
|
DrawGD.main_viewport.connect("item_rect_changed", self, "update")
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,13 @@ var tag_scroll_container : ScrollContainer
|
|||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
timeline_scroll = DrawGD.find_node_by_name(self, "TimelineScroll")
|
timeline_scroll = DrawGD.find_node_by_name(self, "TimelineScroll")
|
||||||
tag_scroll_container = DrawGD.find_node_by_name(self, "TagScroll")
|
tag_scroll_container = DrawGD.find_node_by_name(self, "TagScroll")
|
||||||
timeline_scroll.get_h_scrollbar().connect("value_changed", self, "_h_scroll_changed")
|
timeline_scroll.get_h_scrollbar().connect("value_changed", self, "_h_scroll_changed")
|
||||||
|
@ -12,6 +12,13 @@ var line_edit : LineEdit
|
|||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
visibility_button = DrawGD.find_node_by_name(self, "VisibilityButton")
|
visibility_button = DrawGD.find_node_by_name(self, "VisibilityButton")
|
||||||
lock_button = DrawGD.find_node_by_name(self, "LockButton")
|
lock_button = DrawGD.find_node_by_name(self, "LockButton")
|
||||||
linked_button = DrawGD.find_node_by_name(self, "LinkButton")
|
linked_button = DrawGD.find_node_by_name(self, "LinkButton")
|
||||||
|
@ -15,8 +15,14 @@ onready var tools := [
|
|||||||
|
|
||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
for t in tools:
|
for t in tools:
|
||||||
t[0].connect("pressed", self, "_on_Tool_pressed", [t[0]])
|
t[0].connect("pressed", self, "_on_Tool_pressed", [t[0]])
|
||||||
DrawGD.update_hint_tooltips()
|
DrawGD.update_hint_tooltips()
|
||||||
|
@ -12,7 +12,14 @@ var was_exported = false
|
|||||||
|
|
||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
func _ready() -> void:
|
func _enter_tree() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
setup_file_menu()
|
setup_file_menu()
|
||||||
setup_edit_menu()
|
setup_edit_menu()
|
||||||
setup_view_menu()
|
setup_view_menu()
|
||||||
@ -60,16 +67,28 @@ func setup_file_menu() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func setup_edit_menu() -> void:
|
func setup_edit_menu() -> void:
|
||||||
|
# var edit_menu_items := {
|
||||||
|
# "Undo" : InputMap.get_action_list("undo")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Redo" : InputMap.get_action_list("redo")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Copy" : InputMap.get_action_list("copy")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Cut" : InputMap.get_action_list("cut")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Paste" : InputMap.get_action_list("paste")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Delete" : InputMap.get_action_list("delete")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Clear Selection" : 0,
|
||||||
|
# "Preferences" : 0
|
||||||
|
# }
|
||||||
|
|
||||||
var edit_menu_items := {
|
var edit_menu_items := {
|
||||||
"Undo" : InputMap.get_action_list("undo")[0].get_scancode_with_modifiers(),
|
"Undo" : 0,
|
||||||
"Redo" : InputMap.get_action_list("redo")[0].get_scancode_with_modifiers(),
|
"Redo" : 0,
|
||||||
"Copy" : InputMap.get_action_list("copy")[0].get_scancode_with_modifiers(),
|
"Copy" : 0,
|
||||||
"Cut" : InputMap.get_action_list("cut")[0].get_scancode_with_modifiers(),
|
"Cut" : 0,
|
||||||
"Paste" : InputMap.get_action_list("paste")[0].get_scancode_with_modifiers(),
|
"Paste" : 0,
|
||||||
"Delete" : InputMap.get_action_list("delete")[0].get_scancode_with_modifiers(),
|
"Delete" : 0,
|
||||||
"Clear Selection" : 0,
|
"Clear Selection" : 0,
|
||||||
"Preferences" : 0
|
"Preferences" : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var edit_menu : PopupMenu = DrawGD.edit_menu.get_popup()
|
var edit_menu : PopupMenu = DrawGD.edit_menu.get_popup()
|
||||||
var i := 0
|
var i := 0
|
||||||
|
|
||||||
@ -81,15 +100,26 @@ func setup_edit_menu() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func setup_view_menu() -> void:
|
func setup_view_menu() -> void:
|
||||||
|
# var view_menu_items := {
|
||||||
|
# "Tile Mode" : InputMap.get_action_list("tile_mode")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Show Grid" : InputMap.get_action_list("show_grid")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Show Rulers" : InputMap.get_action_list("show_rulers")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Show Guides" : InputMap.get_action_list("show_guides")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Show Animation Timeline" : 0,
|
||||||
|
# "Zen Mode" : InputMap.get_action_list("zen_mode")[0].get_scancode_with_modifiers(),
|
||||||
|
# "Fullscreen Mode" : InputMap.get_action_list("toggle_fullscreen")[0].get_scancode_with_modifiers(),
|
||||||
|
# }
|
||||||
|
|
||||||
var view_menu_items := {
|
var view_menu_items := {
|
||||||
"Tile Mode" : InputMap.get_action_list("tile_mode")[0].get_scancode_with_modifiers(),
|
"Tile Mode" : 0,
|
||||||
"Show Grid" : InputMap.get_action_list("show_grid")[0].get_scancode_with_modifiers(),
|
"Show Grid" : 0,
|
||||||
"Show Rulers" : InputMap.get_action_list("show_rulers")[0].get_scancode_with_modifiers(),
|
"Show Rulers" : 0,
|
||||||
"Show Guides" : InputMap.get_action_list("show_guides")[0].get_scancode_with_modifiers(),
|
"Show Guides" : 0,
|
||||||
"Show Animation Timeline" : 0,
|
"Show Animation Timeline" : 0,
|
||||||
"Zen Mode" : InputMap.get_action_list("zen_mode")[0].get_scancode_with_modifiers(),
|
"Zen Mode" : 0,
|
||||||
"Fullscreen Mode" : InputMap.get_action_list("toggle_fullscreen")[0].get_scancode_with_modifiers(),
|
"Fullscreen Mode" : 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
view_menu = DrawGD.view_menu.get_popup()
|
view_menu = DrawGD.view_menu.get_popup()
|
||||||
|
|
||||||
var i := 0
|
var i := 0
|
||||||
|
@ -4,6 +4,13 @@ extends ColorRect
|
|||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
var n : Node = get_parent()
|
||||||
|
while n:
|
||||||
|
if n.name == "DrawGDSingleton":
|
||||||
|
DrawGD = n
|
||||||
|
break
|
||||||
|
n = n.get_parent()
|
||||||
|
|
||||||
rect_size = DrawGD.current_project.size
|
rect_size = DrawGD.current_project.size
|
||||||
if get_parent().get_parent() == DrawGD.main_viewport:
|
if get_parent().get_parent() == DrawGD.main_viewport:
|
||||||
DrawGD.second_viewport.get_node("Viewport/TransparentChecker")._ready()
|
DrawGD.second_viewport.get_node("Viewport/TransparentChecker")._ready()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
tool
|
tool
|
||||||
extends Reference
|
extends Node
|
||||||
|
|
||||||
var DrawGD : Node = null
|
var DrawGD : Node = null
|
||||||
|
|
||||||
@ -31,7 +31,9 @@ func use_xdg_standard() -> bool:
|
|||||||
return OS.get_name() == "X11"
|
return OS.get_name() == "X11"
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _enter_tree() -> void:
|
||||||
|
DrawGD = get_parent()
|
||||||
|
|
||||||
if use_xdg_standard():
|
if use_xdg_standard():
|
||||||
print("Detected system where we should use XDG basedir standard (currently Linux or BSD)")
|
print("Detected system where we should use XDG basedir standard (currently Linux or BSD)")
|
||||||
var home := OS.get_environment("HOME")
|
var home := OS.get_environment("HOME")
|
||||||
|
Loading…
Reference in New Issue
Block a user