Files
fn_registry/cpp/functions/gfx/dag_palette.md
T
egutierrez 0be4b29a4b feat(shaders_lab): Output node + Functions palette with drag-drop
- DagKind::Output (new enum): terminal sink; compiler wires fragColor to its source_ids[0]
- dag_catalog: "output" node (1 input, red)
- dag_compile: skips Output in node_<i> emission; final fragColor resolves from Output's connection
- dag_node_editor: no more Add button; drops "DAG_NODE_TYPE" payloads at mouse canvas position; Output cannot be deleted; Output has no output pin
- dag_palette (new fn): Functions window with grouped, draggable node cards
- main.cpp: "Functions" window added; ensure_dag_default seeds plasma + connected Output
2026-04-24 22:16:47 +02:00

1.6 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, framework, params, output
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports tested tests test_file_path file_path framework params output
dag_palette component cpp gfx 1.0.0 impure void dag_palette() Paleta de nodos del catalogo, agrupada por kind (Gen/Op/Blend). Cada entrada es un drag source con payload DAG_NODE_TYPE que contiene el name del nodo. El node editor recibe el drop y anade un nuevo DagStep en la posicion del mouse.
imgui
dag
palette
drag-and-drop
gfx
component
dag_catalog_cpp_gfx
false error_go_core
imgui
dag_catalog
false
cpp/functions/gfx/dag_palette.cpp imgui
Dibuja los widgets de paleta dentro del ImGui::Begin/End del caller. No tiene estado propio.

dag_palette

Paleta draggable de nodos del catalogo. Sustituye el boton "+ Add Node" del panel del DAG: en lugar de pulsar y navegar un submenu, el usuario arrastra el nodo desde la paleta al canvas del editor.

Uso

if (ImGui::Begin("Functions")) {
    fn::gfx::dag_palette();
}
ImGui::End();

El node editor debe aceptar payloads con identificador "DAG_NODE_TYPE" y crear el DagStep correspondiente en la posicion del cursor.

Drop zone del editor

El dag_node_editor usa un ImGui::InvisibleButton del tamano del canvas como drop target antes de ed::Begin(), y resetea el cursor para que el editor se dibuje encima. Al detectar drop, convierte la posicion screen a canvas con ed::ScreenToCanvas() y encola un add que se aplica tras abrir el contexto del editor.