forked from blender/blender
Support several instancers on one object #24
@ -414,11 +414,6 @@ pxr::GfMatrix4d BlenderSceneDelegate::GetTransform(pxr::SdfPath const &id)
|
||||
return world_data->transform();
|
||||
}
|
||||
|
||||
InstancerData *i_data = instancer_data(id);
|
||||
if (i_data) {
|
||||
return i_data->transform();
|
||||
}
|
||||
|
||||
return pxr::GfMatrix4d();
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,6 @@ void InstancerData::init()
|
||||
{
|
||||
ID_LOG(2, "");
|
||||
set_instances();
|
||||
for (auto &it : instances) {
|
||||
it.second.obj_data->init();
|
||||
}
|
||||
}
|
||||
|
||||
pxr::GfMatrix4d InstancerData::transform()
|
||||
@ -138,6 +135,8 @@ void InstancerData::set_instances()
|
||||
continue;
|
||||
}
|
||||
inst->obj_data = std::make_unique<InstanceMeshData>(scene_delegate, dupli->ob, path);
|
||||
inst->obj_data->init();
|
||||
inst->obj_data->insert();
|
||||
}
|
||||
else {
|
||||
inst = &it->second;
|
||||
@ -148,6 +147,16 @@ void InstancerData::set_instances()
|
||||
++index;
|
||||
}
|
||||
free_object_duplilist(lb);
|
||||
|
||||
/* Remove intances without indices */
|
||||
for (auto it = instances.begin(); it != instances.end(); ++it) {
|
||||
if (!it->second.indices.empty()) {
|
||||
continue;
|
||||
}
|
||||
it->second.obj_data->remove();
|
||||
instances.erase(it);
|
||||
it = instances.begin();
|
||||
}
|
||||
}
|
||||
|
||||
void InstancerData::insert()
|
||||
|
Loading…
Reference in New Issue
Block a user