Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GD Paint Demo Update to 4.0 #734

Merged
merged 1 commit into from
May 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2d/gd_paint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and eraser, as well as a rectangle and a circle brush.

Language: GDScript

Renderer: GLES 2
Renderer: Vulkan Mobile

Check out this demo on the asset library: https://godotengine.org/asset-library/asset/517

Expand Down
29 changes: 14 additions & 15 deletions 2d/gd_paint/icon.png.import
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
[remap]

importer="texture"
type="StreamTexture2D"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
type="CompressedTexture2D"
uid="uid://crrwsngk16wkg"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"]
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
6 changes: 2 additions & 4 deletions 2d/gd_paint/paint_control.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const UNDO_MODE_SHAPE = -2
# A constant for whether or not we can undo.
const UNDO_NONE = -1
# How large is the image (it's actually the size of DrawingAreaBG, because that's our background canvas).
const IMAGE_SIZE = Vector2(930, 720)
const IMAGE_SIZE = Vector2(674, 600)

# Enums for the various modes and brush shapes that can be applied.
enum BrushModes {
Expand Down Expand Up @@ -242,11 +242,9 @@ func save_picture(path):
await RenderingServer.frame_post_draw

# Get the viewport image.
var img = get_viewport().get_texture().get_data()
var img = get_viewport().get_texture().get_image()
# Crop the image so we only have canvas area.
var cropped_image = img.get_rect(Rect2(TL_node.global_position, IMAGE_SIZE))
# Flip the image on the Y-axis (it's flipped upside down by default).
cropped_image.flip_y()

# Save the image with the passed in path we got from the save dialog.
cropped_image.save_png(path)
Loading