width and height resolution args
This commit is contained in:
parent
b6fd9f6e1e
commit
58f79c021c
@ -10,6 +10,12 @@ Watch folder for images and flip them
|
|||||||
joomer-efsw-bsz-monitoring
|
joomer-efsw-bsz-monitoring
|
||||||
- drag and drop bszs into the current directory (same folder as exe file)
|
- drag and drop bszs into the current directory (same folder as exe file)
|
||||||
- rendered image will be saved in the current directory as well
|
- 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
|
# TODO
|
||||||
|
|||||||
@ -24,6 +24,8 @@ bool STOP = false;
|
|||||||
dl::bella_sdk::Engine engine;
|
dl::bella_sdk::Engine engine;
|
||||||
std::string fileToRender = "";
|
std::string fileToRender = "";
|
||||||
bool pendingRender = false;
|
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_horizontally(unsigned char* data, int width, int height, int channels);
|
||||||
void flip_image_vertically(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["name"] = dl::String("render_result");
|
||||||
pathNode["ext"] = dl::String(".png");
|
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<float>(width);
|
||||||
|
float fHeight = static_cast<float>(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();
|
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;
|
bPass["overridePath"] = pathNode;
|
||||||
|
|
||||||
std::cout << ">>> STARTING BELLA ENGINE..." << std::endl;
|
std::cout << ">>> STARTING BELLA ENGINE..." << std::endl;
|
||||||
@ -333,6 +393,8 @@ int DL_main(dl::Args& args) {
|
|||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
args.add("wd", "watchdir", "", "mode file watch");
|
args.add("wd", "watchdir", "", "mode file watch");
|
||||||
|
args.add("w", "width", "800", "render width");
|
||||||
|
args.add("h", "height", "600", "render height");
|
||||||
|
|
||||||
/*if (argc >= 2) {
|
/*if (argc >= 2) {
|
||||||
path = std::string( argv[1] );
|
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();
|
UpdateListener* ul = new UpdateListener();
|
||||||
|
|
||||||
/// create the file watcher object
|
/// create the file watcher object
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user