Added back set_sync_settings #86

Closed
Bogdan Nagirniak wants to merge 2 commits from hydra-sync_settings into hydra-render

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 10 additions and 9 deletions
Showing only changes of commit f24a62422a - Show all commits

View File

@ -227,6 +227,7 @@ void HydraSceneDelegate::clear()
mat_data->remove(); mat_data->remove();
} }
materials_.clear(); materials_.clear();
sync_settings.light_tokens.clear();
depsgraph = nullptr; depsgraph = nullptr;
bmain = nullptr; bmain = nullptr;
@ -240,7 +241,7 @@ void HydraSceneDelegate::set_sync_setting(const std::string &key, const pxr::VtV
sync_settings.light_tokens.add_overwrite(pxr::TfToken(key.substr(key.find(":") + 1)), val); sync_settings.light_tokens.add_overwrite(pxr::TfToken(key.substr(key.find(":") + 1)), val);
} }
else { else {
CLOG_WARN(LOG_HYDRA_SCENE, "Unsupported sync setting: %s", key.c_str()); CLOG_WARN(LOG_HYDRA_SCENE, "Unsupported setting: %s", key.c_str());
} }
} }

View File

@ -85,9 +85,8 @@ void Engine::sync(Depsgraph *depsgraph, bContext *context)
usd_scene_delegate_.reset(); usd_scene_delegate_.reset();
if (!hydra_scene_delegate_) { if (!hydra_scene_delegate_) {
pxr::SdfPath scene_path = pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"); hydra_scene_delegate_ = std::make_unique<io::hydra::HydraSceneDelegate>(
hydra_scene_delegate_ = std::make_unique<io::hydra::HydraSceneDelegate>(render_index_.get(), render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"));
scene_path);
} }
hydra_scene_delegate_->populate(depsgraph, context ? CTX_wm_view3d(context) : nullptr); hydra_scene_delegate_->populate(depsgraph, context ? CTX_wm_view3d(context) : nullptr);
} }
@ -100,9 +99,8 @@ void Engine::sync(Depsgraph *depsgraph, bContext *context)
} }
if (!usd_scene_delegate_) { if (!usd_scene_delegate_) {
pxr::SdfPath scene_path = pxr::SdfPath::AbsoluteRootPath().AppendElementString("usd_scene"); usd_scene_delegate_ = std::make_unique<io::hydra::USDSceneDelegate>(
usd_scene_delegate_ = std::make_unique<io::hydra::USDSceneDelegate>(render_index_.get(), render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("usd_scene"));
scene_path);
} }
usd_scene_delegate_->populate(depsgraph); usd_scene_delegate_->populate(depsgraph);
} }
@ -110,9 +108,11 @@ void Engine::sync(Depsgraph *depsgraph, bContext *context)
void Engine::set_sync_setting(const std::string &key, const pxr::VtValue &val) void Engine::set_sync_setting(const std::string &key, const pxr::VtValue &val)
{ {
if (hydra_scene_delegate_) { if (!hydra_scene_delegate_) {
hydra_scene_delegate_->set_sync_setting(key, val); hydra_scene_delegate_ = std::make_unique<io::hydra::HydraSceneDelegate>(
render_index_.get(), pxr::SdfPath::AbsoluteRootPath().AppendElementString("scene"));
} }
hydra_scene_delegate_->set_sync_setting(key, val);
} }
void Engine::set_render_setting(const std::string &key, const pxr::VtValue &val) void Engine::set_render_setting(const std::string &key, const pxr::VtValue &val)