Add material namespacing to sites.
Fixes #2243. PiperOrigin-RevId: 699713625 Change-Id: I1b45e43f2a6ccfa64c46489c9426fcc2acdc94c3
This commit is contained in:
committed by
Copybara-Service
parent
f909d63cdf
commit
13b6055098
@@ -3102,6 +3102,15 @@ void mjCSite::CopyFromSpec() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void mjCSite::NameSpace(const mjCModel* m) {
|
||||||
|
mjCBase::NameSpace(m);
|
||||||
|
if (!spec_material_.empty() && model != m) {
|
||||||
|
spec_material_ = m->prefix + spec_material_ + m->suffix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// compiler
|
// compiler
|
||||||
void mjCSite::Compile(void) {
|
void mjCSite::Compile(void) {
|
||||||
CopyFromSpec();
|
CopyFromSpec();
|
||||||
|
|||||||
@@ -615,6 +615,7 @@ class mjCSite : public mjCSite_, private mjsSite {
|
|||||||
void Compile(void); // compiler
|
void Compile(void); // compiler
|
||||||
void CopyFromSpec(); // copy spec into attributes
|
void CopyFromSpec(); // copy spec into attributes
|
||||||
void PointToLocal(void);
|
void PointToLocal(void);
|
||||||
|
void NameSpace(const mjCModel* m);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -731,7 +731,7 @@ static constexpr char xml_child[] = R"(
|
|||||||
<joint type="hinge" name="hinge"/>
|
<joint type="hinge" name="hinge"/>
|
||||||
<geom class="cylinder" material="material"/>
|
<geom class="cylinder" material="material"/>
|
||||||
<light mode="targetbody" target="targetbody"/>
|
<light mode="targetbody" target="targetbody"/>
|
||||||
<site name="site"/>
|
<site name="site" material="material"/>
|
||||||
<body name="targetbody"/>
|
<body name="targetbody"/>
|
||||||
<body/>
|
<body/>
|
||||||
</body>
|
</body>
|
||||||
@@ -798,7 +798,7 @@ TEST_F(MujocoTest, AttachSame) {
|
|||||||
<joint type="hinge" name="hinge"/>
|
<joint type="hinge" name="hinge"/>
|
||||||
<geom class="cylinder" material="material"/>
|
<geom class="cylinder" material="material"/>
|
||||||
<light mode="targetbody" target="targetbody"/>
|
<light mode="targetbody" target="targetbody"/>
|
||||||
<site name="site"/>
|
<site name="site" material="material"/>
|
||||||
<body name="targetbody"/>
|
<body name="targetbody"/>
|
||||||
<body/>
|
<body/>
|
||||||
</body>
|
</body>
|
||||||
@@ -811,7 +811,7 @@ TEST_F(MujocoTest, AttachSame) {
|
|||||||
<joint type="hinge" name="attached-hinge-1"/>
|
<joint type="hinge" name="attached-hinge-1"/>
|
||||||
<geom class="cylinder" material="material"/>
|
<geom class="cylinder" material="material"/>
|
||||||
<light mode="targetbody" target="attached-targetbody-1"/>
|
<light mode="targetbody" target="attached-targetbody-1"/>
|
||||||
<site name="attached-site-1"/>
|
<site name="attached-site-1" material="material"/>
|
||||||
<body name="attached-targetbody-1"/>
|
<body name="attached-targetbody-1"/>
|
||||||
<body/>
|
<body/>
|
||||||
</body>
|
</body>
|
||||||
@@ -952,7 +952,7 @@ TEST_F(MujocoTest, AttachDifferent) {
|
|||||||
<joint type="hinge" name="attached-hinge-1"/>
|
<joint type="hinge" name="attached-hinge-1"/>
|
||||||
<geom class="attached-cylinder-1" material="attached-material-1"/>
|
<geom class="attached-cylinder-1" material="attached-material-1"/>
|
||||||
<light mode="targetbody" target="attached-targetbody-1"/>
|
<light mode="targetbody" target="attached-targetbody-1"/>
|
||||||
<site name="attached-site-1"/>
|
<site name="attached-site-1" material="attached-material-1"/>
|
||||||
<body name="attached-targetbody-1"/>
|
<body name="attached-targetbody-1"/>
|
||||||
<body/>
|
<body/>
|
||||||
</body>
|
</body>
|
||||||
@@ -1087,7 +1087,7 @@ TEST_F(MujocoTest, AttachFrame) {
|
|||||||
<joint type="hinge" name="attached-hinge-1"/>
|
<joint type="hinge" name="attached-hinge-1"/>
|
||||||
<geom class="attached-cylinder-1" material="attached-material-1"/>
|
<geom class="attached-cylinder-1" material="attached-material-1"/>
|
||||||
<light mode="targetbody" target="attached-targetbody-1"/>
|
<light mode="targetbody" target="attached-targetbody-1"/>
|
||||||
<site name="attached-site-1"/>
|
<site name="attached-site-1" material="attached-material-1"/>
|
||||||
<body name="attached-targetbody-1"/>
|
<body name="attached-targetbody-1"/>
|
||||||
<body/>
|
<body/>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user