Create possibility to provide render settings via BlenderSceneDelegate #41

Merged
Bogdan Nagirniak merged 10 commits from BLEN-349 into hydra-render 2023-05-19 20:19:17 +02:00
5 changed files with 10 additions and 10 deletions
Showing only changes of commit e294544c46 - Show all commits

View File

@ -56,14 +56,14 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
engine_ = std::make_unique<pxr::HdEngine>(); engine_ = std::make_unique<pxr::HdEngine>();
} }
void Engine::set_sync_setting(const pxr::TfToken &key, const pxr::VtValue &val) void Engine::set_sync_setting(const std::string &key, const pxr::VtValue &val)
{ {
scene_delegate_->set_setting(key, val); scene_delegate_->set_setting(key, val);
} }
void Engine::set_render_setting(const pxr::TfToken &key, const pxr::VtValue &val) void Engine::set_render_setting(const std::string &key, const pxr::VtValue &val)
{ {
render_delegate_->SetRenderSetting(key, val); render_delegate_->SetRenderSetting(pxr::TfToken(key), val);
} }
float Engine::renderer_percent_done() float Engine::renderer_percent_done()

View File

@ -31,8 +31,8 @@ class Engine {
virtual void sync(Depsgraph *depsgraph, bContext *context) = 0; virtual void sync(Depsgraph *depsgraph, bContext *context) = 0;
virtual void render(Depsgraph *depsgraph) = 0; virtual void render(Depsgraph *depsgraph) = 0;
void set_sync_setting(const pxr::TfToken &key, const pxr::VtValue &val); void set_sync_setting(const std::string &key, const pxr::VtValue &val);
void set_render_setting(const pxr::TfToken &key, const pxr::VtValue &val); void set_render_setting(const std::string &key, const pxr::VtValue &val);
std::string render_delegate_name; std::string render_delegate_name;

View File

@ -230,7 +230,7 @@ static PyObject *engine_set_sync_setting_func(PyObject * /*self*/, PyObject *arg
} }
Engine *engine = (Engine *)PyLong_AsVoidPtr(pyengine); Engine *engine = (Engine *)PyLong_AsVoidPtr(pyengine);
engine->set_sync_setting(pxr::TfToken(key), get_setting_val(pyval)); engine->set_sync_setting(key, get_setting_val(pyval));
CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %016llx: %s", engine, key); CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %016llx: %s", engine, key);
Py_RETURN_NONE; Py_RETURN_NONE;
@ -245,7 +245,7 @@ static PyObject *engine_set_render_setting_func(PyObject * /*self*/, PyObject *a
} }
Engine *engine = (Engine *)PyLong_AsVoidPtr(pyengine); Engine *engine = (Engine *)PyLong_AsVoidPtr(pyengine);
engine->set_render_setting(pxr::TfToken(key), get_setting_val(pyval)); engine->set_render_setting(key, get_setting_val(pyval));
CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %016llx: %s", engine, key); CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %016llx: %s", engine, key);
Py_RETURN_NONE; Py_RETURN_NONE;

View File

@ -203,9 +203,9 @@ void BlenderSceneDelegate::clear()
view3d = nullptr; view3d = nullptr;
} }
void BlenderSceneDelegate::set_setting(const pxr::TfToken &key, const pxr::VtValue &val) void BlenderSceneDelegate::set_setting(const std::string &key, const pxr::VtValue &val)
{ {
if (key.GetString() == "MaterialXFilenameKey") { if (key == "MaterialXFilenameKey") {
settings.mx_filename_key = pxr::TfToken(val.Get<std::string>()); settings.mx_filename_key = pxr::TfToken(val.Get<std::string>());
} }
} }

View File

@ -58,7 +58,7 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
void populate(Depsgraph *depsgraph, bContext *context); void populate(Depsgraph *depsgraph, bContext *context);
void clear(); void clear();
void set_setting(const pxr::TfToken &key, const pxr::VtValue &val); void set_setting(const std::string &key, const pxr::VtValue &val);
Depsgraph *depsgraph = nullptr; Depsgraph *depsgraph = nullptr;
bContext *context = nullptr; bContext *context = nullptr;