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