Luce packages
LuceLuce BaseLuciaOS

dymokomi/luced-3d

Source of release 0.11.4

0.11.4 / src / tool_icons.luc

## Shared LuciaOS Rounded SVGs, rendered by luce-ui's cached luce-svg pipeline.
## Original assets and extensions: Dy Mokomi, CC BY 4.0.
from luce_ui.ui import Painter
from luce_gpu.gpu import Color, Rect
from luce_ui import ui

pub func asset_name(name: str) -> str:
    if name in ["Cube", "Sphere", "Cylinder", "Cone", "Torus"]: return name.lower()
    if name == "Grid": return "grid"
    if name == "Hulls": return "node-tool"
    if name == "File": return "import"
    if name == "Export": return "export"
    if name == "Group": return "group"
    if name == "CAD": return "package"
    if name == "Extrude": return "extrude"
    if name == "Sketch": return "pen-tool"
    if name == "Revolve": return "rotate-tool"
    if name == "Boolean": return "boolean-subtract"
    if name in ["Fillet", "Chamfer"]: return "bevel"
    if name == "Mirror Body": return "mirror-modifier"
    if name == "Pattern": return "array-modifier"
    if name.starts_with("Solid "): return name[6..<name.length].lower().replace("box", "cube")
    if name == "Camera": return "camera"
    if name == "Light": return "light-spot"
    if name == "Render": return "render"
    if name == "Material": return "material"
    if name == "Assign Material": return "fill-tool"
    if name in ["Transform", "Move", "Transform Components"]: return "move-tool"
    if name == "Tessellate": return "mesh"
    if name in ["Blast", "Delete"]: return "trash"
    if name.starts_with("Edit "): return "pencil-tool"
    if name in ["Box", "Object"]: return "cube"
    if name == "Plane": return "grid"
    if name == "Merge": return "git-merge"
    if name == "Null": return "node-tool"
    if name == "Code": return "code"
    if name == "Switch": return "git-branch"
    if name == "Reverse": return "reverse-normals"
    if name in ["Triangulate", "Subdivide", "Inset", "Bevel", "Duplicate", "Dissolve", "Flatten"]: return name.lower()
    if name == "PolyBevel": return "bevel"
    if name == "Loop Cut": return "loop-cut"
    if name in ["Knife", "Clip"]: return "line-tool"
    if name == "Connect": return "path-tool"
    if name == "Edge Slide": return "distribute-horizontal"
    if name == "PolyMirror": return "mirror-modifier"
    if name == "Spin": return "orbit-tool"
    if name == "Crease": return "sharpen-tool"
    if name == "PolyDraw": return "polygon-select-tool"
    if name == "Bridge": return "fill-hole"
    if name == "Smooth": return "smooth-tool"
    if name in ["Fuse", "Merge Points"]: return "merge-vertices"
    if name in ["Extrude", "PolyExtrude"]: return "extrude"
    if name == "Split": return "split-mesh"
    if name == "Clean": return "healing-brush"
    if name == "Mirror": return "mirror-modifier"
    if name == "CopyTransform": return "array-modifier"
    if name == "CopyToPoints": return "vertex-select"
    if name in ["Noise", "Mountain"]: return "noise"
    if name in ["Peak", "Normal"]: return "surface-normal"
    if name == "MatchSize": return "corner-pin"
    if name == "AttributeCreate": return "plus"
    if name == "Name": return "text-tool"
    if name == "AttributeRandomize": return "noise"
    if name == "AttributeDelete": return "subtract-from-selection"
    if name == "AttributeRename": return "text-tool"
    if name == "AttributePromote": return "bring-forward"
    if name in ["Selection", "Select"]: return "selection-tool"
    if name == "Measure": return "measure-tool"
    if name == "UVProject": return "texture"
    if name == "Color": return "color-swatch"
    if name == "Rotate": return "rotate-tool"
    if name == "Scale": return "scale-tool"
    if name == "Pivot": return "pivot"
    if name == "Manipulator": return "transform-gizmo"
    if name == "Snap": return "snap-to-grid"
    if name == "Fill": return "fill-hole"
    if name == "Frame": return "frame-selection"
    # Edit SDF: booleans, blend, the capsule.
    if name == "Add": return "boolean-union"
    if name == "Subtract": return "boolean-subtract"
    if name == "Intersect": return "boolean-intersect"
    if name == "Blend": return "smooth-tool"
    if name == "Capsule": return "cylinder"
    return "mesh"

pub func draw_icon(p: Painter, name: str, x: float, y: float, size: float, ink: Color) -> unit!:
    ui.draw_icon(p.target(), asset_name(name), Rect(x, y, size, size), ink)