forked from blender/blender
Support several instancers on one object #24
@ -88,8 +88,11 @@ void BlenderSceneDelegate::update_collection(bool remove, bool visibility)
|
||||
{
|
||||
if (visibility) {
|
||||
/* Check and update visibility */
|
||||
for (auto &obj : objects) {
|
||||
obj.second->update_visibility(view3d);
|
||||
for (auto &it : objects) {
|
||||
it.second->update_visibility(view3d);
|
||||
}
|
||||
for (auto &it : instancers) {
|
||||
it.second->update_visibility(view3d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,11 @@ bool InstancerData::update_visibility(View3D *view3d)
|
||||
if (ret) {
|
||||
scene_delegate->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
|
||||
p_id, pxr::HdChangeTracker::DirtyVisibility);
|
||||
for (auto &it : instances) {
|
||||
it.second.obj_data->visible = visible;
|
||||
scene_delegate->GetRenderIndex().GetChangeTracker().MarkRprimDirty(
|
||||
it.second.obj_data->p_id, pxr::HdChangeTracker::DirtyVisibility);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -135,10 +140,9 @@ void InstancerData::check_update(Object *object)
|
||||
}
|
||||
}
|
||||
|
||||
void InstancerData::check_remove(Object *object)
|
||||
void InstancerData::check_remove(pxr::SdfPath const &obj_id)
|
||||
{
|
||||
pxr::SdfPath path = ObjectData::prim_id(scene_delegate, object);
|
||||
path = p_id.AppendElementString(path.GetName());
|
||||
pxr::SdfPath path = p_id.AppendElementString(obj_id.GetName());
|
||||
auto it = instances.find(path);
|
||||
if (it == instances.end()) {
|
||||
return;
|
||||
|
@ -36,7 +36,7 @@ class InstancerData : public ObjectData {
|
||||
ObjectData *object_data(pxr::SdfPath const &id);
|
||||
pxr::SdfPathVector prototypes();
|
||||
void check_update(Object *object);
|
||||
void check_remove(Object *object);
|
||||
void check_remove(pxr::SdfPath const &obj_id);
|
||||
|
||||
private:
|
||||
void set_instances();
|
||||
|
Loading…
Reference in New Issue
Block a user