Skip to content

Commit 2fbb384

Browse files
committed
support cloning actors
Signed-off-by: Ashton Larkin <[email protected]>
1 parent 876724b commit 2fbb384

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/EntityComponentManager.cc

+8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <ignition/common/Profiler.hh>
3030
#include <ignition/math/graph/GraphAlgorithms.hh>
3131

32+
#include "ignition/gazebo/components/Actor.hh"
3233
#include "ignition/gazebo/components/CanonicalLink.hh"
3334
#include "ignition/gazebo/components/Component.hh"
3435
#include "ignition/gazebo/components/Factory.hh"
@@ -386,6 +387,13 @@ Entity EntityComponentManager::Clone(const Entity _entity, const Entity _parent,
386387
static_cast<components::Light *>(clonedComp.get());
387388
derivedComp->Data().SetName(clonedName);
388389
}
390+
else if (type == components::Actor::typeId)
391+
{
392+
// set the sdf::Actor's name to clonedName
393+
auto derivedComp =
394+
static_cast<components::Actor *>(clonedComp.get());
395+
derivedComp->Data().SetName(clonedName);
396+
}
389397

390398
this->CreateComponentImplementation(clonedEntity, type, clonedComp.get());
391399
}

0 commit comments

Comments
 (0)