forked from blender/blender
Support multimaterials on one mesh #44
@ -236,11 +236,12 @@ pxr::SdfPath BlenderSceneDelegate::world_prim_id() const
|
||||
|
||||
ObjectData *BlenderSceneDelegate::object_data(pxr::SdfPath const &id) const
|
||||
{
|
||||
auto it = objects_.find(id);
|
||||
pxr::SdfPath p_id = (id.GetName().find("SM_", 0) == 0) ? id.GetParentPath() : id;
|
||||
auto it = objects_.find(p_id);
|
||||
if (it != objects_.end()) {
|
||||
return it->second.get();
|
||||
}
|
||||
InstancerData *i_data = instancer_data(id, true);
|
||||
InstancerData *i_data = instancer_data(p_id, true);
|
||||
if (i_data) {
|
||||
return i_data->object_data(id);
|
||||
}
|
||||
|
@ -262,14 +262,14 @@ void MeshData::write_normals(Mesh *mesh)
|
||||
pxr::SdfPath MeshData::submesh_prim_id(int index) const
|
||||
{
|
||||
char name[16];
|
||||
snprintf(name, 16, "M_%04x", index);
|
||||
snprintf(name, 16, "SM_%04x", index);
|
||||
return prim_id.AppendElementString(name);
|
||||
}
|
||||
|
||||
const MeshData::SubMesh &MeshData::submesh(pxr::SdfPath const &id) const
|
||||
{
|
||||
int index;
|
||||
sscanf(id.GetName().c_str(), "M_%x", &index);
|
||||
sscanf(id.GetName().c_str(), "SM_%x", &index);
|
||||
return submeshes_[index];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user