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

Allow using drawing functions outside _draw(): #4459

Open
Shidoengie opened this issue Apr 28, 2022 · 1 comment
Open

Allow using drawing functions outside _draw(): #4459

Shidoengie opened this issue Apr 28, 2022 · 1 comment

Comments

@Shidoengie
Copy link

Shidoengie commented Apr 28, 2022

Describe the project you are working on

A painting tool in godot

Describe the problem or limitation you are having in your project

Currently i have to use a for loop and a array to be able to create the pen like effect, but as its an array it will overtime consume more and more memory and create more and more lag.
Ive also had to scrap an intire pixelart drawing tool project because of this limitation and start over but this issue of not being able to draw outside the draw function still cropped up when i tried again.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It would allow me and other users to use the drawing funcs in more complex ways and would fix my issue.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Whenever i call a function for example draw_circle it would execute even if it wasnt in the draw function.
image

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes it can for instance update() can be replaced with the user placing the drawing funcs inside _process()

Is there a reason why this should be core and not an add-on in the asset library?

Because its a complete rewrite of how drawing works something on the asset library would not be able to do so.

@Calinou
Copy link
Member

Calinou commented Apr 28, 2022

I'm not sure if this would actually resolve the performance problem you're encountering here.

Either way, Godot's GUI drawing is intended to be immediate – _draw() functions exist out of technical necessity.

Currently i have to use a for loop and a array to be able to create the pen like effect, but as its an array it will overtime consume more and more memory and create more and more lag.

You can probably resolve this by "committing" the drawing to an image using a Viewport every time a stroke is finished (when the mouse button is released). Undo/redo history can be done by keeping copies of the old Images in memory.

See Pixelorama which presumably does this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants