dymokomi/luced-3d
Source of release 0.11.8
0.11.8 / src / tool_prompt.luc
## A tool waiting for components (or a reselection): the node that takes the
## group and the node whose geometry is shown for picking, and what the
## viewport says while it waits (hint). A CAD tool's pick (tool_picks.luc)
## also names its tool, the pick waited for, whether the Edit node's last
## step takes it, the domain it picks on and its hint.
pub class ToolPrompt:
pub let node: int
pub let input: int
pub let label: str
pub let reselect: bool
pub let tool: str
pub let pick: int
pub let step: bool
pub let filter: int
pub let told: str
pub func init(self, node: int, input: int, label: str, reselect: bool, tool: str = "", pick: int = -1, step: bool = false, filter: int = -1, told: str = ""):
self.node = node
self.input = input
self.label = label
self.reselect = reselect
self.tool = tool
self.pick = pick
self.step = step
self.filter = filter
self.told = told
## Whether a CAD tool's pick waits (tool_picks.luc).
pub func picking(self) -> bool:
return self.tool != ""
## The domain prompt `prompt` picks on, as Fusion's selection filter for a
## command's input: only that kind lights under the pointer and is taken,
## whatever the level (2 faces, 4 edges, -2 whole bodies; -1: the level's
## own, for Tool → Select and Reselect, and profiles, which Pick profiles
## takes itself). A tool's pick says its own (pick_kinds.domain).
pub func domain(prompt: ToolPrompt) -> int:
if prompt.picking():
return prompt.filter
return -1
## What the viewport says while prompt `prompt` waits.
pub func hint(prompt: ToolPrompt) -> str:
if prompt.picking():
return prompt.told
if prompt.label == "Pick profiles":
return "Pick profiles: click regions to take or leave out, Enter to finish, Esc to cancel"
return f"{prompt.label}: select components (Shift adds), Enter to finish, Esc to cancel"