-
Notifications
You must be signed in to change notification settings - Fork 275
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
Transparent mode #878
Transparent mode #878
Conversation
Signed-off-by: Atharva Pusalkar <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are some conflicts
…into transparent_mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, transparency is working for me.
src/rendering/RenderUtil.cc
Outdated
/// \param[in] _ecm The entity-component manager | ||
public: void FindWireframeVisualLinks(const EntityComponentManager &_ecm); | ||
public: void FindVisualLinks(const EntityComponentManager &_ecm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PopulateViewModeVisualLinks
? probably not the best naming suggestion I have but I was thinking ways to make the name more expressive and representative of what it's doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -95,6 +96,9 @@ class ignition::gazebo::SceneManagerPrivate | |||
/// \brief Map of sensor entity in Gazebo to sensor pointers. | |||
public: std::map<Entity, rendering::SensorPtr> sensors; | |||
|
|||
/// \brief The map of the original transparency values for the nodes. | |||
public: std::map<std::string, double> originalTransparency; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider removing items from this map when visuals are removed from the scene.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/rendering/SceneManager.cc
Outdated
|
||
// Geometry material | ||
auto geomMat = geom->Material(); | ||
if (nullptr == geomMat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One additional check: if (nullptr == geomMat || visMat == geomMat)
- just in case if we start setting materials to visuals with unique
set to false
, which would cause the geometry to get the same material as the parent visual. In this case, we wouldn't need to further update the transparency of the same material.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/rendering/RenderUtil.cc
Outdated
@@ -2229,6 +2312,113 @@ void RenderUtilPrivate::LowlightNode(const rendering::NodePtr &_node) | |||
} | |||
} | |||
|
|||
///////////////////////////////////////////////// | |||
void RenderUtil::ViewTransparent(const Entity &_entity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 3 View***(const Entity &_entity)
functions are very similar. Is it possible to merge them or refactor some code in to functions so they can be reused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Atharva Pusalkar <[email protected]>
Signed-off-by: Atharva Pusalkar <[email protected]>
Signed-off-by: Atharva Pusalkar <[email protected]>
Signed-off-by: Atharva Pusalkar <[email protected]>
src/rendering/RenderUtil.cc
Outdated
} | ||
|
||
// Find all existing child links for this entity | ||
std::vector<Entity> links = this->FindChildLinks(_entity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about std::vector<Entity> links = std::move(this->FindChildLinks(_entity));
to avoid copying the vector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Find all existing child links for this entity | ||
std::vector<Entity> links = this->FindChildLinks(_entity); | ||
|
||
for (const auto &link : links) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap this block with { ..}
brackets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/rendering/SceneManager.cc
Outdated
@@ -1593,6 +1597,16 @@ void SceneManager::RemoveEntity(Entity _id) | |||
auto it = this->dataPtr->visuals.find(_id); | |||
if (it != this->dataPtr->visuals.end()) | |||
{ | |||
// Remove visual's original transparency from map | |||
rendering::VisualPtr vis = this->dataPtr->visuals[_id]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rendering::VisualPtr vis = it->second
to avoid another lookup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Atharva Pusalkar <[email protected]>
Signed-off-by: Atharva Pusalkar <[email protected]>
Signed-off-by: Atharva Pusalkar <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some conflicts
…into transparent_mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflicts because of the Inertia PR
…into transparent_mode
@ahcorde I resolved the conflicts and updated the inertia mode to use the newer functions |
This pull request has been mentioned on Gazebo Community. There might be relevant details there: |
🎉 New feature
Summary
Adds transparent mode to debug models. This is done by setting the transparency value of the material of the target visual.
Ogre1 doesn't seem to work for me (along with Align Tool's transparent mode). Can someone confirm?
Test it
Test it by selecting an entity and
View -> Transparent
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge