dymokomi/luced-3d
Source of release 0.11.2
0.11.2 / src / place_prompt.luc
## Drawing on surfaces in the viewport: a drawing tool collecting corners
## (Edit Mesh's PolyDraw). The viewport turns clicks into world points
## (snapped to the edited mesh's points, else on the surface under the
## cursor, else on the ground; luce-3d SurfaceHits) and the workspace turns
## the finished drawing into one recipe step.
from luce_3d.graphics import Vector3
pub class PlacePrompt:
## The drawing tool.
pub let name: str
pub var corners: list[Vector3]
## Where the cursor would place the next corner (the rubber band's end).
pub var cursor: Vector3? = none
pub func init(self, name: str):
self.name = name
self.corners = []
## What the viewport's notice line says while drawing.
pub func hint(self) -> str:
return f"{self.name}: click to place corners (points snap), Enter or the first corner finishes, Esc cancels"