Skip to content

Commit

Permalink
Fix deeply nested merge-include for custom parsed files (#1293)
Browse files Browse the repository at this point in the history
This addresses a bug where custom parsed models were not being processed if they happen to be nested two levels or more deep where one or more of those levels is also a merge-include. This was mainly because the include tags (which remain as include tags when they point to a custom parsed file) of a merge-included child model were not moved/merged into the parent model
---------

Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey authored Aug 22, 2023
1 parent 7f63d02 commit e55378e
Show file tree
Hide file tree
Showing 10 changed files with 930 additions and 233 deletions.
18 changes: 18 additions & 0 deletions include/sdf/Model.hh
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,24 @@ namespace sdf
private: const std::vector<std::pair<std::optional<sdf::NestedInclude>,
sdf::InterfaceModelConstPtr>> &MergedInterfaceModels() const;

/// \brief Get whether the model was merge-included and needs to be
/// processed to carry out the merge.
/// \return True if the model was merge-included.
private: bool IsMerged() const;

/// \brief Prepare the model to be merged into the parent model or world.
/// As part of the perparation, this will create the proxy frame that would
/// be need to be added to the parent object.
/// \param[out] _errors A list of errors encountered during the operation.
/// \param[in] _parentOfProxyFrame Name of parent of the proxy frame that
/// will be created. This can only be "__model__" or "world".
/// \return The proxy frame for the merged model that will need to be added
/// to the parent object.
/// \note This is a destructive call. After this call, the model will be in
/// an invalid state unless it is merged into the parent object.
private: sdf::Frame PrepareForMerge(sdf::Errors &_errors,
const std::string &_parentOfProxyFrame);

/// \brief Allow Root::Load, World::SetPoseRelativeToGraph, or
/// World::SetFrameAttachedToGraph to call SetPoseRelativeToGraph and
/// SetFrameAttachedToGraph
Expand Down
Loading

0 comments on commit e55378e

Please sign in to comment.