Luce packages
LuceLuce BaseLuciaOS

dymokomi/luced-3d

Source of release 0.11.7

0.11.7 / src / tools.luc

## Viewport tools: a node kind with its starting values as a new node takes
## them (ToolRun), and the transform tools with their keys. What a modeling
## tool is and starts with is the tool registry's (tool_registry.luc).
from luce_window.input import Key

## A node kind and its parameter values (every slot, defaults filled).
pub class ToolRun:
    pub let verb: str
    pub let numbers: list[float]

    pub func init(self, verb: str, numbers: list[float]):
        self.verb = verb
        self.numbers = numbers

## The viewport's transform tools (Q, W, E, R, T): Select, Move, Rotate
## and Scale with the gizmo, and the selected node's own handles.
pub func transform_tools() -> list[str]:
    return ["Select", "Move", "Rotate", "Scale", "Manipulator"]

## Their keys, Maya's (in transform_tools' order).
pub func transform_keys() -> list[Key]:
    return [Key.q, Key.w, Key.e, Key.r, Key.t]

## Their keys' names, as tooltips show them.
pub func transform_key_names() -> list[str]:
    return ["Q", "W", "E", "R", "T"]

## Whether `tool` moves, rotates or scales with the gizmo.
pub func gizmo_tool(tool: str) -> bool:
    return tool in ["Move", "Rotate", "Scale"]