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

Bind Shape2D draw method #37903

Merged
merged 1 commit into from
Jun 16, 2020
Merged

Bind Shape2D draw method #37903

merged 1 commit into from
Jun 16, 2020

Conversation

Xrayez
Copy link
Contributor

@Xrayez Xrayez commented Apr 15, 2020

Sort of closes #6750. The method was not exposed to scripting so it wasn't actually possible to make a plugin to draw shapes out of Shape2D resources. If this is merged, then #16483 can be implemented via GDScript without much hassle.

The gist of drawing with script:

extends Node2D

var shape: Shape2D

func _draw():
	shape.draw(get_canvas_item(), color)

I have also a ShapeCast node proposal which could benefit from this (if done via script): godotengine/godot-proposals#710.

Also note that there's no 3D related drawing methods available for Shape3D (likely uses some other technique for drawing).

Also worth cherry-picking this to 3.2.

@Calinou Calinou added cherrypick:3.x Considered for cherry-picking into a future 3.x release enhancement topic:core labels Apr 15, 2020
@Calinou Calinou added this to the 4.0 milestone Apr 15, 2020
@Xrayez Xrayez requested a review from a team as a code owner April 15, 2020 15:17
@Xrayez
Copy link
Contributor Author

Xrayez commented Apr 15, 2020

Documented the method. Note that VisualServer was renamed to RenderingServer, so a reference in the documentation needs to be changed while porting this to 3.2.

@reduz
Copy link
Member

reduz commented Apr 17, 2020

This is ok, but do you think you can rename to draw_shape? as draw is a signal and those are now first class on master branch (name will collide with method).

@Xrayez
Copy link
Contributor Author

Xrayez commented Apr 17, 2020

@reduz certainly doable, but does that mean Texture's draw method should be renamed accordingly? Note that we're talking about the resources (Shape2D being resource), and not the nodes such as Node2D which does have draw signal, do I understand you correctly?

@reduz
Copy link
Member

reduz commented Jun 16, 2020

Ah I See this is for the shape itself, guess its ok then

@akien-mga akien-mga merged commit 78d09a4 into godotengine:master Jun 16, 2020
@akien-mga
Copy link
Member

Thanks!

@Xrayez Xrayez deleted the shape-2d-draw-bind branch June 16, 2020 13:25
@akien-mga
Copy link
Member

Cherry-picked for 3.2.2.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Shape2D node
4 participants