Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Gazebo materials #2269

Merged
merged 21 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/SdfEntityCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -814,20 +814,20 @@
{
gzwarn << "Using an internal gazebo.material to parse "
<< scriptName << std::endl;
MaterialParser::MaterialValues parsed =
std::optional<MaterialParser::MaterialValues> parsed =
this->dataPtr->materialParser.GetMaterialValues(scriptName);

if(!parsed.ambient.has_value()) {
if(!parsed.has_value()) {
gzwarn << "Material " << scriptName <<
" not recognized, using default."<< std::endl;
" not recognized, using default." << std::endl;

Check warning on line 822 in src/SdfEntityCreator.cc

View check run for this annotation

Codecov / codecov/patch

src/SdfEntityCreator.cc#L821-L822

Added lines #L821 - L822 were not covered by tests
}

visualMaterial.SetAmbient
quarkytale marked this conversation as resolved.
Show resolved Hide resolved
(parsed.ambient.value_or(visualMaterial.Ambient()));
(parsed->ambient.value_or(visualMaterial.Ambient()));
visualMaterial.SetDiffuse
(parsed.diffuse.value_or(visualMaterial.Diffuse()));
(parsed->diffuse.value_or(visualMaterial.Diffuse()));
visualMaterial.SetSpecular
(parsed.specular.value_or(visualMaterial.Specular()));
(parsed->specular.value_or(visualMaterial.Specular()));
}
}
this->dataPtr->ecm->CreateComponent(visualEntity,
Expand Down
2 changes: 1 addition & 1 deletion src/rendering/MaterialParser/MaterialParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void MaterialParser::Load()
}

/////////////////////////////////////////////////
MaterialParser::MaterialValues MaterialParser::GetMaterialValues(
std::optional<MaterialParser::MaterialValues> MaterialParser::GetMaterialValues(
const std::string& material)
{
MaterialValues values;
quarkytale marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion src/rendering/MaterialParser/MaterialParser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MaterialParser

void Load();

MaterialValues GetMaterialValues(const std::string& material);
std::optional<MaterialValues> GetMaterialValues(const std::string& material);

private:
ConfigLoader configLoader;
Expand Down
2 changes: 1 addition & 1 deletion tutorials/migration_sdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ that worked on Gazebo classic may need more plugins on Gazebo.
## Materials

Gazebo does not support Ogre material files like Classic does, because Gazebo
Gazebo can be used with multiple rendering engines. For example, materials defined
can be used with multiple rendering engines. For example, materials defined
within a `<script>` aren't supported on Gazebo:

```
Expand Down
Loading