brush_output_node.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. type brush_output_node_t = {
  2. base?: logic_node_t;
  3. id?: i32;
  4. texpaint?: image_t;
  5. texpaint_nor?: image_t;
  6. texpaint_pack?: image_t;
  7. texpaint_nor_empty?: image_t;
  8. texpaint_pack_empty?: image_t;
  9. };
  10. let brush_output_node_inst: brush_output_node_t = null;
  11. function brush_output_node_create(arg: any): brush_output_node_t {
  12. let n: brush_output_node_t = {};
  13. n.base = logic_node_create();
  14. if (brush_output_node_inst == null) {
  15. {
  16. let t = render_target_create();
  17. t.name = "texpaint";
  18. t.width = config_get_texture_res_x();
  19. t.height = config_get_texture_res_y();
  20. t.format = "RGBA32";
  21. n.texpaint = render_path_create_render_target(t)._image;
  22. }
  23. {
  24. let t = render_target_create();
  25. t.name = "texpaint_nor";
  26. t.width = config_get_texture_res_x();
  27. t.height = config_get_texture_res_y();
  28. t.format = "RGBA32";
  29. n.texpaint_nor = render_path_create_render_target(t)._image;
  30. }
  31. {
  32. let t = render_target_create();
  33. t.name = "texpaint_pack";
  34. t.width = config_get_texture_res_x();
  35. t.height = config_get_texture_res_y();
  36. t.format = "RGBA32";
  37. n.texpaint_pack = render_path_create_render_target(t)._image;
  38. }
  39. {
  40. let t = render_target_create();
  41. t.name = "texpaint_nor_empty";
  42. t.width = 1;
  43. t.height = 1;
  44. t.format = "RGBA32";
  45. n.texpaint_nor_empty = render_path_create_render_target(t)._image;
  46. }
  47. {
  48. let t = render_target_create();
  49. t.name = "texpaint_pack_empty";
  50. t.width = 1;
  51. t.height = 1;
  52. t.format = "RGBA32";
  53. n.texpaint_pack_empty = render_path_create_render_target(t)._image;
  54. }
  55. }
  56. else {
  57. n.texpaint = brush_output_node_inst.texpaint;
  58. n.texpaint_nor = brush_output_node_inst.texpaint_nor;
  59. n.texpaint_pack = brush_output_node_inst.texpaint_pack;
  60. }
  61. brush_output_node_inst = n;
  62. return n;
  63. }
  64. function brush_output_node_get_as_image(self: brush_output_node_t, from: i32): image_t {
  65. return logic_node_input_get_as_image(self.base.inputs[from]);
  66. }