diff --git a/zeno/src/nodes/prim/SimpleGeometry.cpp b/zeno/src/nodes/prim/SimpleGeometry.cpp index fc2c51c2ec..5a0cb4ac5e 100644 --- a/zeno/src/nodes/prim/SimpleGeometry.cpp +++ b/zeno/src/nodes/prim/SimpleGeometry.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #define ROTATE_COMPUTE \ auto gp = glm::vec3(p[0], p[1], p[2]); \ @@ -1412,5 +1413,47 @@ ZENDEFNODE(CreateCylinder, { {}, {"create"}, }); +struct CreateFolder : zeno::INode { + virtual void apply() override { + namespace fs = std::filesystem; + auto folderPath = fs::u8path(get_input2("folderPath")); + if (!fs::exists(folderPath)) { + fs::create_directories(folderPath); + } + } +}; + +ZENDEFNODE(CreateFolder, { + { + {"directory", "folderPath"} + }, + {}, + {}, + {"create"}, +}); + +struct RemoveFolder : zeno::INode { + virtual void apply() override { + namespace fs = std::filesystem; + auto folderPath = fs::u8path(get_input2("folderPath")); + if (fs::exists(folderPath)) { + std::error_code errorCode; + fs::remove_all(folderPath, errorCode); + if (get_input2("clean")) { + fs::create_directories(folderPath); + } + } + } +}; + +ZENDEFNODE(RemoveFolder, { + { + {"directory", "folderPath"}, + {"bool", "clean", "false"}, + }, + {}, + {}, + {"create"}, +}); } } diff --git a/zeno/src/nodes/prim/UVProjectFromPlane.cpp b/zeno/src/nodes/prim/UVProjectFromPlane.cpp index d0f7b9a99a..5398a6e523 100644 --- a/zeno/src/nodes/prim/UVProjectFromPlane.cpp +++ b/zeno/src/nodes/prim/UVProjectFromPlane.cpp @@ -730,6 +730,10 @@ struct WriteImageFile_v2 : INode { stbi_flip_vertically_on_write(1); stbi_write_png(path.c_str(), w, h, n, data.data(),0); } + else if(type == "hdr"){ + stbi_flip_vertically_on_write(1); + stbi_write_hdr(path.c_str(), w, h, 3, (float*)image->verts.data()); + } else if(type == "exr"){ std::vector data2(w * h * n); for (int i = 0; i < w * h; i++) { @@ -768,7 +772,7 @@ ZENDEFNODE(WriteImageFile_v2, { { {"image"}, {"writepath", "path"}, - {"enum png jpg exr pfm", "type", "png"}, + {"enum png jpg exr pfm hdr", "type", "png"}, {"mask"}, {"bool", "linear_to_srgb_when_save", "0"}, },