1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Made TransparentChecker shader material unique for the main two viewports

Fixes #377. The issue was that the shader material was being shared with the background of the cel buttons, and when the cel button transparent background was resized, the canvas transparent background was also affected.
This commit is contained in:
Manolis Papadeas 2020-11-26 02:05:05 +02:00
parent 512507e2c7
commit b1e8bf98d2
6 changed files with 49 additions and 6 deletions

View file

@ -34,6 +34,7 @@ PinyaColada, Rémi Verschelde (akien-mga), dasimonde, gschwind, AbhinavKDev
- Fixed "Export" option in the File menu not working properly and not remembering the directory path and file name when switching between projects (tabs).
- When opening a .pxo project which has guides, they will no longer be added to the project at the first tab too.
- Symmetry guides now adjust their position when the image is being resized. ([#379](https://github.com/Orama-Interactive/Pixelorama/issues/379))
- Fixed various issues with the transparent background checker size. ([#377](https://github.com/Orama-Interactive/Pixelorama/issues/377))
- Fixed Chinese and Korean characters not displaying properly in the Splash dialog and the About dialog.
- Fixed crash when importing an incorrectly formatted GIMP Color Palette file. ([#363](https://github.com/Orama-Interactive/Pixelorama/issues/363))
- Using the lighten/darken on pixels with an alpha value of 0 no longer has an effect on them.

View file

@ -38,8 +38,7 @@ func _on_ResizeCanvas_about_to_show() -> void:
if first_time:
width_spinbox.value = Global.current_project.size.x
height_spinbox.value = Global.current_project.size.y
else:
update_preview()
update_preview()
func _on_ResizeCanvas_confirmed() -> void:

View file

@ -1,7 +1,19 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/UI/Timeline/CelButton.gd" type="Script" id=1]
[ext_resource path="res://src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
[ext_resource path="res://src/Shaders/TransparentChecker.shader" type="Shader" id=3]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 3 )
shader_param/size = 10.0
shader_param/color1 = Color( 0.7, 0.7, 0.7, 1 )
shader_param/color2 = Color( 1, 1, 1, 1 )
shader_param/offset = Vector2( 0, 0 )
shader_param/scale = Vector2( 0, 0 )
shader_param/rect_size = Vector2( 0, 0 )
shader_param/follow_movement = false
shader_param/follow_scale = false
[node name="CelButton" type="Button"]
margin_top = 18.0
@ -34,6 +46,7 @@ __meta__ = {
[node name="TransparentChecker" parent="CelTexture" instance=ExtResource( 2 )]
show_behind_parent = true
material = SubResource( 1 )
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = 0.0

View file

@ -19,11 +19,11 @@ func update_offset(offset : Vector2, scale : Vector2) -> void:
material.set_shader_param("scale", scale)
func _on_TransparentChecker_resized():
func _on_TransparentChecker_resized() -> void:
material.set_shader_param("rect_size", rect_size)
func _init_position(id : int):
func _init_position(id : int) -> void:
match id:
0:
Global.current_project.tile_mode = Global.Tile_Mode.NONE

View file

@ -8,6 +8,11 @@ shader = ExtResource( 1 )
shader_param/size = 10.0
shader_param/color1 = Color( 0.7, 0.7, 0.7, 1 )
shader_param/color2 = Color( 1, 1, 1, 1 )
shader_param/offset = Vector2( 0, 0 )
shader_param/scale = Vector2( 0, 0 )
shader_param/rect_size = Vector2( 0, 0 )
shader_param/follow_movement = false
shader_param/follow_scale = false
[node name="TransparentChecker" type="ColorRect"]
material = SubResource( 1 )

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=2]
[gd_scene load_steps=26 format=2]
[ext_resource path="res://src/UI/ToolButtons.gd" type="Script" id=1]
[ext_resource path="res://src/UI/Canvas/CanvasPreview.tscn" type="PackedScene" id=2]
@ -8,6 +8,7 @@
[ext_resource path="res://src/UI/Canvas/Rulers/HorizontalRuler.gd" type="Script" id=6]
[ext_resource path="res://src/UI/Canvas/CameraMovement.gd" type="Script" id=7]
[ext_resource path="res://src/SelectionRectangle.gd" type="Script" id=8]
[ext_resource path="res://src/Shaders/TransparentChecker.shader" type="Shader" id=9]
[ext_resource path="res://assets/graphics/dark_themes/tools/bucket.png" type="Texture" id=10]
[ext_resource path="res://assets/graphics/dark_themes/tools/colorpicker.png" type="Texture" id=11]
[ext_resource path="res://assets/graphics/dark_themes/tools/rectselect.png" type="Texture" id=12]
@ -22,6 +23,28 @@
[ext_resource path="res://assets/graphics/dark_themes/tools/zoom.png" type="Texture" id=21]
[ext_resource path="res://src/UI/ViewportContainer.gd" type="Script" id=23]
[sub_resource type="ShaderMaterial" id=2]
shader = ExtResource( 9 )
shader_param/size = 10.0
shader_param/color1 = Color( 0.7, 0.7, 0.7, 1 )
shader_param/color2 = Color( 1, 1, 1, 1 )
shader_param/offset = Vector2( 0, 0 )
shader_param/scale = Vector2( 0, 0 )
shader_param/rect_size = Vector2( 0, 0 )
shader_param/follow_movement = false
shader_param/follow_scale = false
[sub_resource type="ShaderMaterial" id=3]
shader = ExtResource( 9 )
shader_param/size = 10.0
shader_param/color1 = Color( 0.7, 0.7, 0.7, 1 )
shader_param/color2 = Color( 1, 1, 1, 1 )
shader_param/offset = Vector2( 0, 0 )
shader_param/scale = Vector2( 0, 0 )
shader_param/rect_size = Vector2( 0, 0 )
shader_param/follow_movement = false
shader_param/follow_scale = false
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.0627451, 0.0627451, 0.0627451, 1 )
expand_margin_top = 6.0
@ -276,6 +299,7 @@ usage = 0
render_target_update_mode = 3
[node name="TransparentChecker" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer/Viewport" instance=ExtResource( 5 )]
material = SubResource( 2 )
[node name="Canvas" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer/Viewport" instance=ExtResource( 19 )]
@ -307,6 +331,7 @@ handle_input_locally = false
render_target_update_mode = 3
[node name="TransparentChecker" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer/ViewportContainer2/Viewport" instance=ExtResource( 5 )]
material = SubResource( 3 )
[node name="CanvasPreview" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer/ViewportContainer2/Viewport" instance=ExtResource( 2 )]