Luce packages
LuceLuce BaseLuciaOS

dymokomi/luced-3d

Source of release 0.11.6

0.11.6 / src / select_run.luc

## The Select tool run last (Blender's Adjust Last Operation for selecting):
## the tool, the selection it ran on and its numbers, and the selection it
## made. While that selection is still the current one, the tool bar shows
## the tool's rows and a change runs it again on the same seed, in the same
## undo step as the drag or the typing.
from luce_geocore.geocore import Selection
from tool_record import Tool

pub class SelectRun:
    pub let tool: Tool
    ## What it ran on: the selection then (everything for a tool that looks
    ## at everything with nothing selected).
    pub let seed: Selection
    pub let numbers: list[float]
    pub let made: Selection

    pub func init(self, tool: Tool, seed: Selection, numbers: list[float], made: Selection):
        self.tool = tool
        self.seed = seed
        self.numbers = numbers.copy()
        self.made = made

    ## Whether `current` is the selection it made (nothing changed it since).
    pub func current(self, current: Selection?) -> bool:
        let chosen = current else return false
        return chosen.key() == self.made.key()