Fix Mesh PhysicsCollisionAPI by accounting for how it's referenced/instanced.
Because we introduce an additional parent scope when referencing a `Mesh` prim (required for instancing), we need to create an `over` prim that allows to actually operate on the to-be-referenced Mesh. PiperOrigin-RevId: 753941355 Change-Id: I829be9e82fe650802afcbc46f4b2f4c81eb53bd1
This commit is contained in:
committed by
Copybara-Service
parent
6c319310b8
commit
02656532c2
@@ -66,7 +66,6 @@ using TfStaticData = pxr::TfStaticData<T>;
|
||||
|
||||
// clang-format off
|
||||
TF_DEFINE_PRIVATE_TOKENS(kTokens,
|
||||
// Xform ops
|
||||
((body, "Body"))
|
||||
((body_name, "mujoco:body_name"))
|
||||
((geom, "Geom"))
|
||||
@@ -89,7 +88,8 @@ TF_DEFINE_PRIVATE_TOKENS(kTokens,
|
||||
((outputsRgb, "outputs:rgb"))
|
||||
((inputsMetallic, "inputs:metallic"))
|
||||
(repeat)
|
||||
);
|
||||
((sourceMesh, pxr::UsdGeomTokens->Mesh))
|
||||
);
|
||||
|
||||
// Using to satisfy TF_REGISTRY_FUNCTION macro below and avoid operating in PXR_NS.
|
||||
using pxr::TfEnum;
|
||||
@@ -330,7 +330,7 @@ class ModelWriter {
|
||||
pxr::SdfPath subcomponent_path =
|
||||
CreatePrimSpec(data_, parent_path, name, pxr::UsdGeomTokens->Xform);
|
||||
pxr::SdfPath mesh_path =
|
||||
CreatePrimSpec(data_, subcomponent_path, pxr::UsdGeomTokens->Mesh,
|
||||
CreatePrimSpec(data_, subcomponent_path, kTokens->sourceMesh,
|
||||
pxr::UsdGeomTokens->Mesh);
|
||||
mesh_paths_[*mesh->name] = subcomponent_path;
|
||||
|
||||
@@ -600,7 +600,15 @@ class ModelWriter {
|
||||
// Reference the mesh asset written in WriteMeshes.
|
||||
AddPrimReference(data_, subcomponent_path, mesh_paths_[*geom->meshname]);
|
||||
|
||||
return subcomponent_path;
|
||||
// We want to use instancing with meshes, and it requires creating a parent
|
||||
// scope to be referenced, with the Mesh prim as a child.
|
||||
// To be able to actually manipulate the Mesh prim, we need to create and
|
||||
// return the corresponding `over` prim as a child of the referencing prim.
|
||||
pxr::SdfPath over_mesh_path =
|
||||
CreatePrimSpec(data_, subcomponent_path, kTokens->sourceMesh,
|
||||
pxr::UsdGeomTokens->Mesh, pxr::SdfSpecifierOver);
|
||||
|
||||
return over_mesh_path;
|
||||
}
|
||||
|
||||
pxr::SdfPath WriteSiteGeom(const mjsSite *site,
|
||||
|
||||
Reference in New Issue
Block a user