mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 09:39:48 +00:00
Add tilemap layers
This commit is contained in:
parent
85854b3490
commit
dab8c5bed5
|
@ -88,7 +88,11 @@ var tools := {
|
|||
),
|
||||
"Move":
|
||||
Tool.new(
|
||||
"Move", "Move", "move", "res://src/Tools/UtilityTools/Move.tscn", [Global.LayerTypes.PIXEL]
|
||||
"Move",
|
||||
"Move",
|
||||
"move",
|
||||
"res://src/Tools/UtilityTools/Move.tscn",
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP]
|
||||
),
|
||||
"Zoom": Tool.new("Zoom", "Zoom", "zoom", "res://src/Tools/UtilityTools/Zoom.tscn"),
|
||||
"Pan": Tool.new("Pan", "Pan", "pan", "res://src/Tools/UtilityTools/Pan.tscn"),
|
||||
|
@ -116,7 +120,7 @@ var tools := {
|
|||
"Pencil",
|
||||
"pencil",
|
||||
"res://src/Tools/DesignTools/Pencil.tscn",
|
||||
[Global.LayerTypes.PIXEL],
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP],
|
||||
"Hold %s to make a line",
|
||||
["draw_create_line"]
|
||||
),
|
||||
|
@ -126,7 +130,7 @@ var tools := {
|
|||
"Eraser",
|
||||
"eraser",
|
||||
"res://src/Tools/DesignTools/Eraser.tscn",
|
||||
[Global.LayerTypes.PIXEL],
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP],
|
||||
"Hold %s to make a line",
|
||||
["draw_create_line"]
|
||||
),
|
||||
|
@ -136,7 +140,7 @@ var tools := {
|
|||
"Bucket",
|
||||
"fill",
|
||||
"res://src/Tools/DesignTools/Bucket.tscn",
|
||||
[Global.LayerTypes.PIXEL]
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP]
|
||||
),
|
||||
"Shading":
|
||||
Tool.new(
|
||||
|
@ -144,7 +148,7 @@ var tools := {
|
|||
"Shading Tool",
|
||||
"shading",
|
||||
"res://src/Tools/DesignTools/Shading.tscn",
|
||||
[Global.LayerTypes.PIXEL]
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP]
|
||||
),
|
||||
"LineTool":
|
||||
(
|
||||
|
@ -154,7 +158,7 @@ var tools := {
|
|||
"Line Tool",
|
||||
"linetool",
|
||||
"res://src/Tools/DesignTools/LineTool.tscn",
|
||||
[Global.LayerTypes.PIXEL],
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP],
|
||||
"""Hold %s to snap the angle of the line
|
||||
Hold %s to center the shape on the click origin
|
||||
Hold %s to displace the shape's origin""",
|
||||
|
@ -169,7 +173,7 @@ Hold %s to displace the shape's origin""",
|
|||
"Curve Tool",
|
||||
"curvetool",
|
||||
"res://src/Tools/DesignTools/CurveTool.tscn",
|
||||
[Global.LayerTypes.PIXEL],
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP],
|
||||
"""Draws bezier curves
|
||||
Press %s/%s to add new points
|
||||
Press and drag to control the curvature
|
||||
|
@ -185,7 +189,7 @@ Press %s to remove the last added point""",
|
|||
"Rectangle Tool",
|
||||
"rectangletool",
|
||||
"res://src/Tools/DesignTools/RectangleTool.tscn",
|
||||
[Global.LayerTypes.PIXEL],
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP],
|
||||
"""Hold %s to create a 1:1 shape
|
||||
Hold %s to center the shape on the click origin
|
||||
Hold %s to displace the shape's origin""",
|
||||
|
@ -200,7 +204,7 @@ Hold %s to displace the shape's origin""",
|
|||
"Ellipse Tool",
|
||||
"ellipsetool",
|
||||
"res://src/Tools/DesignTools/EllipseTool.tscn",
|
||||
[Global.LayerTypes.PIXEL],
|
||||
[Global.LayerTypes.PIXEL, Global.LayerTypes.TILEMAP],
|
||||
"""Hold %s to create a 1:1 shape
|
||||
Hold %s to center the shape on the click origin
|
||||
Hold %s to displace the shape's origin""",
|
||||
|
@ -232,10 +236,12 @@ var _panels := {}
|
|||
var _curr_layer_type := Global.LayerTypes.PIXEL
|
||||
var _left_tools_per_layer_type := {
|
||||
Global.LayerTypes.PIXEL: "Pencil",
|
||||
Global.LayerTypes.TILEMAP: "Pencil",
|
||||
Global.LayerTypes.THREE_D: "3DShapeEdit",
|
||||
}
|
||||
var _right_tools_per_layer_type := {
|
||||
Global.LayerTypes.PIXEL: "Eraser",
|
||||
Global.LayerTypes.TILEMAP: "Eraser",
|
||||
Global.LayerTypes.THREE_D: "Pan",
|
||||
}
|
||||
var _tool_buttons: Node
|
||||
|
|
|
@ -7,6 +7,8 @@ var tileset: TileSetCustom
|
|||
func _init(_project: Project, _tileset: TileSetCustom, _name := "") -> void:
|
||||
super._init(_project, _name)
|
||||
tileset = _tileset
|
||||
if not project.tilesets.has(tileset):
|
||||
project.add_tileset(tileset)
|
||||
|
||||
|
||||
# Overridden Methods:
|
||||
|
|
|
@ -85,6 +85,7 @@ var selection_offset := Vector2i.ZERO:
|
|||
selection_offset = value
|
||||
Global.canvas.selection.marching_ants_outline.offset = selection_offset
|
||||
var has_selection := false
|
||||
var tilesets: Array[TileSetCustom]
|
||||
|
||||
## For every camera (currently there are 3)
|
||||
var cameras_rotation: PackedFloat32Array = [0.0, 0.0, 0.0]
|
||||
|
@ -931,3 +932,7 @@ func reorder_reference_image(from: int, to: int) -> void:
|
|||
var ri: ReferenceImage = reference_images.pop_at(from)
|
||||
reference_images.insert(to, ri)
|
||||
Global.canvas.reference_image_container.move_child(ri, to)
|
||||
|
||||
|
||||
func add_tileset(tileset: TileSetCustom) -> void:
|
||||
tilesets.append(tileset)
|
||||
|
|
|
@ -231,6 +231,8 @@ func create_layer_list() -> void:
|
|||
layer_name = tr("Group layer:")
|
||||
elif layer is Layer3D:
|
||||
layer_name = tr("3D layer:")
|
||||
elif layer is LayerTileMap:
|
||||
layer_name = tr("Tilemap layer:")
|
||||
layer_name += " %s" % layer.get_layer_path()
|
||||
layers_option_button.add_item(layer_name)
|
||||
|
||||
|
|
|
@ -846,6 +846,8 @@ func add_layer(type := 0) -> void:
|
|||
Global.LayerTypes.THREE_D:
|
||||
l = Layer3D.new(project)
|
||||
SteamManager.set_achievement("ACH_3D_LAYER")
|
||||
Global.LayerTypes.TILEMAP:
|
||||
l = LayerTileMap.new(project, TileSetCustom.new(Vector2i(16, 16)))
|
||||
|
||||
var cels := []
|
||||
for f in project.frames:
|
||||
|
|
|
@ -239,12 +239,14 @@ offset_left = -22.0
|
|||
offset_top = -10.0
|
||||
offset_bottom = 10.0
|
||||
mouse_default_cursor_shape = 2
|
||||
item_count = 3
|
||||
item_count = 4
|
||||
popup/item_0/text = "Add Pixel Layer"
|
||||
popup/item_1/text = "Add Group Layer"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "Add 3D Layer"
|
||||
popup/item_2/id = 2
|
||||
popup/item_3/text = "Add Tilemap Layer"
|
||||
popup/item_3/id = 3
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/LayerTools/MarginContainer/LayerSettingsContainer/LayerButtons/AddLayer/AddLayerList"]
|
||||
layout_mode = 0
|
||||
|
|
Loading…
Reference in a new issue