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) {
|
if (visibility) {
|
||||||
/* Check and update visibility */
|
/* Check and update visibility */
|
||||||
for (auto &obj : objects) {
|
for (auto &it : objects) {
|
||||||
obj.second->update_visibility(view3d);
|
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) {
|
if (ret) {
|
||||||
scene_delegate->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
|
scene_delegate->GetRenderIndex().GetChangeTracker().MarkInstancerDirty(
|
||||||
p_id, pxr::HdChangeTracker::DirtyVisibility);
|
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;
|
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);
|
pxr::SdfPath path = p_id.AppendElementString(obj_id.GetName());
|
||||||
path = p_id.AppendElementString(path.GetName());
|
|
||||||
auto it = instances.find(path);
|
auto it = instances.find(path);
|
||||||
if (it == instances.end()) {
|
if (it == instances.end()) {
|
||||||
return;
|
return;
|
||||||
|
@ -36,7 +36,7 @@ class InstancerData : public ObjectData {
|
|||||||
ObjectData *object_data(pxr::SdfPath const &id);
|
ObjectData *object_data(pxr::SdfPath const &id);
|
||||||
pxr::SdfPathVector prototypes();
|
pxr::SdfPathVector prototypes();
|
||||||
void check_update(Object *object);
|
void check_update(Object *object);
|
||||||
void check_remove(Object *object);
|
void check_remove(pxr::SdfPath const &obj_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void set_instances();
|
void set_instances();
|
||||||
|
Loading…
Reference in New Issue
Block a user