Set mesh visual flag regardless of discardvisual.
PiperOrigin-RevId: 617428859 Change-Id: I427d888e6caa2fe1ae6597ca7165c600c9779cc7
This commit is contained in:
committed by
Copybara-Service
parent
9b86329797
commit
07da7336e8
@@ -432,6 +432,7 @@ void mjCMesh::LoadSDF() {
|
|||||||
// compiler
|
// compiler
|
||||||
void mjCMesh::Compile(const mjVFS* vfs) {
|
void mjCMesh::Compile(const mjVFS* vfs) {
|
||||||
CopyFromSpec();
|
CopyFromSpec();
|
||||||
|
visual_ = true;
|
||||||
|
|
||||||
// load file
|
// load file
|
||||||
if (!file_.empty()) {
|
if (!file_.empty()) {
|
||||||
|
|||||||
+5
-14
@@ -983,21 +983,12 @@ void mjCModel::IndexAssets(bool discard) {
|
|||||||
|
|
||||||
// find mesh by name
|
// find mesh by name
|
||||||
if (!pgeom->get_meshname().empty()) {
|
if (!pgeom->get_meshname().empty()) {
|
||||||
mjCBase* m = FindObject(mjOBJ_MESH, pgeom->get_meshname());
|
mjCBase* pmesh = FindObject(mjOBJ_MESH, pgeom->get_meshname());
|
||||||
if (m) {
|
if (pmesh) {
|
||||||
if (discard && geoms[i]->visual_) {
|
if (!pgeom->visual_) {
|
||||||
// do not associate with a mesh
|
((mjCMesh*)pmesh)->SetNotVisual(); // reset to true by mesh->Compile()
|
||||||
pgeom->mesh = nullptr;
|
|
||||||
} else {
|
|
||||||
// associate mesh with geom
|
|
||||||
pgeom->mesh = (mjCMesh*)m;
|
|
||||||
|
|
||||||
// mark mesh as not visual
|
|
||||||
// this is irreversible so only performed when IndexAssets is called with discard
|
|
||||||
if (discard) {
|
|
||||||
pgeom->mesh->SetNotVisual();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
pgeom->mesh = (discard && pgeom->visual_) ? nullptr : (mjCMesh*)pmesh;
|
||||||
} else {
|
} else {
|
||||||
throw mjCError(pgeom, "mesh '%s' not found in geom %d", pgeom->get_meshname().c_str(), i);
|
throw mjCError(pgeom, "mesh '%s' not found in geom %d", pgeom->get_meshname().c_str(), i);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user