Skip to content

Commit e55378e

Browse files
authored
Fix deeply nested merge-include for custom parsed files (#1293)
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]>
1 parent 7f63d02 commit e55378e

File tree

10 files changed

+930
-233
lines changed

10 files changed

+930
-233
lines changed

include/sdf/Model.hh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,24 @@ namespace sdf
529529
private: const std::vector<std::pair<std::optional<sdf::NestedInclude>,
530530
sdf::InterfaceModelConstPtr>> &MergedInterfaceModels() const;
531531

532+
/// \brief Get whether the model was merge-included and needs to be
533+
/// processed to carry out the merge.
534+
/// \return True if the model was merge-included.
535+
private: bool IsMerged() const;
536+
537+
/// \brief Prepare the model to be merged into the parent model or world.
538+
/// As part of the perparation, this will create the proxy frame that would
539+
/// be need to be added to the parent object.
540+
/// \param[out] _errors A list of errors encountered during the operation.
541+
/// \param[in] _parentOfProxyFrame Name of parent of the proxy frame that
542+
/// will be created. This can only be "__model__" or "world".
543+
/// \return The proxy frame for the merged model that will need to be added
544+
/// to the parent object.
545+
/// \note This is a destructive call. After this call, the model will be in
546+
/// an invalid state unless it is merged into the parent object.
547+
private: sdf::Frame PrepareForMerge(sdf::Errors &_errors,
548+
const std::string &_parentOfProxyFrame);
549+
532550
/// \brief Allow Root::Load, World::SetPoseRelativeToGraph, or
533551
/// World::SetFrameAttachedToGraph to call SetPoseRelativeToGraph and
534552
/// SetFrameAttachedToGraph

0 commit comments

Comments
 (0)