From 58f79c021cfe52da670e61f0fd73a61eed7b5b99 Mon Sep 17 00:00:00 2001 From: Jason Ly Date: Sat, 14 Mar 2026 17:22:25 -0400 Subject: [PATCH] width and height resolution args --- README.md | 6 +++ joomer-efsw-bsz-monitoring.cpp | 69 ++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/README.md b/README.md index 1e5fd23..88671ec 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ Watch folder for images and flip them joomer-efsw-bsz-monitoring - drag and drop bszs into the current directory (same folder as exe file) - rendered image will be saved in the current directory as well + +joomer-efsw-bsz-monitoring.exe +optional arguments +--watchdir:path +--width: resolution width +--height: resolution height ``` # TODO diff --git a/joomer-efsw-bsz-monitoring.cpp b/joomer-efsw-bsz-monitoring.cpp index 7682251..c899da9 100644 --- a/joomer-efsw-bsz-monitoring.cpp +++ b/joomer-efsw-bsz-monitoring.cpp @@ -24,6 +24,8 @@ bool STOP = false; dl::bella_sdk::Engine engine; std::string fileToRender = ""; bool pendingRender = false; +int width = 800; +int height = 600; //void flip_image_horizontally(unsigned char* data, int width, int height, int channels); void flip_image_vertically(unsigned char* data, int width, int height, int channels); @@ -179,7 +181,65 @@ void do_sync_render(std::string fileToRender) pathNode["name"] = dl::String("render_result"); pathNode["ext"] = dl::String(".png"); + // Get the global settings node instead of the beautyPass node + dl::bella_sdk::Node settings = engine.scene().settings(); + dl::bella_sdk::Node cam = settings["camera"].asNode(); + auto inputs = settings.inputs(); // This gets all valid attribute names + for (const auto& input : inputs) { + std::cout << "Valid attribute: " << input.name() << std::endl; + } + + if (cam) { + // In Bella, resolution is almost always on the Camera node + /*cam["width"] = dl::Int(1920); + cam["height"] = dl::Int(1080); + std::cout << ">>> Set resolution on camera: " << cam.name() << std::endl;*/ + + auto inputs = cam.inputs(); + for (const auto& input : inputs) { + // This will print every valid attribute name for YOUR camera + std::cout << "Camera Attribute: " << input.name() << std::endl; + } + + if (cam) { + std::cout << ">>> Set resolution to " << width <<"x" << height << " on camera : " << cam.name() << std::endl; + float fWidth = static_cast(width); + float fHeight = static_cast(height); + cam["resolution"] = dl::Vec2{ fWidth, fHeight }; + } + + // Access the specialized 'resolution' sub-node + /*dl::bella_sdk::Node resNode = cam["resolution"].asNode(); + + if (resNode) { + resNode["width"] = dl::Int(1920); + resNode["height"] = dl::Int(1080); + std::cout << ">>> Successfully set resolution to 1920x1080 on: " << resNode.name() << std::endl; + } + else { + std::cout << ">>> ERROR: Resolution node not found on camera!" << std::endl; + }*/ + } + else { + std::cout << ">>> ERROR: No camera found in settings!" << std::endl; + } + //if (settings) { + // settings["width"] = dl::Int(1920); + // settings["height"] = dl::Int(1080);; + //} + //else { + // // Fallback: If settings node isn't found, some versions use these on the beauty pass + // dl::bella_sdk::Node bPass = engine.scene().beautyPass(); + // bPass["width"] = dl::Int(1920); + // bPass["height"] = dl::Int(1080); + //} dl::bella_sdk::Node bPass = engine.scene().beautyPass(); + + // --- CHANGE RESOLUTION --- + //bPass["resWidth"] = dl::Int(1920); // Set your desired width + //bPass["resHeight"] = dl::Int(1080); // Set your desired height + // --------------------------------------------- + bPass["overridePath"] = pathNode; std::cout << ">>> STARTING BELLA ENGINE..." << std::endl; @@ -333,6 +393,8 @@ int DL_main(dl::Args& args) { std::string path; args.add("wd", "watchdir", "", "mode file watch"); + args.add("w", "width", "800", "render width"); + args.add("h", "height", "600", "render height"); /*if (argc >= 2) { path = std::string( argv[1] ); @@ -357,6 +419,13 @@ int DL_main(dl::Args& args) { } } + if (args.have("--width")) { + width = std::stoi(args.value("--width").buf()); + } + if (args.have("--height")) { + height = std::stoi(args.value("--height").buf()); + } + UpdateListener* ul = new UpdateListener(); /// create the file watcher object