jarneson / godot-ply

Godot plugin for in-editor box modeling
MIT License
358 stars 25 forks source link

Allow loading a polygon as a starting mesh #55

Open Zireael07 opened 2 years ago

Zireael07 commented 2 years ago

Is your feature request related to a problem? Please describe. Instead of having to put a quad, then subdivide/move vertices etc, it would be easier if I could just use a polygon2d as the starting point. Extruding a polygon (that can be triangulated by Geometry.triangulate_polygon2d() ) will always be manifold, so you can just reject any that returns an empty array from triangulate_polygon2d()

Describe the solution you'd like Trying to speed up my own workflows for the car game - my car starts as a 2d polygon that outlines the shape of the car that is then extruded. I used to do it by hand with my own suite of helper scripts, but this addon is awesome and modular and would make my job much easier <3

(CSG doesn't cut it because literally, I can cut the holes for the windows but I can't then fill them in :P )

Additional context Add any other context or screenshots about the feature request here.

jarneson commented 2 years ago

https://github.com/jarneson/godot-ply/blob/main/addons/ply/resources/generate.gd has a function nGon that can work for this, just pass in the vertices. perhaps some way of extending the generate modal to pick a polygon2d or just allow an arbitrary list of verts.

Zireael07 commented 2 years ago

Yep, the nGon works :) Having fun cutting out the shape of the window rn ;)

Zireael07 commented 2 years ago

Here's an old Godot addon that has a working polygon editor: https://github.com/ppiecuch/godot-addons/blob/master/add_primitives/src/modules/Polygon.gd (link directly to polygon editor) :)