forked from blender/blender
Create possibility to provide render settings via BlenderSceneDelegate #41
@ -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()
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user