1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Renamed "Base" to "BaseTool" and made it a class

This commit is contained in:
Manolis Papadeas 2021-02-02 17:48:17 +02:00
parent dc469dd4b5
commit ce7320ad4f
17 changed files with 47 additions and 40 deletions

View file

@ -14,6 +14,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/Classes/AnimationTag.gd"
}, {
"base": "VBoxContainer",
"class": "BaseTool",
"language": "GDScript",
"path": "res://src/Tools/BaseTool.gd"
}, {
"base": "Popup",
"class": "Brushes",
"language": "GDScript",
@ -86,6 +91,7 @@ _global_script_classes=[ {
} ]
_global_script_class_icons={
"AnimationTag": "",
"BaseTool": "",
"Brushes": "",
"Canvas": "",
"Cel": "",

View file

@ -16,7 +16,7 @@ func _ready() -> void:
alternate_transparent_background.anchor_top = ANCHOR_BEGIN
alternate_transparent_background.anchor_right = ANCHOR_END
alternate_transparent_background.anchor_bottom = ANCHOR_END
get_tree().set_auto_accept_quit(false)
setup_application_window_size()

View file

@ -1,4 +1,4 @@
extends VBoxContainer
class_name BaseTool extends VBoxContainer
var kname : String
@ -8,7 +8,7 @@ var cursor_text := ""
var _cursor := Vector2.INF
func _ready():
func _ready() -> void:
kname = name.replace(" ", "_").to_lower()
$Label.text = tool_slot.name
@ -19,12 +19,12 @@ func _ready():
$Mirror/Vertical.pressed = tool_slot.vertical_mirror
func _on_PixelPerfect_toggled(button_pressed : bool):
func _on_PixelPerfect_toggled(button_pressed : bool) -> void:
tool_slot.pixel_perfect = button_pressed
tool_slot.save_config()
func _on_Horizontal_toggled(button_pressed : bool):
func _on_Horizontal_toggled(button_pressed : bool) -> void:
tool_slot.horizontal_mirror = button_pressed
tool_slot.save_config()
Global.show_y_symmetry_axis = button_pressed
@ -34,7 +34,7 @@ func _on_Horizontal_toggled(button_pressed : bool):
Global.current_project.y_symmetry_axis.visible = Global.show_y_symmetry_axis and Global.show_guides
func _on_Vertical_toggled(button_pressed : bool):
func _on_Vertical_toggled(button_pressed : bool) -> void:
tool_slot.vertical_mirror = button_pressed
tool_slot.save_config()
Global.show_x_symmetry_axis = button_pressed

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://src/Tools/Base.gd" type="Script" id=1]
[ext_resource path="res://src/Tools/BaseTool.gd" type="Script" id=1]
[ext_resource path="res://assets/graphics/dark_themes/tools/horizontal_mirror_on.png" type="Texture" id=2]
[ext_resource path="res://assets/graphics/dark_themes/tools/horizontal_mirror_off.png" type="Texture" id=3]
[ext_resource path="res://assets/graphics/dark_themes/tools/vertical_mirror_on.png" type="Texture" id=4]

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/Base.gd"
extends BaseTool
var _pattern : Patterns.Pattern
@ -35,13 +35,13 @@ func _on_Pattern_selected(pattern : Patterns.Pattern) -> void:
save_config()
func _on_PatternOffsetX_value_changed(value : float):
func _on_PatternOffsetX_value_changed(value : float) -> void:
_offset_x = int(value)
update_config()
save_config()
func _on_PatternOffsetY_value_changed(value : float):
func _on_PatternOffsetY_value_changed(value : float) -> void:
_offset_y = int(value)
update_config()
save_config()

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/Tools/Base.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Tools/BaseTool.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Tools/Bucket.gd" type="Script" id=3]
[sub_resource type="StyleBoxFlat" id=2]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 1, 1, 1, 1 )
border_color = Color( 1, 1, 1, 1 )
corner_radius_top_left = 5
@ -12,7 +12,7 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
anti_aliasing = false
[sub_resource type="StyleBoxFlat" id=1]
[sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 1, 1, 1, 1 )
border_color = Color( 1, 1, 1, 1 )
corner_radius_top_left = 5
@ -81,11 +81,11 @@ rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Select a brush"
mouse_default_cursor_shape = 2
size_flags_horizontal = 4
custom_styles/hover = SubResource( 2 )
custom_styles/pressed = SubResource( 2 )
custom_styles/focus = SubResource( 1 )
custom_styles/disabled = SubResource( 1 )
custom_styles/normal = SubResource( 2 )
custom_styles/hover = SubResource( 1 )
custom_styles/pressed = SubResource( 1 )
custom_styles/focus = SubResource( 2 )
custom_styles/disabled = SubResource( 2 )
custom_styles/normal = SubResource( 1 )
[node name="Texture" type="TextureRect" parent="FillPattern/Type" index="0"]
margin_right = 32.0

View file

@ -1,10 +1,10 @@
extends "res://src/Tools/Base.gd"
extends BaseTool
var _color_slot := 0
func _on_Options_item_selected(id):
func _on_Options_item_selected(id : int) -> void:
_color_slot = id
update_config()
save_config()

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/Tools/Base.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Tools/BaseTool.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Tools/ColorPicker.gd" type="Script" id=2]
[node name="ToolOptions" instance=ExtResource( 1 )]

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/Base.gd"
extends BaseTool
var _brush := Brushes.get_default_brush()

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/Tools/Base.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Tools/BaseTool.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Tools/Draw.gd" type="Script" id=3]
[sub_resource type="StyleBoxFlat" id=2]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 1, 1, 1, 1 )
border_color = Color( 1, 1, 1, 1 )
corner_radius_top_left = 5
@ -12,7 +12,7 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
anti_aliasing = false
[sub_resource type="StyleBoxFlat" id=1]
[sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 1, 1, 1, 1 )
border_color = Color( 1, 1, 1, 1 )
corner_radius_top_left = 5
@ -38,11 +38,11 @@ rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Select a brush"
mouse_default_cursor_shape = 2
size_flags_horizontal = 0
custom_styles/hover = SubResource( 2 )
custom_styles/pressed = SubResource( 2 )
custom_styles/focus = SubResource( 1 )
custom_styles/disabled = SubResource( 1 )
custom_styles/normal = SubResource( 2 )
custom_styles/hover = SubResource( 1 )
custom_styles/pressed = SubResource( 1 )
custom_styles/focus = SubResource( 2 )
custom_styles/disabled = SubResource( 2 )
custom_styles/normal = SubResource( 1 )
[node name="Texture" type="TextureRect" parent="Brush/Type" index="0"]
margin_right = 32.0

