Support several instancers on one object #24

Merged
Bogdan Nagirniak merged 16 commits from BLEN-383 into hydra-render 2023-04-19 02:46:24 +02:00
4 changed files with 22 additions and 22 deletions
Showing only changes of commit 2223d8b442 - Show all commits

View File

@ -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()); ID_LOG(2, "");
} }
void LightData::init() void LightData::init()
{ {
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
Light *light = (Light *)((Object *)id)->data; Light *light = (Light *)((Object *)id)->data;
data.clear(); data.clear();
@ -154,19 +154,19 @@ bool LightData::update_visibility(View3D *view3d)
void LightData::insert() void LightData::insert()
{ {
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
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); ID_LOG(2, "");
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); ID_LOG(2, "");
Light *light = (Light *)((Object *)id)->data; Light *light = (Light *)((Object *)id)->data;
if (prim_type(light) != p_type) { if (prim_type(light) != p_type) {

View File

@ -42,12 +42,12 @@ 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()); ID_LOG(2, "");
} }
void MaterialData::init() void MaterialData::init()
{ {
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
material_network_map = pxr::VtValue(); material_network_map = pxr::VtValue();
@ -84,7 +84,7 @@ 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()); ID_LOG(2, "mtlx=%s", mtlx_path.GetResolvedPath().c_str());
} }
pxr::VtValue MaterialData::get_data(pxr::TfToken const &key) const pxr::VtValue MaterialData::get_data(pxr::TfToken const &key) const
@ -94,7 +94,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()); ID_LOG(3, "%s", key.GetText());
} }
return ret; return ret;
} }
@ -121,20 +121,20 @@ pxr::VtValue MaterialData::material_resource()
void MaterialData::insert() void MaterialData::insert()
{ {
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
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); ID_LOG(2, "");
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); ID_LOG(2, "");
init(); init();
scene_delegate->GetRenderIndex().GetChangeTracker().MarkSprimDirty(p_id, scene_delegate->GetRenderIndex().GetChangeTracker().MarkSprimDirty(p_id,
pxr::HdMaterial::AllDirty); pxr::HdMaterial::AllDirty);

View File

@ -18,7 +18,7 @@ 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()); ID_LOG(2, "");
} }
pxr::VtValue MeshData::get_data(pxr::TfToken const &key) const pxr::VtValue MeshData::get_data(pxr::TfToken const &key) const
@ -167,7 +167,7 @@ void MeshData::set_material()
void MeshData::init() void MeshData::init()
{ {
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
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 &&
@ -191,7 +191,7 @@ void MeshData::insert()
return; return;
} }
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
scene_delegate->GetRenderIndex().InsertRprim(pxr::HdPrimTypeTokens->mesh, scene_delegate, p_id); scene_delegate->GetRenderIndex().InsertRprim(pxr::HdPrimTypeTokens->mesh, scene_delegate, p_id);
} }
@ -201,7 +201,7 @@ void MeshData::remove()
return; return;
} }
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
scene_delegate->GetRenderIndex().RemoveRprim(p_id); scene_delegate->GetRenderIndex().RemoveRprim(p_id);
} }
@ -237,7 +237,7 @@ void MeshData::update()
remove(); remove();
return; return;
} }
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
scene_delegate->GetRenderIndex().GetChangeTracker().MarkRprimDirty(p_id, bits); scene_delegate->GetRenderIndex().GetChangeTracker().MarkRprimDirty(p_id, bits);
} }

View File

@ -47,12 +47,12 @@ 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()); ID_LOG(2, "");
} }
void WorldData::init() void WorldData::init()
{ {
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
World *world = (World *)id; World *world = (World *)id;
data.clear(); data.clear();
@ -150,20 +150,20 @@ pxr::VtValue WorldData::get_data(pxr::TfToken const &key) const
void WorldData::insert() void WorldData::insert()
{ {
CLOG_INFO(LOG_BSD, 2, "%s", id->name); ID_LOG(2, "");
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); ID_LOG(2, "");
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); ID_LOG(2, "");
init(); init();
scene_delegate->GetRenderIndex().GetChangeTracker().MarkSprimDirty(p_id, pxr::HdLight::AllDirty); scene_delegate->GetRenderIndex().GetChangeTracker().MarkSprimDirty(p_id, pxr::HdLight::AllDirty);
} }