forked from blender/blender
Add possibility to provide render delegate specific tokens to scene delegate #52
@ -3,6 +3,7 @@
|
||||
|
||||
#include <bitset>
|
||||
|
||||
#include "BLI_set.hh"
|
||||
#include "BKE_object.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
#include "DNA_scene_types.h"
|
||||
@ -236,6 +237,9 @@ void BlenderSceneDelegate::set_setting(const std::string &key, const pxr::VtValu
|
||||
if (key == "MaterialXFilenameKey") {
|
||||
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
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "CLG_log.h"
|
||||
|
||||
#include "BLI_set.hh"
|
||||
#include "BLI_map.hh"
|
||||
#include "curves.h"
|
||||
#include "instancer.h"
|
||||
#include "light.h"
|
||||
@ -34,6 +34,7 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
||||
public:
|
||||
struct Settings {
|
||||
pxr::TfToken mx_filename_key;
|
||||
Map<pxr::TfToken, pxr::VtValue> render_tokens;
|
||||
};
|
||||
|
||||
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 {
|
||||
|
||||
class BlenderSceneDelegate;
|
||||
|
@ -145,15 +145,8 @@ pxr::VtValue LightData::get_data(pxr::TfToken const &key) const
|
||||
ret = it->second;
|
||||
}
|
||||
else {
|
||||
std::string n = key.GetString();
|
||||
if (boost::algorithm::contains(n, "object:visibility:")) {
|
||||
if (boost::algorithm::ends_with(n, "camera") || boost::algorithm::ends_with(n, "shadow")) {
|
||||
ret = false;
|
||||
}
|
||||
else {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
pxr::VtValue *ret_ptr = scene_delegate_->settings.render_tokens.lookup_ptr(key);
|
||||
ret = ret_ptr ? *ret_ptr : pxr::VtValue();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user