View file

@ -1,4 +1,5 @@
extends "res://src/Tools/Base.gd"
extends BaseTool
func draw_start(_position : Vector2) -> void:
Global.camera.drag = true

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/Tools/Base.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Tools/BaseTool.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Tools/Pan.gd" type="Script" id=2]
[node name="ToolOptions" instance=ExtResource( 1 )]

View file

@ -1,4 +1,4 @@
extends "res://src/Tools/Base.gd"
extends BaseTool
var _start := Rect2(0, 0, 0, 0)

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/Tools/Base.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Tools/BaseTool.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Tools/RectSelect.gd" type="Script" id=2]
[node name="ToolOptions" instance=ExtResource( 1 )]

View file

@ -1,20 +1,20 @@
extends "res://src/Tools/Base.gd"
extends BaseTool
var _zoom_mode := 0
func _on_ModeOptions_item_selected(id):
func _on_ModeOptions_item_selected(id : int) -> void:
_zoom_mode = id
update_config()
save_config()
func _on_FitToFrame_pressed():
func _on_FitToFrame_pressed() -> void:
Global.camera.fit_to_frame(Global.current_project.size)
func _on_100_pressed():
func _on_100_pressed() -> void:
Global.camera.zoom_100()

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/Tools/Base.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Tools/BaseTool.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Tools/Zoom.gd" type="Script" id=2]
[node name="ToolOptions" instance=ExtResource( 1 )]

View file

@ -37,7 +37,7 @@ func transparency(value :float) -> void:
OS.window_per_pixel_transparency_enabled = true
get_parent().transparent_bg = true
get_tree().get_root().set_transparent_background(true)
# this controls opacity 0 for transparent, 1 or a greater value than 1 is opaque
# i have set a minimum amount for the fade (We would'nt want the canvas to dissapear now would we?)
material.set("shader_param/alpha",clamp(value,0.1,1))