mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 15:24:44 -04:00
Draw Grid only over Canvas. Added PixelGrid. (#427)
* Draw grid only over the Canvas (when in tiling mode) * Replace some magic numbers with enums. It's too easy to break something when adding something new in here. Should be a little harder now. * Added Pixel Grid. - Pixel grid is shown only when it's enabled and camera is zoomed close enough. - Settings: pixel_grid_show_at_zoom (as a percentage because that's what's shown in the settings panel), pixel_grid_color. Default values might need changing. - To distinguish between grid and pixel grid default settings for grid width, grid height are changed. - Now both grid and pixel grid are drawn above (after) tile mode. Grid is drawn above (after) pixel grid.
This commit is contained in:
parent
4da4f4ebb8
commit
db9980a883
14 changed files with 239 additions and 98 deletions
|
@ -22,6 +22,8 @@ var preferences = [
|
|||
["grid_height", "Canvas/GridOptions/GridHeightValue", "value", Global.grid_height],
|
||||
["grid_isometric_cell_size", "Canvas/GridOptions/IsometricCellSizeValue", "value", Global.grid_isometric_cell_size],
|
||||
["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],
|
||||
["guide_color", "Canvas/GuideOptions/GuideColor", "color", Global.guide_color],
|
||||
["checker_size", "Canvas/CheckerOptions/CheckerSizeValue", "value", Global.checker_size],
|
||||
["checker_color_1", "Canvas/CheckerOptions/CheckerColor1", "color", Global.checker_color_1],
|
||||
|
@ -130,6 +132,9 @@ func preference_update(prop : String) -> void:
|
|||
Global.canvas.grid.isometric_polylines.clear()
|
||||
Global.canvas.grid.update()
|
||||
|
||||
if prop in ["pixel_grid_show_at_zoom", "pixel_grid_color"]:
|
||||
Global.canvas.pixel_grid.update()
|
||||
|
||||
if prop in ["checker_size", "checker_color_1", "checker_color_2", "checker_follow_movement", "checker_follow_scale"]:
|
||||
Global.transparent_checker._ready()
|
||||
|
||||
|
|
|
@ -386,6 +386,67 @@ margin_top = 226.0
|
|||
margin_right = 498.0
|
||||
margin_bottom = 230.0
|
||||
|
||||
[node name="PixelGridLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas"]
|
||||
margin_top = 234.0
|
||||
margin_right = 498.0
|
||||
margin_bottom = 248.0
|
||||
text = "Pixel Grid"
|
||||
|
||||
[node name="PixelGridOptions" type="GridContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas"]
|
||||
margin_top = 122.0
|
||||
margin_right = 498.0
|
||||
margin_bottom = 222.0
|
||||
custom_constants/vseparation = 4
|
||||
custom_constants/hseparation = 4
|
||||
columns = 3
|
||||
|
||||
[node name="ShowAtZoomLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/PixelGridOptions"]
|
||||
margin_left = 234.0
|
||||
margin_top = 3.0
|
||||
margin_right = 344.0
|
||||
margin_bottom = 17.0
|
||||
rect_min_size = Vector2( 110, 0 )
|
||||
hint_tooltip = "Sets the minimal zoom at which pixel grid will be shown"
|
||||
mouse_filter = 0
|
||||
text = "Show at zoom:"
|
||||
|
||||
[node name="ShowAtZoom" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/PixelGridOptions"]
|
||||
margin_top = 24.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 48.0
|
||||
rect_min_size = Vector2( 80, 0 )
|
||||
hint_tooltip = "Sets the minimal zoom at which pixel grid will be shown"
|
||||
mouse_default_cursor_shape = 2
|
||||
min_value = 500.0
|
||||
max_value = 16384.0
|
||||
step = 100.0
|
||||
value = 1500.0
|
||||
rounded = true
|
||||
align = 2
|
||||
suffix = "%"
|
||||
|
||||
[node name="GridColorLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/PixelGridOptions"]
|
||||
margin_left = 234.0
|
||||
margin_top = 57.0
|
||||
margin_right = 344.0
|
||||
margin_bottom = 71.0
|
||||
hint_tooltip = "A color of the pixel grid"
|
||||
mouse_filter = 0
|
||||
text = "Pixel grid color:"
|
||||
|
||||
[node name="GridColor" type="ColorPickerButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas/PixelGridOptions"]
|
||||
margin_top = 80.0
|
||||
margin_right = 123.0
|
||||
margin_bottom = 100.0
|
||||
rect_min_size = Vector2( 64, 20 )
|
||||
hint_tooltip = "A color of the pixel grid"
|
||||
mouse_default_cursor_shape = 2
|
||||
|
||||
[node name="HSeparator4" type="HSeparator" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas"]
|
||||
margin_top = 226.0
|
||||
margin_right = 498.0
|
||||
margin_bottom = 230.0
|
||||
|
||||
[node name="TransparencyLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Canvas"]
|
||||
margin_top = 234.0
|
||||
margin_right = 498.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue