e828af3ac1
- 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
44 lines
1.6 KiB
Markdown
44 lines
1.6 KiB
Markdown
---
|
|
name: dag_palette
|
|
kind: component
|
|
lang: cpp
|
|
domain: gfx
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "void dag_palette()"
|
|
description: "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."
|
|
tags: [imgui, dag, palette, drag-and-drop, gfx, component]
|
|
uses_functions: [dag_catalog_cpp_gfx]
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [imgui, dag_catalog]
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "cpp/functions/gfx/dag_palette.cpp"
|
|
framework: imgui
|
|
params: []
|
|
output: "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
|
|
|
|
```cpp
|
|
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.
|