mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 15:24:44 -04:00
Refactored isometric grid (#430)
* Move get_tile_mode_rect() method to the Project class * Refactored isometric grid Now it should be drawn properly in the target rect. Settings (in pixels): - cell's AABB size, - offset from the canvas origin.
This commit is contained in:
parent
9f8c9807e7
commit
9c520a65e9
10 changed files with 192 additions and 85 deletions
|
@ -20,7 +20,10 @@ var preferences = [
|
|||
["grid_type", "Canvas/GridOptions/GridType", "selected", Global.grid_type],
|
||||
["grid_width", "Canvas/GridOptions/GridWidthValue", "value", Global.grid_width],
|
||||
["grid_height", "Canvas/GridOptions/GridHeightValue", "value", Global.grid_height],
|
||||
["grid_isometric_cell_size", "Canvas/GridOptions/IsometricCellSizeValue", "value", Global.grid_isometric_cell_size],
|
||||
["grid_isometric_cell_bounds_width", "Canvas/GridOptions/IsometricCellBoundsWidthValue", "value", Global.grid_isometric_cell_bounds_width],
|
||||
["grid_isometric_cell_bounds_height", "Canvas/GridOptions/IsometricCellBoundsHeightValue", "value", Global.grid_isometric_cell_bounds_height],
|
||||
["grid_isometric_offset_x", "Canvas/GridOptions/IsometricGridOffsetXValue", "value", Global.grid_isometric_offset_x],
|
||||
["grid_isometric_offset_y", "Canvas/GridOptions/IsometricGridOffsetYValue", "value", Global.grid_isometric_offset_y],
|
||||
["grid_color", "Canvas/GridOptions/GridColor", "color", Global.grid_color],
|
||||
["pixel_grid_show_at_zoom", "Canvas/PixelGridOptions/ShowAtZoom", "value", Global.pixel_grid_show_at_zoom],
|
||||
["pixel_grid_color", "Canvas/PixelGridOptions/GridColor", "color", Global.pixel_grid_color],
|
||||
|
@ -128,8 +131,7 @@ func preference_update(prop : String) -> void:
|
|||
else:
|
||||
autosave_interval.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
||||
|
||||
if prop in ["grid_type", "grid_width", "grid_height", "grid_isometric_cell_size", "grid_color"]:
|
||||
Global.canvas.grid.isometric_polylines.clear()
|
||||
if prop in ["grid_type", "grid_width", "grid_height", "grid_isometric_cell_bounds_width", "grid_isometric_cell_bounds_height", "grid_isometric_offset_x", "grid_isometric_offset_y", "grid_color"]:
|
||||
Global.canvas.grid.update()
|
||||
|
||||
if prop in ["pixel_grid_show_at_zoom", "pixel_grid_color"]:
|
||||
|
|
|
@ -342,24 +342,88 @@ rounded = true
|
|||
align = 2
|
||||
suffix = "px"
|
||||
|
||||
[node name="IsometricCellSizeLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
[node name="IsometricCellBoundsWidthLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
margin_top = 57.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 71.0
|
||||
hint_tooltip = "Sets the size of the cells in an isometric grid"
|
||||
hint_tooltip = "Sets the width of the isometric cell's axis aligned bounding box"
|
||||
mouse_filter = 0
|
||||
text = "Isometric cell size:"
|
||||
text = "Isometric cell bounds width:"
|
||||
|
||||
[node name="IsometricCellSizeValue" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
[node name="IsometricCellBoundsWidthValue" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
margin_left = 127.0
|
||||
margin_top = 52.0
|
||||
margin_right = 230.0
|
||||
margin_bottom = 76.0
|
||||
hint_tooltip = "Sets the size of the cells in an isometric grid"
|
||||
hint_tooltip = "Sets the width of the isometric cell's axis aligned bounding box"
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = 2.0
|
||||
max_value = 16384.0
|
||||
value = 2.0
|
||||
value = 16.0
|
||||
rounded = true
|
||||
align = 2
|
||||
suffix = "px"
|
||||
|
||||
[node name="IsometricCellBoundsHeightLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
margin_top = 57.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 71.0
|
||||
hint_tooltip = "Sets the height of the isometric cell's axis aligned bounding box"
|
||||
mouse_filter = 0
|
||||
text = "Isometric cell bounds height:"
|
||||
|
||||
[node name="IsometricCellBoundsHeightValue" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
margin_left = 127.0
|
||||
margin_top = 52.0
|
||||
margin_right = 230.0
|
||||
margin_bottom = 76.0
|
||||
hint_tooltip = "Sets the height of the isometric cell's axis aligned bounding box"
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = 2.0
|
||||
max_value = 16384.0
|
||||
value = 8.0
|
||||
rounded = true
|
||||
align = 2
|
||||
suffix = "px"
|
||||
|
||||
[node name="IsometricGridOffsetXLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
margin_top = 57.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 71.0
|
||||
hint_tooltip = "Sets isometric grid's x offset from the canvas origin (top left corner of the image)"
|
||||
mouse_filter = 0
|
||||
text = "Isometric grid offset x:"
|
||||
|
||||
[node name="IsometricGridOffsetXValue" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
margin_left = 127.0
|
||||
margin_top = 52.0
|
||||
margin_right = 230.0
|
||||
margin_bottom = 76.0
|
||||
hint_tooltip = "Sets isometric grid's x offset from the canvas origin (top left corner of the image)"
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = -16384.0
|
||||
max_value = 16384.0
|
||||
rounded = true
|
||||
align = 2
|
||||
suffix = "px"
|
||||
|
||||
[node name="IsometricGridOffsetYLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
margin_top = 57.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 71.0
|
||||
hint_tooltip = "Sets isometric grid's y offset from the canvas origin (top left corner of the image)"
|
||||
mouse_filter = 0
|
||||
text = "Isometric grid offset y:"
|
||||
|
||||
[node name="IsometricGridOffsetYValue" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/GridOptions"]
|
||||
margin_left = 127.0
|
||||
margin_top = 52.0
|
||||
margin_right = 230.0
|
||||
margin_bottom = 76.0
|
||||
hint_tooltip = "Sets isometric grid's y offset from the canvas origin (top left corner of the image)"
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = -16384.0
|
||||
max_value = 16384.0
|
||||
rounded = true
|
||||
align = 2
|
||||
suffix = "px"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue