mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Add a new "CanvasPreviews" node group for the canvas previews
This commit is contained in:
parent
b79ce0ae15
commit
d05787d6ef
|
@ -64,6 +64,7 @@ enabled=PackedStringArray("res://addons/aimg_io/plugin.cfg", "res://addons/docka
|
||||||
[global_group]
|
[global_group]
|
||||||
|
|
||||||
CanvasCameras=""
|
CanvasCameras=""
|
||||||
|
CanvasPreviews=""
|
||||||
|
|
||||||
[importer_defaults]
|
[importer_defaults]
|
||||||
|
|
||||||
|
|
|
@ -608,18 +608,8 @@ var cel_button_scene: PackedScene = load("res://src/UI/Timeline/CelButton.tscn")
|
||||||
@onready var main_viewport: SubViewportContainer = control.find_child("SubViewportContainer")
|
@onready var main_viewport: SubViewportContainer = control.find_child("SubViewportContainer")
|
||||||
## The main canvas node. It has the [param Canvas.gd] script attached.
|
## The main canvas node. It has the [param Canvas.gd] script attached.
|
||||||
@onready var canvas: Canvas = main_viewport.find_child("Canvas")
|
@onready var canvas: Canvas = main_viewport.find_child("Canvas")
|
||||||
## Contains viewport of the second canvas preview.
|
|
||||||
## It has the [param ViewportContainer.gd] script attached.
|
|
||||||
@onready var second_viewport: SubViewportContainer = control.find_child("Second Canvas")
|
|
||||||
## The panel container of the canvas preview.
|
|
||||||
## It has the [param CanvasPreviewContainer.gd] script attached.
|
|
||||||
@onready var canvas_preview_container: Container = control.find_child("Canvas Preview")
|
|
||||||
## The global tool options. It has the [param GlobalToolOptions.gd] script attached.
|
## The global tool options. It has the [param GlobalToolOptions.gd] script attached.
|
||||||
@onready var global_tool_options: PanelContainer = control.find_child("Global Tool Options")
|
@onready var global_tool_options: PanelContainer = control.find_child("Global Tool Options")
|
||||||
## Contains viewport of the canvas preview.
|
|
||||||
@onready var small_preview_viewport: SubViewportContainer = canvas_preview_container.find_child(
|
|
||||||
"PreviewViewportContainer"
|
|
||||||
)
|
|
||||||
## Camera of the main canvas.
|
## Camera of the main canvas.
|
||||||
@onready var camera: CanvasCamera = main_viewport.find_child("Camera2D")
|
@onready var camera: CanvasCamera = main_viewport.find_child("Camera2D")
|
||||||
## Horizontal ruler of the main canvas. It has the [param HorizontalRuler.gd] script attached.
|
## Horizontal ruler of the main canvas. It has the [param HorizontalRuler.gd] script attached.
|
||||||
|
@ -956,8 +946,8 @@ func undo_or_redo(
|
||||||
|
|
||||||
await RenderingServer.frame_post_draw
|
await RenderingServer.frame_post_draw
|
||||||
canvas.queue_redraw()
|
canvas.queue_redraw()
|
||||||
second_viewport.get_child(0).get_node("CanvasPreview").queue_redraw()
|
for canvas_preview in get_tree().get_nodes_in_group("CanvasPreviews"):
|
||||||
canvas_preview_container.canvas_preview.queue_redraw()
|
canvas_preview.queue_redraw()
|
||||||
if !project.has_changed:
|
if !project.has_changed:
|
||||||
if project == current_project:
|
if project == current_project:
|
||||||
get_window().title = get_window().title + "(*)"
|
get_window().title = get_window().title + "(*)"
|
||||||
|
|
|
@ -74,7 +74,7 @@ render_target_update_mode = 4
|
||||||
material = SubResource("1")
|
material = SubResource("1")
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
|
|
||||||
[node name="CanvasPreview" parent="VBox/HBox/PreviewViewportContainer/SubViewport" instance=ExtResource("5")]
|
[node name="CanvasPreview" parent="VBox/HBox/PreviewViewportContainer/SubViewport" groups=["CanvasPreviews"] instance=ExtResource("5")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
[node name="CameraPreview" type="Node2D" parent="VBox/HBox/PreviewViewportContainer/SubViewport" groups=["CanvasCameras"]]
|
[node name="CameraPreview" type="Node2D" parent="VBox/HBox/PreviewViewportContainer/SubViewport" groups=["CanvasCameras"]]
|
||||||
|
|
|
@ -11,8 +11,8 @@ func update_rect() -> void:
|
||||||
set_bounds(Global.current_project.size)
|
set_bounds(Global.current_project.size)
|
||||||
if self == Global.transparent_checker:
|
if self == Global.transparent_checker:
|
||||||
fit_rect(Global.current_project.tiles.get_bounding_rect())
|
fit_rect(Global.current_project.tiles.get_bounding_rect())
|
||||||
Global.second_viewport.get_node("SubViewport/TransparentChecker").update_rect()
|
for canvas_preview in get_tree().get_nodes_in_group("CanvasPreviews"):
|
||||||
Global.small_preview_viewport.get_node("SubViewport/TransparentChecker").update_rect()
|
canvas_preview.get_viewport().get_node("TransparentChecker").update_rect()
|
||||||
material.set_shader_parameter("size", Global.checker_size)
|
material.set_shader_parameter("size", Global.checker_size)
|
||||||
material.set_shader_parameter("color1", Global.checker_color_1)
|
material.set_shader_parameter("color1", Global.checker_color_1)
|
||||||
material.set_shader_parameter("color2", Global.checker_color_2)
|
material.set_shader_parameter("color2", Global.checker_color_2)
|
||||||
|
|
|
@ -359,7 +359,7 @@ render_target_update_mode = 0
|
||||||
material = SubResource("3")
|
material = SubResource("3")
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
|
|
||||||
[node name="CanvasPreview" parent="DockableContainer/Second Canvas/SubViewport" instance=ExtResource("2")]
|
[node name="CanvasPreview" parent="DockableContainer/Second Canvas/SubViewport" groups=["CanvasPreviews"] instance=ExtResource("2")]
|
||||||
|
|
||||||
[node name="Camera2D2" type="Node2D" parent="DockableContainer/Second Canvas/SubViewport" groups=["CanvasCameras"]]
|
[node name="Camera2D2" type="Node2D" parent="DockableContainer/Second Canvas/SubViewport" groups=["CanvasCameras"]]
|
||||||
script = ExtResource("7")
|
script = ExtResource("7")
|
||||||
|
|
Loading…
Reference in a new issue