Skip to content

Commit

Permalink
support cloning actors
Browse files Browse the repository at this point in the history
Signed-off-by: Ashton Larkin <[email protected]>
  • Loading branch information
adlarkin committed Sep 1, 2021
1 parent 876724b commit 2fbb384
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/EntityComponentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <ignition/common/Profiler.hh>
#include <ignition/math/graph/GraphAlgorithms.hh>

#include "ignition/gazebo/components/Actor.hh"
#include "ignition/gazebo/components/CanonicalLink.hh"
#include "ignition/gazebo/components/Component.hh"
#include "ignition/gazebo/components/Factory.hh"
Expand Down Expand Up @@ -386,6 +387,13 @@ Entity EntityComponentManager::Clone(const Entity _entity, const Entity _parent,
static_cast<components::Light *>(clonedComp.get());
derivedComp->Data().SetName(clonedName);
}
else if (type == components::Actor::typeId)
{
// set the sdf::Actor's name to clonedName
auto derivedComp =
static_cast<components::Actor *>(clonedComp.get());
derivedComp->Data().SetName(clonedName);
}

this->CreateComponentImplementation(clonedEntity, type, clonedComp.get());
}
Expand Down

0 comments on commit 2fbb384

Please sign in to comment.