diff --git a/src/Autoload/Tools.gd b/src/Autoload/Tools.gd index 3a79882e1..17d062e50 100644 --- a/src/Autoload/Tools.gd +++ b/src/Autoload/Tools.gd @@ -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 diff --git a/src/Classes/Layers/LayerTileMap.gd b/src/Classes/Layers/LayerTileMap.gd index d54b68882..f48ed651e 100644 --- a/src/Classes/Layers/LayerTileMap.gd +++ b/src/Classes/Layers/LayerTileMap.gd @@ -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: diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 30baf79a1..bdea6a52b 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -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) diff --git a/src/UI/Dialogs/ExportDialog.gd b/src/UI/Dialogs/ExportDialog.gd index 7f952fee7..c6f27be69 100644 --- a/src/UI/Dialogs/ExportDialog.gd +++ b/src/UI/Dialogs/ExportDialog.gd @@ -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) diff --git a/src/UI/Timeline/AnimationTimeline.gd b/src/UI/Timeline/AnimationTimeline.gd index 5173865a1..dea3d6c52 100644 --- a/src/UI/Timeline/AnimationTimeline.gd +++ b/src/UI/Timeline/AnimationTimeline.gd @@ -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: diff --git a/src/UI/Timeline/AnimationTimeline.tscn b/src/UI/Timeline/AnimationTimeline.tscn index efb04ba70..472f43816 100644 --- a/src/UI/Timeline/AnimationTimeline.tscn +++ b/src/UI/Timeline/AnimationTimeline.tscn @@ -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