forked from blender/blender
Add possibility to provide render delegate specific tokens to scene delegate #52
@ -4,6 +4,7 @@
|
|||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
#include "BKE_object.h"
|
#include "BKE_object.h"
|
||||||
|
#include "BLI_set.hh"
|
||||||
#include "DEG_depsgraph_query.h"
|
#include "DEG_depsgraph_query.h"
|
||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
|
|
||||||
@ -236,6 +237,9 @@ void BlenderSceneDelegate::set_setting(const std::string &key, const pxr::VtValu
|
|||||||
if (key == "MaterialXFilenameKey") {
|
if (key == "MaterialXFilenameKey") {
|
||||||
settings.mx_filename_key = pxr::TfToken(val.Get<std::string>());
|
settings.mx_filename_key = pxr::TfToken(val.Get<std::string>());
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
settings.render_tokens.add_overwrite(pxr::TfToken(key), val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pxr::SdfPath BlenderSceneDelegate::prim_id(ID *id, const char *prefix) const
|
pxr::SdfPath BlenderSceneDelegate::prim_id(ID *id, const char *prefix) const
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "CLG_log.h"
|
#include "CLG_log.h"
|
||||||
|
|
||||||
#include "BLI_set.hh"
|
#include "BLI_map.hh"
|
||||||
#include "curves.h"
|
#include "curves.h"
|
||||||
#include "instancer.h"
|
#include "instancer.h"
|
||||||
#include "light.h"
|
#include "light.h"
|
||||||
@ -34,6 +34,7 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
|||||||
public:
|
public:
|
||||||
struct Settings {
|
struct Settings {
|
||||||
pxr::TfToken mx_filename_key;
|
pxr::TfToken mx_filename_key;
|
||||||
|
Map<pxr::TfToken, pxr::VtValue> render_tokens;
|
||||||
};
|
};
|
||||||
|
|
||||||
BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
|
BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
|
||||||
|
@ -17,6 +17,13 @@ template<> struct blender::DefaultHash<pxr::SdfPath> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<> struct blender::DefaultHash<pxr::TfToken> {
|
||||||
|
uint64_t operator()(const pxr::TfToken &value) const
|
||||||
|
{
|
||||||
|
return pxr::TfHash()(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
namespace blender::render::hydra {
|
namespace blender::render::hydra {
|
||||||
|
|
||||||
class BlenderSceneDelegate;
|
class BlenderSceneDelegate;
|
||||||
|
@ -144,17 +144,12 @@ pxr::VtValue LightData::get_data(pxr::TfToken const &key) const
|
|||||||
if (it != data_.end()) {
|
if (it != data_.end()) {
|
||||||
return pxr::VtValue(it->second);
|
return pxr::VtValue(it->second);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
std::string n = key.GetString();
|
pxr::VtValue *ret_ptr = scene_delegate_->settings.render_tokens.lookup_ptr(key);
|
||||||
if (boost::algorithm::contains(n, "object:visibility:")) {
|
if (ret_ptr) {
|
||||||
if (boost::algorithm::ends_with(n, "camera") || boost::algorithm::ends_with(n, "shadow")) {
|
return *ret_ptr;
|
||||||
return pxr::VtValue(false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return pxr::VtValue(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pxr::VtValue();
|
return pxr::VtValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user