nodes_brush.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /// <reference path="./nodes/image_texture_node.ts"/>
  2. /// <reference path="./nodes/rgb_node.ts"/>
  3. /// <reference path="./nodes/inpaint_node.ts"/>
  4. /// <reference path="./nodes/photo_to_pbr_node.ts"/>
  5. /// <reference path="./nodes/text_to_photo_node.ts"/>
  6. /// <reference path="./nodes/tiling_node.ts"/>
  7. /// <reference path="./nodes/upscale_node.ts"/>
  8. /// <reference path="./nodes/variance_node.ts"/>
  9. let nodes_brush_categories: string[] = [_tr("Input"), _tr("Model")];
  10. let nodes_brush_input: zui_node_t[] = [
  11. image_texture_node_def,
  12. rgb_node_def,
  13. ];
  14. let nodes_brush_model: zui_node_t[] = [
  15. inpaint_node_def,
  16. photo_to_pbr_node_def,
  17. text_to_photo_node_def,
  18. tiling_node_def,
  19. upscale_node_def,
  20. variance_node_def,
  21. ];
  22. let nodes_brush_list: node_list_t[] = [
  23. nodes_brush_input,
  24. nodes_brush_model
  25. ]
  26. let nodes_brush_creates: map_t<string, any>;
  27. function nodes_brush_init() {
  28. nodes_brush_creates = map_create();
  29. map_set(nodes_brush_creates, "brush_output_node", brush_output_node_create);
  30. map_set(nodes_brush_creates, "image_texture_node", image_texture_node_create);
  31. map_set(nodes_brush_creates, "rgb_node", rgb_node_create);
  32. map_set(nodes_brush_creates, "inpaint_node", inpaint_node_create);
  33. map_set(nodes_brush_creates, "photo_to_pbr_node", photo_to_pbr_node_create);
  34. map_set(nodes_brush_creates, "text_to_photo_node", text_to_photo_node_create);
  35. map_set(nodes_brush_creates, "tiling_node", tiling_node_create);
  36. map_set(nodes_brush_creates, "upscale_node", upscale_node_create);
  37. map_set(nodes_brush_creates, "variance_node", variance_node_create);
  38. }
  39. function nodes_brush_create_node(node_type: string): zui_node_t {
  40. for (let i: i32 = 0; i < nodes_brush_list.length; ++i) {
  41. let c = nodes_brush_list[i];
  42. for (let j: i32 = 0; j < c.length; ++j) {
  43. let n = c[j];
  44. if (n.type == node_type) {
  45. let canvas = project_canvas;
  46. let nodes = project_nodes;
  47. let node = ui_nodes_make_node(n, nodes, canvas);
  48. array_push(canvas.nodes, node);
  49. return node;
  50. }
  51. }
  52. }
  53. return null;
  54. }