forked from blender/blender
Make object visibility and instancing creation to be calculated via depsgraph #57
@ -438,6 +438,9 @@ void BlenderSceneDelegate::update_collection()
|
|||||||
if (!ObjectData::is_supported(object)) {
|
if (!ObjectData::is_supported(object)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!ObjectData::is_visible(this, object)) {
|
||||||
|
|||||||
|
continue;
|
||||||
|
}
|
||||||
available_objects.add(object_prim_id(object).GetName());
|
available_objects.add(object_prim_id(object).GetName());
|
||||||
|
|
||||||
pxr::SdfPath id = object_prim_id(object);
|
pxr::SdfPath id = object_prim_id(object);
|
||||||
@ -458,6 +461,9 @@ void BlenderSceneDelegate::update_collection()
|
|||||||
instancer_data_->init();
|
instancer_data_->init();
|
||||||
instancer_data_->insert();
|
instancer_data_->insert();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
instancer_data_->update();
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove unused objects */
|
/* Remove unused objects */
|
||||||
objects_.remove_if([&](auto item) {
|
objects_.remove_if([&](auto item) {
|
||||||
|
@ -86,16 +86,10 @@ void InstancerData::remove()
|
|||||||
void InstancerData::update()
|
void InstancerData::update()
|
||||||
{
|
{
|
||||||
ID_LOG(1, "");
|
ID_LOG(1, "");
|
||||||
Object *object = (Object *)id;
|
|
||||||
if (id->recalc & ID_RECALC_GEOMETRY ||
|
|
||||||
(object->data && ((ID *)object->data)->recalc & ID_RECALC_GEOMETRY) ||
|
|
||||||
id->recalc & ID_RECALC_TRANSFORM)
|
|
||||||
{
|
|
||||||
write_instances();
|
write_instances();
|
||||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
|
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
|
||||||
prim_id, pxr::HdChangeTracker::AllDirty);
|
prim_id, pxr::HdChangeTracker::AllDirty);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pxr::VtValue InstancerData::get_data(pxr::TfToken const &key) const
|
pxr::VtValue InstancerData::get_data(pxr::TfToken const &key) const
|
||||||
{
|
{
|
||||||
@ -370,7 +364,9 @@ void InstancerData::write_instances()
|
|||||||
if (!is_supported(ob)) {
|
if (!is_supported(ob)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!ObjectData::is_visible(scene_delegate_, d.dupli_parent)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pxr::SdfPath p_id = object_prim_id(ob);
|
pxr::SdfPath p_id = object_prim_id(ob);
|
||||||
if (ob->type == OB_LAMP) {
|
if (ob->type == OB_LAMP) {
|
||||||
LightInstance *inst = light_instance(p_id);
|
LightInstance *inst = light_instance(p_id);
|
||||||
@ -390,6 +386,9 @@ void InstancerData::write_instances()
|
|||||||
inst->data->init();
|
inst->data->init();
|
||||||
inst->data->insert();
|
inst->data->insert();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
inst->data->update();
|
||||||
|
}
|
||||||
ID_LOG(2, "Mesh %s %d", inst->data->id->name, mesh_transforms_.size());
|
ID_LOG(2, "Mesh %s %d", inst->data->id->name, mesh_transforms_.size());
|
||||||
inst->indices.push_back(mesh_transforms_.size());
|
inst->indices.push_back(mesh_transforms_.size());
|
||||||
mesh_transforms_.push_back(gf_matrix_from_transform(dupli->mat));
|
mesh_transforms_.push_back(gf_matrix_from_transform(dupli->mat));
|
||||||
|
Loading…
Reference in New Issue
Block a user
use macro
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS
here