forked from blender/blender
Fix review comments #27
@ -8,11 +8,14 @@
|
|||||||
#include <pxr/imaging/hgi/tokens.h>
|
#include <pxr/imaging/hgi/tokens.h>
|
||||||
#include <pxr/usd/usdGeom/tokens.h>
|
#include <pxr/usd/usdGeom/tokens.h>
|
||||||
|
|
||||||
|
#include "BLI_path_util.h"
|
||||||
|
#include "GPU_context.h"
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
namespace blender::render::hydra {
|
namespace blender::render::hydra {
|
||||||
|
|
||||||
CLG_LOGREF_DECLARE_GLOBAL(LOG_EN, "rhd.en");
|
CLG_LOGREF_DECLARE_GLOBAL(LOG_RENDER_HYDRA, "render.hydra");
|
||||||
|
|
||||||
Engine::Engine(RenderEngine *bl_engine, const std::string &delegate_id) : bl_engine_(bl_engine)
|
Engine::Engine(RenderEngine *bl_engine, const std::string &delegate_id) : bl_engine_(bl_engine)
|
||||||
{
|
{
|
||||||
@ -21,6 +24,10 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &delegate_id) : bl_eng
|
|||||||
pxr::TF_PY_ALLOW_THREADS_IN_SCOPE();
|
pxr::TF_PY_ALLOW_THREADS_IN_SCOPE();
|
||||||
render_delegate_ = registry.CreateRenderDelegate(pxr::TfToken(delegate_id));
|
render_delegate_ = registry.CreateRenderDelegate(pxr::TfToken(delegate_id));
|
||||||
|
|
||||||
|
if (GPU_backend_get_type() == GPU_BACKEND_VULKAN) {
|
||||||
|
BLI_setenv("HGI_ENABLE_VULKAN", "1");
|
||||||
|
}
|
||||||
|
|
||||||
pxr::HdDriverVector hd_drivers;
|
pxr::HdDriverVector hd_drivers;
|
||||||
if (bl_engine->type->flag & RE_USE_GPU_CONTEXT) {
|
if (bl_engine->type->flag & RE_USE_GPU_CONTEXT) {
|
||||||
hgi_ = pxr::Hgi::CreatePlatformDefaultHgi();
|
hgi_ = pxr::Hgi::CreatePlatformDefaultHgi();
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
namespace blender::render::hydra {
|
namespace blender::render::hydra {
|
||||||
|
|
||||||
extern struct CLG_LogRef *LOG_EN; /* EN - Engine */
|
extern struct CLG_LogRef *LOG_RENDER_HYDRA; /* EN - Engine */
|
||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
public:
|
public:
|
||||||
|
@ -109,7 +109,7 @@ double PreviewEngine::free_instance(uintptr_t uuid, void *user_data)
|
|||||||
return LIFETIME;
|
return LIFETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOG_INFO(LOG_EN, 2, "");
|
CLOG_INFO(LOG_RENDER_HYDRA, 2, "");
|
||||||
instance_ = nullptr;
|
instance_ = nullptr;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace blender::render::hydra {
|
|||||||
|
|
||||||
static PyObject *init_func(PyObject * /*self*/, PyObject *args)
|
static PyObject *init_func(PyObject * /*self*/, PyObject *args)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_EN, 1, "Init");
|
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Init");
|
||||||
|
|
||||||
pxr::PlugRegistry::GetInstance().RegisterPlugins(std::string(BKE_appdir_program_dir()) +
|
pxr::PlugRegistry::GetInstance().RegisterPlugins(std::string(BKE_appdir_program_dir()) +
|
||||||
"/blender.shared/usd");
|
"/blender.shared/usd");
|
||||||
@ -59,7 +59,7 @@ static PyObject *register_plugins_func(PyObject * /*self*/, PyObject *args)
|
|||||||
ss << s << ", ";
|
ss << s << ", ";
|
||||||
}
|
}
|
||||||
ss << "]";
|
ss << "]";
|
||||||
CLOG_INFO(LOG_EN, 1, "Register %s", ss.str().c_str());
|
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Register %s", ss.str().c_str());
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOG_INFO(LOG_EN, 2, "Engine %016llx %s", engine, engine_type);
|
CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %016llx %s", engine, engine_type);
|
||||||
|
|
||||||
return PyLong_FromVoidPtr(engine);
|
return PyLong_FromVoidPtr(engine);
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ static PyObject *engine_free_func(PyObject * /*self*/, PyObject *args)
|
|||||||
delete engine;
|
delete engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOG_INFO(LOG_EN, 2, "Engine %016llx", engine);
|
CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %016llx", engine);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ static PyObject *engine_sync_func(PyObject * /*self*/, PyObject *args)
|
|||||||
|
|
||||||
engine->sync(depsgraph, context, settings);
|
engine->sync(depsgraph, context, settings);
|
||||||
|
|
||||||
CLOG_INFO(LOG_EN, 2, "Engine %016llx", engine);
|
CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %016llx", engine);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ static PyObject *engine_render_func(PyObject * /*self*/, PyObject *args)
|
|||||||
engine->render(depsgraph);
|
engine->render(depsgraph);
|
||||||
Py_END_ALLOW_THREADS;
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
CLOG_INFO(LOG_EN, 2, "Engine %016llx", engine);
|
CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %016llx", engine);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ static PyObject *engine_view_draw_func(PyObject * /*self*/, PyObject *args)
|
|||||||
engine->render(depsgraph, context);
|
engine->render(depsgraph, context);
|
||||||
Py_END_ALLOW_THREADS;
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
CLOG_INFO(LOG_EN, 3, "Engine %016llx", engine);
|
CLOG_INFO(LOG_RENDER_HYDRA, 3, "Engine %016llx", engine);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace blender::render::hydra {
|
namespace blender::render::hydra {
|
||||||
|
|
||||||
CLG_LOGREF_DECLARE_GLOBAL(LOG_BSD, "rhd.bsd");
|
CLG_LOGREF_DECLARE_GLOBAL(LOG_RENDER_HYDRA_SCENE, "render.hydra.scene");
|
||||||
|
|
||||||
BlenderSceneDelegate::BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
|
BlenderSceneDelegate::BlenderSceneDelegate(pxr::HdRenderIndex *parent_index,
|
||||||
pxr::SdfPath const &delegate_id,
|
pxr::SdfPath const &delegate_id,
|
||||||
@ -44,7 +44,7 @@ void BlenderSceneDelegate::populate(Depsgraph *deps, bContext *cont)
|
|||||||
unsigned int scene_recalc = ((ID *)scene_)->recalc;
|
unsigned int scene_recalc = ((ID *)scene_)->recalc;
|
||||||
if (scene_recalc) {
|
if (scene_recalc) {
|
||||||
/* Checking scene updates */
|
/* Checking scene updates */
|
||||||
CLOG_INFO(LOG_BSD,
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE,
|
||||||
2,
|
2,
|
||||||
"Update: %s [%s]",
|
"Update: %s [%s]",
|
||||||
((ID *)scene_)->name,
|
((ID *)scene_)->name,
|
||||||
@ -74,7 +74,7 @@ void BlenderSceneDelegate::populate(Depsgraph *deps, bContext *cont)
|
|||||||
DEG_iterator_ids_begin, DEG_iterator_ids_next, DEG_iterator_ids_end, &data, ID *, id) {
|
DEG_iterator_ids_begin, DEG_iterator_ids_next, DEG_iterator_ids_end, &data, ID *, id) {
|
||||||
|
|
||||||
CLOG_INFO(
|
CLOG_INFO(
|
||||||
LOG_BSD, 2, "Update: %s [%s]", id->name, std::bitset<32>(id->recalc).to_string().c_str());
|
LOG_RENDER_HYDRA_SCENE, 2, "Update: %s [%s]", id->name, std::bitset<32>(id->recalc).to_string().c_str());
|
||||||
|
|
||||||
switch (GS(id->name)) {
|
switch (GS(id->name)) {
|
||||||
case ID_OB: {
|
case ID_OB: {
|
||||||
@ -125,14 +125,14 @@ void BlenderSceneDelegate::clear()
|
|||||||
|
|
||||||
pxr::HdMeshTopology BlenderSceneDelegate::GetMeshTopology(pxr::SdfPath const &id)
|
pxr::HdMeshTopology BlenderSceneDelegate::GetMeshTopology(pxr::SdfPath const &id)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s", id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||||
MeshData *m_data = mesh_data(id);
|
MeshData *m_data = mesh_data(id);
|
||||||
return m_data->mesh_topology();
|
return m_data->mesh_topology();
|
||||||
}
|
}
|
||||||
|
|
||||||
pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id)
|
pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s", id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||||
ObjectData *obj_data = object_data(id);
|
ObjectData *obj_data = object_data(id);
|
||||||
if (obj_data) {
|
if (obj_data) {
|
||||||
return obj_data->transform();
|
return obj_data->transform();
|
||||||
@ -152,7 +152,7 @@ pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id)
|
|||||||
|
|
||||||
pxr::VtValue BlenderSceneDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const &key)
|
pxr::VtValue BlenderSceneDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const &key)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s, %s", id.GetText(), key.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %s", id.GetText(), key.GetText());
|
||||||
|
|
||||||
ObjectData *obj_data = object_data(id);
|
ObjectData *obj_data = object_data(id);
|
||||||
if (obj_data) {
|
if (obj_data) {
|
||||||
@ -188,7 +188,7 @@ pxr::VtValue BlenderSceneDelegate::GetLightParamValue(pxr::SdfPath const &id,
|
|||||||
pxr::HdPrimvarDescriptorVector BlenderSceneDelegate::GetPrimvarDescriptors(
|
pxr::HdPrimvarDescriptorVector BlenderSceneDelegate::GetPrimvarDescriptors(
|
||||||
pxr::SdfPath const &id, pxr::HdInterpolation interpolation)
|
pxr::SdfPath const &id, pxr::HdInterpolation interpolation)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s, %d", id.GetText(), interpolation);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %d", id.GetText(), interpolation);
|
||||||
|
|
||||||
MeshData *m_data = mesh_data(id);
|
MeshData *m_data = mesh_data(id);
|
||||||
if (m_data) {
|
if (m_data) {
|
||||||
@ -228,7 +228,7 @@ bool BlenderSceneDelegate::GetVisible(pxr::SdfPath const &id)
|
|||||||
|
|
||||||
pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s", prim_id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", prim_id.GetText());
|
||||||
InstancerData *i_data = instancer_data(prim_id, true);
|
InstancerData *i_data = instancer_data(prim_id, true);
|
||||||
if (i_data) {
|
if (i_data) {
|
||||||
return i_data->instancer_id;
|
return i_data->instancer_id;
|
||||||
@ -238,7 +238,7 @@ pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
|||||||
|
|
||||||
pxr::SdfPathVector BlenderSceneDelegate::GetInstancerPrototypes(pxr::SdfPath const &instancer_id)
|
pxr::SdfPathVector BlenderSceneDelegate::GetInstancerPrototypes(pxr::SdfPath const &instancer_id)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s", instancer_id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", instancer_id.GetText());
|
||||||
pxr::SdfPathVector paths;
|
pxr::SdfPathVector paths;
|
||||||
paths.push_back(instancer_id.GetParentPath());
|
paths.push_back(instancer_id.GetParentPath());
|
||||||
return paths;
|
return paths;
|
||||||
@ -247,14 +247,14 @@ pxr::SdfPathVector BlenderSceneDelegate::GetInstancerPrototypes(pxr::SdfPath con
|
|||||||
pxr::VtIntArray BlenderSceneDelegate::GetInstanceIndices(pxr::SdfPath const &instancer_id,
|
pxr::VtIntArray BlenderSceneDelegate::GetInstanceIndices(pxr::SdfPath const &instancer_id,
|
||||||
pxr::SdfPath const &prototype_id)
|
pxr::SdfPath const &prototype_id)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s, %s", instancer_id.GetText(), prototype_id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %s", instancer_id.GetText(), prototype_id.GetText());
|
||||||
InstancerData *i_data = instancer_data(instancer_id);
|
InstancerData *i_data = instancer_data(instancer_id);
|
||||||
return i_data->instance_indices();
|
return i_data->instance_indices();
|
||||||
}
|
}
|
||||||
|
|
||||||
pxr::GfMatrix4d BlenderSceneDelegate::GetInstancerTransform(pxr::SdfPath const &instancer_id)
|
pxr::GfMatrix4d BlenderSceneDelegate::GetInstancerTransform(pxr::SdfPath const &instancer_id)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s", instancer_id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", instancer_id.GetText());
|
||||||
InstancerData *i_data = instancer_data(instancer_id);
|
InstancerData *i_data = instancer_data(instancer_id);
|
||||||
return i_data->transform();
|
return i_data->transform();
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility)
|
|||||||
Object *,
|
Object *,
|
||||||
object) {
|
object) {
|
||||||
|
|
||||||
CLOG_INFO(LOG_BSD, 2, "Add %s", ((ID *)object)->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "Add %s", ((ID *)object)->name);
|
||||||
if (!ObjectData::is_supported(object)) {
|
if (!ObjectData::is_supported(object)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace blender::render::hydra {
|
namespace blender::render::hydra {
|
||||||
|
|
||||||
extern struct CLG_LogRef *LOG_BSD; /* BSD - Blender Scene Delegate */
|
extern struct CLG_LogRef *LOG_RENDER_HYDRA_SCENE; /* BSD - Blender Scene Delegate */
|
||||||
|
|
||||||
class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
||||||
friend MeshData;
|
friend MeshData;
|
||||||
|
@ -15,7 +15,7 @@ InstancerData::InstancerData(BlenderSceneDelegate *scene_delegate, Object *objec
|
|||||||
id_ = nullptr;
|
id_ = nullptr;
|
||||||
p_id_ = prim_id(scene_delegate, object);
|
p_id_ = prim_id(scene_delegate, object);
|
||||||
instancer_id = p_id_.AppendElementString("Instancer");
|
instancer_id = p_id_.AppendElementString("Instancer");
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s, instancer_id=%s", ((ID *)parent_obj_)->name, instancer_id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s, instancer_id=%s", ((ID *)parent_obj_)->name, instancer_id.GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InstancerData::is_supported(Object *object)
|
bool InstancerData::is_supported(Object *object)
|
||||||
@ -54,7 +54,7 @@ pxr::SdfPath InstancerData::prim_id(BlenderSceneDelegate *scene_delegate, Object
|
|||||||
|
|
||||||
void InstancerData::init()
|
void InstancerData::init()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", ((ID *)parent_obj_)->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", ((ID *)parent_obj_)->name);
|
||||||
|
|
||||||
set_instances();
|
set_instances();
|
||||||
MeshData::init();
|
MeshData::init();
|
||||||
@ -62,7 +62,7 @@ void InstancerData::init()
|
|||||||
|
|
||||||
void InstancerData::insert()
|
void InstancerData::insert()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", ((ID *)parent_obj_)->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", ((ID *)parent_obj_)->name);
|
||||||
MeshData::insert();
|
MeshData::insert();
|
||||||
|
|
||||||
if (face_vertex_counts_.empty()) {
|
if (face_vertex_counts_.empty()) {
|
||||||
@ -73,7 +73,7 @@ void InstancerData::insert()
|
|||||||
|
|
||||||
void InstancerData::remove()
|
void InstancerData::remove()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", ((ID *)parent_obj_)->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", ((ID *)parent_obj_)->name);
|
||||||
|
|
||||||
if (!scene_delegate_->GetRenderIndex().HasInstancer(instancer_id)) {
|
if (!scene_delegate_->GetRenderIndex().HasInstancer(instancer_id)) {
|
||||||
return;
|
return;
|
||||||
@ -85,7 +85,7 @@ void InstancerData::remove()
|
|||||||
|
|
||||||
void InstancerData::update()
|
void InstancerData::update()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", ((ID *)parent_obj_)->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", ((ID *)parent_obj_)->name);
|
||||||
|
|
||||||
pxr::HdDirtyBits bits = pxr::HdChangeTracker::Clean;
|
pxr::HdDirtyBits bits = pxr::HdChangeTracker::Clean;
|
||||||
unsigned int recalc = ((ID *)parent_obj_)->recalc;
|
unsigned int recalc = ((ID *)parent_obj_)->recalc;
|
||||||
@ -113,7 +113,7 @@ void InstancerData::update()
|
|||||||
|
|
||||||
pxr::VtValue InstancerData::get_data(pxr::TfToken const &key) const
|
pxr::VtValue InstancerData::get_data(pxr::TfToken const &key) const
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s [%s]", id_->name, key.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s [%s]", id_->name, key.GetText());
|
||||||
|
|
||||||
if (key == pxr::HdInstancerTokens->instanceTransform) {
|
if (key == pxr::HdInstancerTokens->instanceTransform) {
|
||||||
return pxr::VtValue(transforms_);
|
return pxr::VtValue(transforms_);
|
||||||
@ -185,7 +185,7 @@ bool InstancerData::set_instances()
|
|||||||
}
|
}
|
||||||
transforms_.push_back(gf_matrix_from_transform(dupli->mat));
|
transforms_.push_back(gf_matrix_from_transform(dupli->mat));
|
||||||
CLOG_INFO(
|
CLOG_INFO(
|
||||||
LOG_BSD, 2, "Instance %s (%s) %d", id_->name, ((ID *)dupli->ob)->name, dupli->random_id);
|
LOG_RENDER_HYDRA_SCENE, 2, "Instance %s (%s) %d", id_->name, ((ID *)dupli->ob)->name, dupli->random_id);
|
||||||
}
|
}
|
||||||
free_object_duplilist(lb);
|
free_object_duplilist(lb);
|
||||||
|
|
||||||
|
@ -17,12 +17,12 @@ namespace blender::render::hydra {
|
|||||||
LightData::LightData(BlenderSceneDelegate *scene_delegate, Object *object)
|
LightData::LightData(BlenderSceneDelegate *scene_delegate, Object *object)
|
||||||
: ObjectData(scene_delegate, object)
|
: ObjectData(scene_delegate, object)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s id=%s", id_->name, p_id_.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s id=%s", id_->name, p_id_.GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightData::init()
|
void LightData::init()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
|
|
||||||
Light *light = (Light *)((Object *)id_)->data;
|
Light *light = (Light *)((Object *)id_)->data;
|
||||||
data_.clear();
|
data_.clear();
|
||||||
@ -87,19 +87,19 @@ void LightData::init()
|
|||||||
|
|
||||||
void LightData::insert()
|
void LightData::insert()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().InsertSprim(p_type_, scene_delegate_, p_id_);
|
scene_delegate_->GetRenderIndex().InsertSprim(p_type_, scene_delegate_, p_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightData::remove()
|
void LightData::remove()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().RemoveSprim(p_type_, p_id_);
|
scene_delegate_->GetRenderIndex().RemoveSprim(p_type_, p_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightData::update()
|
void LightData::update()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
|
|
||||||
Light *light = (Light *)((Object *)id_)->data;
|
Light *light = (Light *)((Object *)id_)->data;
|
||||||
if (prim_type(light) != p_type_) {
|
if (prim_type(light) != p_type_) {
|
||||||
|
@ -24,7 +24,7 @@ MaterialData::MaterialData(BlenderSceneDelegate *scene_delegate, Material *mater
|
|||||||
: IdData(scene_delegate, (ID *)material)
|
: IdData(scene_delegate, (ID *)material)
|
||||||
{
|
{
|
||||||
p_id_ = prim_id(scene_delegate, material);
|
p_id_ = prim_id(scene_delegate, material);
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s, id=%s", id_->name, p_id_.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s, id=%s", id_->name, p_id_.GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<MaterialData> MaterialData::create(BlenderSceneDelegate *scene_delegate,
|
std::unique_ptr<MaterialData> MaterialData::create(BlenderSceneDelegate *scene_delegate,
|
||||||
@ -47,7 +47,7 @@ pxr::SdfPath MaterialData::prim_id(BlenderSceneDelegate *scene_delegate, Materia
|
|||||||
|
|
||||||
void MaterialData::init()
|
void MaterialData::init()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
|
|
||||||
material_network_map_ = pxr::VtValue();
|
material_network_map_ = pxr::VtValue();
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ void MaterialData::init()
|
|||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CLOG_ERROR(LOG_BSD, "Export error for %s", id_->name);
|
CLOG_ERROR(LOG_RENDER_HYDRA_SCENE, "Export error for %s", id_->name);
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
}
|
}
|
||||||
Py_DECREF(module);
|
Py_DECREF(module);
|
||||||
@ -84,25 +84,25 @@ void MaterialData::init()
|
|||||||
PyGILState_Release(gstate);
|
PyGILState_Release(gstate);
|
||||||
|
|
||||||
mtlx_path_ = pxr::SdfAssetPath(path, path);
|
mtlx_path_ = pxr::SdfAssetPath(path, path);
|
||||||
CLOG_INFO(LOG_BSD, 2, "Export: %s, mtlx=%s", id_->name, mtlx_path_.GetResolvedPath().c_str());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "Export: %s, mtlx=%s", id_->name, mtlx_path_.GetResolvedPath().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialData::insert()
|
void MaterialData::insert()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().InsertSprim(
|
scene_delegate_->GetRenderIndex().InsertSprim(
|
||||||
pxr::HdPrimTypeTokens->material, scene_delegate_, p_id_);
|
pxr::HdPrimTypeTokens->material, scene_delegate_, p_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialData::remove()
|
void MaterialData::remove()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().RemoveSprim(pxr::HdPrimTypeTokens->material, p_id_);
|
scene_delegate_->GetRenderIndex().RemoveSprim(pxr::HdPrimTypeTokens->material, p_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaterialData::update()
|
void MaterialData::update()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
init();
|
init();
|
||||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(p_id_,
|
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(p_id_,
|
||||||
pxr::HdMaterial::AllDirty);
|
pxr::HdMaterial::AllDirty);
|
||||||
@ -115,7 +115,7 @@ pxr::VtValue MaterialData::get_data(pxr::TfToken const &key) const
|
|||||||
if (!mtlx_path_.GetResolvedPath().empty()) {
|
if (!mtlx_path_.GetResolvedPath().empty()) {
|
||||||
ret = mtlx_path_;
|
ret = mtlx_path_;
|
||||||
}
|
}
|
||||||
CLOG_INFO(LOG_BSD, 3, "%s", key.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", key.GetText());
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,12 @@ namespace blender::render::hydra {
|
|||||||
MeshData::MeshData(BlenderSceneDelegate *scene_delegate, Object *object)
|
MeshData::MeshData(BlenderSceneDelegate *scene_delegate, Object *object)
|
||||||
: ObjectData(scene_delegate, object), mat_data_(nullptr)
|
: ObjectData(scene_delegate, object), mat_data_(nullptr)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s, id=%s", id_->name, p_id_.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s, id=%s", id_->name, p_id_.GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshData::init()
|
void MeshData::init()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
|
|
||||||
Object *object = (Object *)id_;
|
Object *object = (Object *)id_;
|
||||||
if (object->type == OB_MESH && object->mode == OB_MODE_OBJECT &&
|
if (object->type == OB_MESH && object->mode == OB_MODE_OBJECT &&
|
||||||
@ -47,7 +47,7 @@ void MeshData::insert()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().InsertRprim(
|
scene_delegate_->GetRenderIndex().InsertRprim(
|
||||||
pxr::HdPrimTypeTokens->mesh, scene_delegate_, p_id_);
|
pxr::HdPrimTypeTokens->mesh, scene_delegate_, p_id_);
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ void MeshData::remove()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().RemoveRprim(p_id_);
|
scene_delegate_->GetRenderIndex().RemoveRprim(p_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ void MeshData::update()
|
|||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkRprimDirty(p_id_, bits);
|
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkRprimDirty(p_id_, bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ WorldData::WorldData(BlenderSceneDelegate *scene_delegate, World *world, bContex
|
|||||||
: IdData(scene_delegate, (ID *)world), context_(context)
|
: IdData(scene_delegate, (ID *)world), context_(context)
|
||||||
{
|
{
|
||||||
p_id_ = prim_id(scene_delegate);
|
p_id_ = prim_id(scene_delegate);
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s, id=%s", id_->name, p_id_.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s, id=%s", id_->name, p_id_.GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<WorldData> WorldData::create(BlenderSceneDelegate *scene_delegate,
|
std::unique_ptr<WorldData> WorldData::create(BlenderSceneDelegate *scene_delegate,
|
||||||
@ -52,7 +52,7 @@ pxr::SdfPath WorldData::prim_id(BlenderSceneDelegate *scene_delegate)
|
|||||||
|
|
||||||
void WorldData::init()
|
void WorldData::init()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
|
|
||||||
World *world = (World *)id_;
|
World *world = (World *)id_;
|
||||||
data_.clear();
|
data_.clear();
|
||||||
@ -125,20 +125,20 @@ void WorldData::init()
|
|||||||
|
|
||||||
void WorldData::insert()
|
void WorldData::insert()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().InsertSprim(
|
scene_delegate_->GetRenderIndex().InsertSprim(
|
||||||
pxr::HdPrimTypeTokens->domeLight, scene_delegate_, p_id_);
|
pxr::HdPrimTypeTokens->domeLight, scene_delegate_, p_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldData::remove()
|
void WorldData::remove()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
scene_delegate_->GetRenderIndex().RemoveSprim(pxr::HdPrimTypeTokens->domeLight, p_id_);
|
scene_delegate_->GetRenderIndex().RemoveSprim(pxr::HdPrimTypeTokens->domeLight, p_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldData::update()
|
void WorldData::update()
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_BSD, 2, "%s", id_->name);
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s", id_->name);
|
||||||
init();
|
init();
|
||||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(p_id_,
|
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkSprimDirty(p_id_,
|
||||||
pxr::HdLight::AllDirty);
|
pxr::HdLight::AllDirty);
|
||||||
|
Loading…
Reference in New Issue
Block a user