forked from blender/blender
Add possibility to provide render delegate specific tokens to scene delegate #52
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
|
#include "BLI_set.hh"
|
||||||
#include "BKE_object.h"
|
#include "BKE_object.h"
|
||||||
#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;
|
||||||
|
@ -145,15 +145,8 @@ pxr::VtValue LightData::get_data(pxr::TfToken const &key) const
|
|||||||
ret = it->second;
|
ret = it->second;
|
||||||
}
|
}
|
||||||
else {
|
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:")) {
|
ret = ret_ptr ? *ret_ptr : pxr::VtValue();
|
||||||
if (boost::algorithm::ends_with(n, "camera") || boost::algorithm::ends_with(n, "shadow")) {
|
|
||||||
ret = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user