1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +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", "language": "GDScript",
"path": "res://src/Classes/AnimationTag.gd" "path": "res://src/Classes/AnimationTag.gd"
}, { }, {
"base": "VBoxContainer",
"class": "BaseTool",
"language": "GDScript",
"path": "res://src/Tools/BaseTool.gd"
}, {
"base": "Popup", "base": "Popup",
"class": "Brushes", "class": "Brushes",
"language": "GDScript", "language": "GDScript",
@ -86,6 +91,7 @@ _global_script_classes=[ {
} ] } ]
_global_script_class_icons={ _global_script_class_icons={
"AnimationTag": "", "AnimationTag": "",
"BaseTool": "",
"Brushes": "", "Brushes": "",
"Canvas": "", "Canvas": "",
"Cel": "", "Cel": "",

View file

@ -1,4 +1,4 @@
extends VBoxContainer class_name BaseTool extends VBoxContainer
var kname : String var kname : String
@ -8,7 +8,7 @@ var cursor_text := ""
var _cursor := Vector2.INF var _cursor := Vector2.INF
func _ready(): func _ready() -> void:
kname = name.replace(" ", "_").to_lower() kname = name.replace(" ", "_").to_lower()
$Label.text = tool_slot.name $Label.text = tool_slot.name
@ -19,12 +19,12 @@ func _ready():
$Mirror/Vertical.pressed = tool_slot.vertical_mirror $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.pixel_perfect = button_pressed
tool_slot.save_config() 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.horizontal_mirror = button_pressed
tool_slot.save_config() tool_slot.save_config()
Global.show_y_symmetry_axis = button_pressed 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 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.vertical_mirror = button_pressed
tool_slot.save_config() tool_slot.save_config()
Global.show_x_symmetry_axis = button_pressed Global.show_x_symmetry_axis = button_pressed

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=6 format=2] [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_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/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] [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 var _pattern : Patterns.Pattern
@ -35,13 +35,13 @@ func _on_Pattern_selected(pattern : Patterns.Pattern) -> void:
save_config() save_config()
func _on_PatternOffsetX_value_changed(value : float): func _on_PatternOffsetX_value_changed(value : float) -> void:
_offset_x = int(value) _offset_x = int(value)
update_config() update_config()
save_config() save_config()
func _on_PatternOffsetY_value_changed(value : float): func _on_PatternOffsetY_value_changed(value : float) -> void:
_offset_y = int(value) _offset_y = int(value)
update_config() update_config()
save_config() save_config()

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=5 format=2] [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] [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 ) bg_color = Color( 1, 1, 1, 1 )
border_color = Color( 1, 1, 1, 1 ) border_color = Color( 1, 1, 1, 1 )
corner_radius_top_left = 5 corner_radius_top_left = 5
@ -12,7 +12,7 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5 corner_radius_bottom_left = 5
anti_aliasing = false anti_aliasing = false
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 1, 1, 1, 1 ) bg_color = Color( 1, 1, 1, 1 )
border_color = Color( 1, 1, 1, 1 ) border_color = Color( 1, 1, 1, 1 )
corner_radius_top_left = 5 corner_radius_top_left = 5
@ -81,11 +81,11 @@ rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Select a brush" hint_tooltip = "Select a brush"
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
size_flags_horizontal = 4 size_flags_horizontal = 4
custom_styles/hover = SubResource( 2 ) custom_styles/hover = SubResource( 1 )
custom_styles/pressed = SubResource( 2 ) custom_styles/pressed = SubResource( 1 )
custom_styles/focus = SubResource( 1 ) custom_styles/focus = SubResource( 2 )
custom_styles/disabled = SubResource( 1 ) custom_styles/disabled = SubResource( 2 )
custom_styles/normal = SubResource( 2 ) custom_styles/normal = SubResource( 1 )
[node name="Texture" type="TextureRect" parent="FillPattern/Type" index="0"] [node name="Texture" type="TextureRect" parent="FillPattern/Type" index="0"]
margin_right = 32.0 margin_right = 32.0

View file

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

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2] [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] [ext_resource path="res://src/Tools/ColorPicker.gd" type="Script" id=2]
[node name="ToolOptions" instance=ExtResource( 1 )] [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() var _brush := Brushes.get_default_brush()

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=5 format=2] [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] [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 ) bg_color = Color( 1, 1, 1, 1 )
border_color = Color( 1, 1, 1, 1 ) border_color = Color( 1, 1, 1, 1 )
corner_radius_top_left = 5 corner_radius_top_left = 5
@ -12,7 +12,7 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5 corner_radius_bottom_left = 5
anti_aliasing = false anti_aliasing = false
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 1, 1, 1, 1 ) bg_color = Color( 1, 1, 1, 1 )
border_color = Color( 1, 1, 1, 1 ) border_color = Color( 1, 1, 1, 1 )
corner_radius_top_left = 5 corner_radius_top_left = 5
@ -38,11 +38,11 @@ rect_min_size = Vector2( 32, 32 )
hint_tooltip = "Select a brush" hint_tooltip = "Select a brush"
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
custom_styles/hover = SubResource( 2 ) custom_styles/hover = SubResource( 1 )
custom_styles/pressed = SubResource( 2 ) custom_styles/pressed = SubResource( 1 )
custom_styles/focus = SubResource( 1 ) custom_styles/focus = SubResource( 2 )
custom_styles/disabled = SubResource( 1 ) custom_styles/disabled = SubResource( 2 )
custom_styles/normal = SubResource( 2 ) custom_styles/normal = SubResource( 1 )
[node name="Texture" type="TextureRect" parent="Brush/Type" index="0"] [node name="Texture" type="TextureRect" parent="Brush/Type" index="0"]
margin_right = 32.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: func draw_start(_position : Vector2) -> void:
Global.camera.drag = true Global.camera.drag = true

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2] [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] [ext_resource path="res://src/Tools/Pan.gd" type="Script" id=2]
[node name="ToolOptions" instance=ExtResource( 1 )] [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) var _start := Rect2(0, 0, 0, 0)

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2] [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] [ext_resource path="res://src/Tools/RectSelect.gd" type="Script" id=2]
[node name="ToolOptions" instance=ExtResource( 1 )] [node name="ToolOptions" instance=ExtResource( 1 )]

View file

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

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2] [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] [ext_resource path="res://src/Tools/Zoom.gd" type="Script" id=2]
[node name="ToolOptions" instance=ExtResource( 1 )] [node name="ToolOptions" instance=ExtResource( 1 )]